From 76fbcf4d5530f5a6cfb55e46fe8726f755f33c26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=8Dtalo=20Johnny?= Date: Thu, 10 Jul 2025 15:30:22 -0300 Subject: [PATCH] docs: add env var setup for macOS and Windows GUI (#8181) * docs: add env var setup for macOS and Windows GUI * style-and-cleanup * docs-review * add-env-vars-to-troubleshooting * Update docs/docs/Get-Started/get-started-installation.md * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * docs-review --------- Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com> Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> --- .../Configuration/environment-variables.md | 96 +++++++++++++++++++ docs/docs/Support/troubleshooting.md | 5 + 2 files changed, 101 insertions(+) diff --git a/docs/docs/Configuration/environment-variables.md b/docs/docs/Configuration/environment-variables.md index 89b0d7d0e..a5434ee45 100644 --- a/docs/docs/Configuration/environment-variables.md +++ b/docs/docs/Configuration/environment-variables.md @@ -388,3 +388,99 @@ To run Langflow using the above VSCode `tasks.json` file, in the VSCode command + +## Set environment variables for Langflow Desktop + +Environment variables set in your terminal aren't automatically available to GUI-based applications like Langflow Desktop when you launch them from the Windows or macOS GUI. + +For Windows, this means any GUI-based app launched from the Start menu, desktop shortcuts, or Windows Explorer. + +For macOS, this means any GUI-based app launched from Finder, Spotlight, Launchpad, or the Dock. + +To set environment variables for Langflow Desktop, you need to use specific commands or files, depending on your OS. + + + + +Langflow Desktop for macOS cannot automatically use variables set in your terminal, such as those in`.zshrc` or `.bash_profile`, when launched from the macOS GUI. + +To make environment variables available to GUI apps on macOS, you need to use `launchctl` with a `plist` file: + +1. Create the `LaunchAgents` directory if it doesn't exist: + +```bash +mkdir -p ~/Library/LaunchAgents +``` + +2. In the `LaunchAgents` directory, create a `.plist` file called `dev.langflow.env`. + +3. Add the following content to `dev.langflow.env.plist`, and then add, change, or remove Langflow environment variables as needed for your configuration. +This example sets the `LANGFLOW_CONFIG_DIR` environment variable for all GUI apps launched from the macOS GUI. + +```xml + + + + + Label + dev.langflow.env + ProgramArguments + + launchctl + setenv + LANGFLOW_CONFIG_DIR + /Users/your_user/custom/config + + RunAtLoad + + + +``` + +4. Load the file with `launchctl`: +```bash +launchctl load ~/Library/LaunchAgents/dev.langflow.env.plist +``` + + + + +Langflow Desktop for Windows cannot automatically use variables set in your terminal, such as those defined with `set` in `cmd` or `$env:VAR=...` in PowerShell, when launched from the Windows GUI. + +To make environment variables available to the Langflow Desktop app, you must set them at the user or system level using the **System Properties** interface or the Terminal. + +To set environment variables using the System Properties interface, do the following: + +1. Press Win + R, enter `SystemPropertiesAdvanced`, and then press Enter. +2. Click **Environment Variables**. +3. Under **User variables**, click **New**. +:::tip +To apply the setting to all users, select **System variables**. +::: +4. Enter the name of the Langflow variable you want to set, such as `LANGFLOW_CONFIG_DIR`, and the desired value, such as `C:\Users\your_user\.langflow_config`. +5. Click **OK** to save the variable. +6. Repeat until you have set all necessary Langflow environment variables. +7. Launch or restart Langflow Desktop to apply the environment variables. + + + + +To define environment variables for Windows using PowerShell, do the following: + +1. Enter the name of the Langflow variable you want to set, such as `LANGFLOW_CONFIG_DIR`, and the desired value, such as `C:\Users\your_user\.langflow_config`. + + To set an environment variable for the current user: + ```powershell + [System.Environment]::SetEnvironmentVariable("LANGFLOW_CONFIG_DIR", "C:\Users\your_user\.langflow_config", "User") + ``` + + To set an environment variable for all users (you must have Administrator priveleges): + ```powershell + [System.Environment]::SetEnvironmentVariable("LANGFLOW_CONFIG_DIR", "C:\Langflow\Config", "Machine") + ``` + +2. Repeat until you have set all necessary Langflow environment variables. +3. Launch or restart Langflow Desktop to apply the environment variables. + + diff --git a/docs/docs/Support/troubleshooting.md b/docs/docs/Support/troubleshooting.md index a125d4ebb..aa620683d 100644 --- a/docs/docs/Support/troubleshooting.md +++ b/docs/docs/Support/troubleshooting.md @@ -112,6 +112,11 @@ There are two possible reasons for this error: * **Version conflict during installation**: Some version conflicts might have occurred during the installation process. To resolve this issue, reinstall Langflow and its dependencies by running `python -m pip install langflow --pre -U --force-reinstall`. +### Environment variables not available from terminal + +Environment variables set in your terminal are not automatically available to GUI-based applications like Langflow Desktop when launched through the Finder or the Start Menu. +To set environment variables for Langflow Desktop, see [Set environment variables for Langflow Desktop](/environment-variables#set-environment-variables-for-langflow-desktop). + ### Package is not installed In Langflow OSS, you can follow the error message's instructions to install the missing dependency.