Comments (11)
Hey there, @GimmeSomeJazz! I'm here to help you out with any bugs, questions, or contributions you have in mind. Let's squash those bugs together while we wait for a human maintainer.
To resolve the issue with the langchain_cohere
module and the _lzma
module on macOS, follow these steps:
-
Install the
langchain_cohere
module and its dependencies:pip install langchain-cohere==0.1.0rc1 pip install cohere==5.5.3
-
Fix the
_lzma
module issue:
The_lzma
module is part of thelzma
library, which may not be installed by default on macOS. You can install it using Homebrew:brew install xz
After installing
xz
, you may need to reinstall Python to ensure it includes support forlzma
:pyenv install 3.10.14 pyenv global 3.10.14
-
Set environment variables for macOS:
Ensure you set the necessary environment variables to avoid errors when running Langflow on macOS:export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES export no_proxy=*
-
Run Langflow:
Start Langflow with the following command:python -m langflow run
These steps should help resolve the issues you're encountering with the langchain_cohere
module and the _lzma
module on macOS [1][2].
To continue talking to Dosu, mention @dosu.
from langflow.
To resolve the httpx.ConnectError
due to a Request('GET', 'https://pypi.org/pypi/langflow/json')
at runtime, likely caused by proxy issues, you need to correctly set your proxy on macOS. You can configure the proxy settings in your httpx
client as follows:
import httpx
proxies = {
"http://": "http://your_proxy_address:your_proxy_port",
"https://": "http://your_proxy_address:your_proxy_port",
}
async def make_request_with_proxy():
async with httpx.AsyncClient(proxies=proxies) as client:
try:
response = await client.get('https://pypi.org/pypi/langflow/json')
response.raise_for_status()
return response.json()
except httpx.ConnectError as e:
print(f"Connection error: {e}")
except httpx.HTTPStatusError as e:
print(f"HTTP error: {e}")
# Run the request
import asyncio
asyncio.run(make_request_with_proxy())
Replace your_proxy_address
and your_proxy_port
with your actual proxy address and port. This should help you bypass the proxy issues and successfully make the request [1].
To continue talking to Dosu, mention @dosu.
from langflow.
To resolve the proxy issue causing an httpx.ConnectError
when running python -m langflow run
on macOS, you need to set the no_proxy
environment variable to *
. This is already handled in the set_var_for_macos_issue
function in the provided code.
Ensure that this function is called before running the server, which is already done in the run
function:
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"] = "*"
logger.debug("Set OBJC_DISABLE_INITIALIZE_FORK_SAFETY to YES to avoid error")
def run(
host: str = typer.Option("127.0.0.1", help="Host to bind the server to.", envvar="LANGFLOW_HOST"),
workers: int = typer.Option(1, help="Number of worker processes.", envvar="LANGFLOW_WORKERS"),
timeout: int = typer.Option(300, help="Worker timeout in seconds.", envvar="LANGFLOW_WORKER_TIMEOUT"),
port: int = typer.Option(7860, help="Port to listen on.", envvar="LANGFLOW_PORT"),
components_path: Optional[Path] = typer.Option(
Path(__file__).parent / "components",
help="Path to the directory containing custom components.",
envvar="LANGFLOW_COMPONENTS_PATH",
),
env_file: Path = typer.Option(None, help="Path to the .env file containing environment variables."),
log_level: str = typer.Option("critical", help="Logging level.", envvar="LANGFLOW_LOG_LEVEL"),
log_file: Path = typer.Option("logs/langflow.log", help="Path to the log file.", envvar="LANGFLOW_LOG_FILE"),
cache: Optional[str] = typer.Option(
envvar="LANGFLOW_LANGCHAIN_CACHE",
help="Type of cache to use. (InMemoryCache, SQLiteCache)",
default=None,
),
dev: bool = typer.Option(False, help="Run in development mode (may contain bugs)"),
path: str = typer.Option(
None,
help="Path to the frontend directory containing build files. This is for development purposes only.",
envvar="LANGFLOW_FRONTEND_PATH",
),
open_browser: bool = typer.Option(
True,
help="Open the browser after starting the server.",
envvar="LANGFLOW_OPEN_BROWSER",
),
remove_api_keys: bool = typer.Option(
False,
help="Remove API keys from the projects saved in the database.",
envvar="LANGFLOW_REMOVE_API_KEYS",
),
backend_only: bool = typer.Option(
False,
help="Run only the backend server without the frontend.",
envvar="LANGFLOW_BACKEND_ONLY",
),
store: bool = typer.Option(
True,
help="Enables the store features.",
envvar="LANGFLOW_STORE",
),
):
configure(log_level=log_level, log_file=log_file)
set_var_for_macos_issue()
if env_file:
load_dotenv(env_file, override=True)
update_settings(
dev=dev,
remove_api_keys=remove_api_keys,
cache=cache,
components_path=components_path,
store=store,
)
static_files_dir: Optional[Path] = Path(path) if path else None
app = setup_app(static_files_dir=static_files_dir, backend_only=backend_only)
if is_port_in_use(port, host):
port = get_free_port(port)
settings_service = get_settings_service()
settings_service.set("worker_timeout", timeout)
options = {
"bind": f"{host}:{port}",
"workers": get_number_of_workers(workers),
"timeout": timeout,
}
if "pytest" in sys.modules:
return
try:
if platform.system() in ["Windows"]:
process = run_on_windows(host, port, log_level, options, app)
else:
process = run_on_mac_or_linux(host, port, log_level, options, app)
if open_browser:
click.launch(f"http://{host}:{port}")
if process:
process.join()
except KeyboardInterrupt:
pass
Make sure the set_var_for_macos_issue
function is being executed by adding a debug statement or print statement to confirm its execution [1][2].
To continue talking to Dosu, mention @dosu.
from langflow.
To resolve the httpx.ConnectError
due to a proxy issue when running python -m langflow run
on macOS without modifying the Langflow code at runtime, you can set the no_proxy
environment variable to bypass the proxy for local addresses. This can be done by setting the environment variable before running the command.
Here is how you can do it in the terminal:
export no_proxy="*"
python -m langflow run
Additionally, Langflow has a built-in function set_var_for_macos_issue
that sets the no_proxy
environment variable to *
to avoid errors with gunicorn on macOS. This function is called within the run
command of Langflow, ensuring that the necessary environment variables are set automatically when running the application [1][2][3].
To continue talking to Dosu, mention @dosu.
from langflow.
@ogabrielluiz, this one's a bit out of my wheelhouse, could you step in and provide your guidance?
To continue talking to Dosu, mention @dosu.
from langflow.
It looks like the issue with the httpx.ConnectError
due to proxy settings is a bit tricky. Here are a few steps you can try to resolve it:
-
Set the
no_proxy
Environment Variable:
Ensure that theno_proxy
environment variable is set to*
to bypass the proxy for local addresses. You can do this in your terminal before running Langflow:export no_proxy="*" python -m langflow run
-
Check the
set_var_for_macos_issue
Function:
Langflow has a built-in functionset_var_for_macos_issue
that sets theno_proxy
environment variable to*
to avoid errors with gunicorn on macOS. This function is called within therun
command of Langflow, ensuring that the necessary environment variables are set automatically when running the application. -
Proxy Configuration in
httpx
:
If you need to set a proxy forhttpx
, you can configure it in your code. However, since you mentioned you cannot modify the Langflow code at runtime, this might not be directly applicable. But for reference, here's how you can set up a proxy inhttpx
:import httpx proxies = { "http://": "http://your_proxy_address:your_proxy_port", "https://": "http://your_proxy_address:your_proxy_port", } async def make_request_with_proxy(): async with httpx.AsyncClient(proxies=proxies) as client: try: response = await client.get('https://pypi.org/pypi/langflow/json') response.raise_for_status() return response.json() except httpx.ConnectError as e: print(f"Connection error: {e}") except httpx.HTTPStatusError as e: print(f"HTTP error: {e}") # Run the request import asyncio asyncio.run(make_request_with_proxy())
-
Running Langflow:
After setting theno_proxy
environment variable, try running Langflow again:python -m langflow run
If the GUI loads and works fine despite the ConnectError
, you might be able to proceed without further issues. If you continue to face problems, it might be best to get in touch with a human maintainer for more specific guidance.
@ogabrielluiz, could you please provide further assistance if needed?
Let us know how it goes!
To continue talking to Dosu, mention @dosu.
from langflow.
hey @dosu. That resolved my first issue. Now I am facing a httpx.ConnectError due to a Request('GET', 'https://pypi.org/pypi/langflow/json') somewhere at the runtime. Certainly due to proxy issues. Any idea to resolve it / to set my proxy? Thank you! (so strange to say thank you to a bot haha)
from langflow.
does not working for me @dosu. I have this error when I run the command python -m langflow run
and I cannot modify the langflow code at runtime!
The error comes from here :
langflow/__main__.py:303 in
│ fetch_latest_version
│
│ 300
│ 301
│ 302 def fetch_latest_version(package_name: str, include_prerelease: bool) -> Optional[str]:
│ ❱ 303 │ response = httpx.get(f"https://pypi.org/pypi/{package_name}/json")
│ 304 │ versions = response.json()["releases"].keys()
│ 305 │ valid_versions = [v for v in versions if include_prerelease or not is_prerelease(v)]
│ 306 │ if not valid_versions:
│
│ ╭──────────── locals ─────────────╮
│ │ include_prerelease = True │
│ │ package_name = 'langflow' │
│ ╰─────────────────────────────────╯
from langflow.
does not working for me @dosu. I have this error when I run the command python -m langflow run
and I cannot modify the langflow code at runtime! Is there any options in langflow to set proxy / ssl configuration?
The error comes from here :
langflow/__main__.py:303 in
│ fetch_latest_version
│
│ 300
│ 301
│ 302 def fetch_latest_version(package_name: str, include_prerelease: bool) -> Optional[str]:
│ ❱ 303 │ response = httpx.get(f"https://pypi.org/pypi/{package_name}/json")
│ 304 │ versions = response.json()["releases"].keys()
│ 305 │ valid_versions = [v for v in versions if include_prerelease or not is_prerelease(v)]
│ 306 │ if not valid_versions:
│
│ ╭──────────── locals ─────────────╮
│ │ include_prerelease = True │
│ │ package_name = 'langflow' │
│ ╰─────────────────────────────────╯
from langflow.
@dosu, it does not work. I need to talk to one human please.
from langflow.
@dosu @ogabrielluiz I had that error message, but the gui seems to load in fact (ConnectError: [Errno 8] nodename nor servname provided, or not known). So I will try, and if things go ok, I close the issue!
from langflow.
Related Issues (20)
- [a58 bug] Chat Input stopped working with Azure OpenAI model/embedding component HOT 2
- [a58 bug] Azure OpenAI global variables passed via "--env-file" doesn't work correctly HOT 1
- Qdrant Search: Invalid Input from "Chat Input" in v1.0.0a58 HOT 3
- [Feature Request] Control Output Values of ChatMemory and MessageHistory Components
- Faiss search error HOT 2
- The outout of the Chat Input is not been recognized as text by OpenAI model HOT 3
- Error Building Component Error building Component Astra DB: {"errors":[{"message":"Request invalid: field 'command.name' value \"english-test\" not valid. Problem: must match \"[a-zA-Z][a-zA-Z0-9_]*\".","errorCode":"COMMAND_FIELD_INVALID"}]} HOT 1
- ValidationError: 2 validation errors for HumanMessage at v1.0.0a59 HOT 2
- Encountering error in building ASTRA DB Search node in the canvas. Error Building Component Error building Component Astra DB Search: Invalid inputs provided. HOT 4
- API Request ERROR HOT 3
- [Feature Request]: Allow local cassandra connections
- idea
- [Request] Please add openrouter as LLM Model
- Nested chats HOT 1
- Module langflow.inputs not found HOT 1
- CommandError: Multiple head revisions are present for given argument 'head'; please specify a specific target revision, '<branchname>@head' to narrow to a specific head, or 'heads' for all heads HOT 1
- Questions about Run Flow HOT 1
- An error was thrown while using the groq component HOT 1
- Question: Hugging Face API HOT 1
- Issue with Chat Input component
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from langflow.