Nearly impossible to make it work behind a proxy
Bug Description
I am working behind a proxy server. If I disable the proxy setting, when starting up langflow, it will try to fetch some pypi langflow json data, if it fails, it crash. If setup the proxy setting, when I try to use our internal LLM service, it seems langflow can not recognize the NO_PROXY setting, it will try to access the local LLM service via proxy, that will fail for sure. Dilemma.
Reproduction
Windows 11.
- If I disable the proxy setting, when starting up langflow, it will try to fetch some pypi langflow json data, if it fails, it crash.
- If setup the proxy setting, when I try to use our internal LLM service, it seems langflow can not recognize the NO_PROXY setting, it will try to access the local LLM service via proxy, that will fail for sure. Dilemma.
Expected behavior
Langflow recognize the NO_PROXY settings.
Who can help?
No response
Operating System
Windows 11
Langflow Version
v1.0.14
Python Version
None
Screenshot
No response
Flow File
No response
To address the issues you're facing with Langflow behind a proxy on Windows 11, you can take the following steps:
-
Configure the
NO_PROXYSetting: Ensure that theNO_PROXYenvironment variable is set correctly to bypass the proxy for your internal services. You can set this environment variable in your system or within your application settings.Here is how you can set the
NO_PROXYenvironment variable in Python:import os # Set the NO_PROXY environment variable os.environ['NO_PROXY'] = 'localhost,127.0.0.1,.yourdomain.com' # Now you can initialize your settings settings = Settings()In the context of Langflow, you can add this configuration in the
base.pyfile where the settings are initialized. Ensure that this environment variable is set before any network operations are performed [1]. -
Bypass PyPI Data Fetching: To prevent Langflow from fetching PyPI data during startup, you can use the
--no-storeparameter in the CLI options or set theLANGFLOW_STOREenvironment variable toFalse.langflow run --no-storeOr set the environment variable:
export LANGFLOW_STORE=FalseThis will disable the store features and prevent Langflow from attempting to fetch PyPI data during startup [2].
By following these steps, you should be able to configure Langflow to properly recognize the NO_PROXY setting and avoid issues with accessing internal services and fetching PyPI data behind a proxy.
To continue talking to Dosu, mention @dosu.
To address the issues you're facing with Langflow behind a proxy on Windows 11, you can take the following steps:
Configure the
NO_PROXYSetting: Ensure that theNO_PROXYenvironment variable is set correctly to bypass the proxy for your internal services. You can set this environment variable in your system or within your application settings. Here is how you can set theNO_PROXYenvironment variable in Python:import os # Set the NO_PROXY environment variable os.environ['NO_PROXY'] = 'localhost,127.0.0.1,.yourdomain.com' # Now you can initialize your settings settings = Settings()In the context of Langflow, you can add this configuration in the
base.pyfile where the settings are initialized. Ensure that this environment variable is set before any network operations are performed [1].Bypass PyPI Data Fetching: To prevent Langflow from fetching PyPI data during startup, you can use the
--no-storeparameter in the CLI options or set theLANGFLOW_STOREenvironment variable toFalse.langflow run --no-storeOr set the environment variable:
export LANGFLOW_STORE=FalseThis will disable the store features and prevent Langflow from attempting to fetch PyPI data during startup [2].
By following these steps, you should be able to configure Langflow to properly recognize the
NO_PROXYsetting and avoid issues with accessing internal services and fetching PyPI data behind a proxy.To continue talking to Dosu, mention @dosu.
tried with --no-store it still try to fetch https://pypi.org/pypi/langflow/json
To ensure Langflow properly recognizes the NO_PROXY setting and avoids fetching PyPI data during startup, you can modify the relevant functions to respect the NO_PROXY environment variable. Here are the steps:
-
Set the
NO_PROXYEnvironment Variable: Ensure that theNO_PROXYenvironment variable is set correctly in your environment. This can be done in your system settings or within your application code.import os os.environ['NO_PROXY'] = 'localhost,127.0.0.1,.yourdomain.com' -
Modify Functions to Respect
NO_PROXY: Update the functions that fetch PyPI data to respect theNO_PROXYsetting. For example, you can modify thefetch_latest_versionfunction to use thehttpxlibrary with proxy settings:import httpx import os def fetch_latest_version(package_name: str, include_prerelease: bool) -> Optional[str]: proxies = { "all://": None # Disable proxy for all protocols } if "NO_PROXY" in os.environ: no_proxy = os.environ["NO_PROXY"] proxies = { "all://": None, "no_proxy": no_proxy } response = httpx.get(f"https://pypi.org/pypi/{package_name}/json", proxies=proxies) versions = response.json()["releases"].keys() valid_versions = [v for v in versions if include_prerelease or not is_prerelease(v)] if not valid_versions: return None # Handle case where no valid versions are found return max(valid_versions, key=lambda v: pkg_version.parse(v)) -
Ensure
NO_PROXYis Set During Startup: Make sure theNO_PROXYenvironment variable is set before any network operations are performed. You can add this configuration in theset_var_for_macos_issuefunction or similar initialization code:def set_var_for_macos_issue(): if platform.system() in ["Darwin"]: import os os.environ["OBJC_DISABLE_INITIALIZE_FORK_SAFETY"] = "YES" os.environ["no_proxy"] = "*" # to avoid error with gunicorn logger.debug("Set OBJC_DISABLE_INITIALIZE_FORK_SAFETY to YES to avoid error")
By following these steps, you should be able to configure Langflow to properly recognize the NO_PROXY setting and avoid fetching PyPI data during startup [1][2][3].
To continue talking to Dosu, mention @dosu.
@maxpaynebupt Could you elaborate more on your deployment architecture (bare metal, k8s, pypi package, docker, single container...)?
it will try to fetch some pypi langflow json data what does it mean?
@maxpaynebupt Could you elaborate more on your deployment architecture (bare metal, k8s, pypi package, docker, single container...)?
it will try to fetch some pypi langflow json data what does it mean?
just pypi package installed on windows 11