langflow icon indicating copy to clipboard operation
langflow copied to clipboard

Cannot run Langflow in a vanilla environment on OSX

Open ruze00 opened this issue 9 months ago • 2 comments

Describe the bug When installing in a brand new conda environment in OSX, langflow will not start.

To Reproduce Steps to reproduce the behavior:

  1. conda create -n langflow python=3.10
  2. conda activate langflow
  3. pip install langflow
  4. 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.

ruze00 avatar May 13 '24 18:05 ruze00

To address the issues you're encountering with Langflow on OSX, let's tackle them step by step:

  1. 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
  2. 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.

  3. 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.

  4. Running Langflow: If you encounter a No module named 'langflow.__main__' error, try using python -m langflow run instead of langflow run. For persistent issues, reinstall Langflow with python -m pip install langflow --pre -U or force reinstall with python -m pip install langflow --pre -U --force-reinstall.

  5. 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


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.

dosubot[bot] avatar May 13 '24 18:05 dosubot[bot]

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//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.

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.

ruze00 avatar May 13 '24 18:05 ruze00