langflow
langflow copied to clipboard
Cannot run Langflow in a vanilla environment on OSX
Describe the bug When installing in a brand new conda environment in OSX, langflow will not start.
To Reproduce Steps to reproduce the behavior:
- conda create -n langflow python=3.10
- conda activate langflow
- pip install langflow
- langflow run
I get the following output:
$ langflow run
/Users/ruze/anaconda3/envs/langflow/lib/python3.10/site-packages/langchain/_api/module_import.py:120: LangChainDeprecationWarning: Importing SQLDatabase from langchain is deprecated. Please replace deprecated imports:
>> from langchain import SQLDatabase
with new imports of:
>> from langchain_community.utilities import SQLDatabase
warn_deprecated(
/Users/ruze/anaconda3/envs/langflow/lib/python3.10/site-packages/langchain/_api/module_import.py:120: LangChainDeprecationWarning: Importing RequestsWrapper from langchain is deprecated. Please replace deprecated imports:
>> from langchain import RequestsWrapper
with new imports of:
>> from langchain_community.utilities import RequestsWrapper
warn_deprecated(
╭───────────────────────────────────────────────────╮
│ Welcome to ⛓ Langflow │
│ │
│ Access http://127.0.0.1:7860 │
│ Collaborate, and contribute at our GitHub Repo 🚀 │
╰───────────────────────────────────────────────────╯
[05/13/24 14:00:05] INFO 2024-05-13 14:00:05 - INFO - service - Alembic already initialized service.py:142
INFO 2024-05-13 14:00:05 - INFO - service - Running DB migrations in service.py:150
/Users/ruze/anaconda3/envs/langflow/lib/python3.10/site-packages/langflow/alembic
/Users/ruze/anaconda3/envs/langflow/lib/python3.10/site-packages/langflow/alembic/env.py:82: SAWarning: WARNING: SQL-parsed foreign key constraint '('user_id', 'user', 'id')' could not be located in PRAGMA foreign_keys for table flow
context.run_migrations()
/Users/ruze/anaconda3/envs/langflow/lib/python3.10/site-packages/langflow/alembic/env.py:82: SAWarning: WARNING: SQL-parsed foreign key constraint '('user_id', 'user', 'id')' could not be located in PRAGMA foreign_keys for table flow
context.run_migrations()
[05/13/24 14:00:08] ERROR 2024-05-13 14:00:08 - ERROR - service - AutogenerateDiffsDetected: {exc} service.py:162
ERROR 2024-05-13 14:00:08 - ERROR - utils - Something went wrong running migrations. Please, run `langflow migration --fix` utils.py:51
ERROR 2024-05-13 14:00:08 - ERROR - utils - Something went wrong running migrations. Please, run `langflow migration --fix` utils.py:216
Running langflow migration --fix
does not help either. It seems to succeed but the same output when running langflow run
again after fixing migrations.
To address the issues you're encountering with Langflow on OSX, let's tackle them step by step:
-
Deprecation Warnings: The warnings about deprecated imports from
langchain
suggest updating your code to use the new import paths. Replace deprecated imports with:-
from langchain_community.utilities import SQLDatabase
-
from langchain_community.utilities import RequestsWrapper
-
-
SAWarning Messages: These warnings indicate issues with SQL-parsed foreign key constraints. This could be due to SQLite not having foreign key support enabled by default. Ensure SQLite foreign key support is enabled in your environment with
PRAGMA foreign_keys=ON
. -
AutogenerateDiffsDetected Error: This error suggests discrepancies between the expected database schema and the actual schema. You might need to manually adjust the database schema or modify the migration scripts to align with the desired database schema state.
-
Running Langflow: If you encounter a
No module named 'langflow.__main__'
error, try usingpython -m langflow run
instead oflangflow run
. For persistent issues, reinstall Langflow withpython -m pip install langflow --pre -U
or force reinstall withpython -m pip install langflow --pre -U --force-reinstall
. -
Migration Issues: If running
langflow migration --fix
doesn't resolve migration issues, consider clearing the cache by deleting the contents of the cache folder located at/Users/<username>/Library/Caches/langflow/
on MacOS. This step is crucial when upgrading Langflow, as it ensures that old cache files don't interfere with the new version.
These steps should help mitigate the issues you're facing with Langflow installation and execution. If problems persist, providing more specific error messages and details about your environment can help in diagnosing and resolving the issues more effectively.
Details
Sources
- docs/docs/migration/possible-installation-issues.mdx
- src/backend/langflow/alembic/versions/260dbcc8b680_adds_tables.py
- src/backend/base/langflow/alembic/versions/260dbcc8b680_adds_tables.py
- src/backend/langflow/services/database/service.py
- src/backend/langflow/main.py
- docs/docs/migration/possible-installation-issues.mdx
- src/backend/base/langflow/components/langchain_utilities/SQLDatabase.py
- src/backend/langflow/components/chains/SQLDatabaseChain.py
- pyproject.toml
- docs/docs/getting-started/install-langflow.mdx
- docs/docs/getting-started/install-langflow.mdx
About Dosu This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
To continue the conversation, mention @dosu.
Migration Issues: If running langflow migration --fix doesn't resolve migration issues, consider clearing the cache by deleting the contents of the cache folder located at /Users/
This seemed to work, thanks. However, it still seems like a bug in that it shouldn't have to be done manually in a new install.