alejandro-ao / langchain-ask-pdf

An AI-app that allows you to upload a PDF and ask questions about it. It uses OpenAI's LLMs to generate a response.
584 stars 308 forks source link

ModuleNotFoundError: No module named 'altair.vegalite.v4 #9

Closed jinxlo closed 1 year ago

jinxlo commented 1 year ago

While running a Streamlit app from the command line, I encountered an error. Here are the details:

Environment:

Python version: 3.11 Streamlit version: (please provide the version if available) Operating System: Windows

Command used to run the application: E:\AI STUFF\PDF GPT\langchain-ask-pdf>streamlit run app.py

**Error message:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Program Files\Python311\Scripts\streamlit.exe\__main__.py", line 4, in <module>
  File "C:\Program Files\Python311\Lib\site-packages\streamlit\__init__.py", line 55, in <module>
    from streamlit.delta_generator import DeltaGenerator as _DeltaGenerator
  File "C:\Program Files\Python311\Lib\site-packages\streamlit\delta_generator.py", line 43, in <module>
    from streamlit.elements.arrow_altair import ArrowAltairMixin
  File "C:\Program Files\Python311\Lib\site-packages\streamlit\elements\arrow_altair.py", line 36, in <module>
    from altair.vegalite.v4.api import Chart
ModuleNotFoundError: No module named 'altair.vegalite.v4'

It seems the module 'altair.vegalite.v4' is missing. However, I believe all dependencies were correctly installed.

Please, could you help to investigate and resolve this issue?

Labels: bug, help wanted, good first issue

Kunstbanause commented 1 year ago

same for me Edit: Got it working using anaconda navigator. I would describe this experience as: cumbersome ;)

Edit2: Got an even better work around: python -m streamlit run app.py

This works for me straight into the visual code terminal window or alternatively in the windows powershell. I deinstalled Anaconda Navigator and it still works. (windows 10)

morrisonak commented 1 year ago

This seems to work Closed issue 8

jinxlo commented 1 year ago

While running a Streamlit app from the command line, I encountered an error. Here are the details:

Environment:

Python version: 3.11 Streamlit version: (please provide the version if available) Operating System: Windows

Command used to run the application: E:\AI STUFF\PDF GPT\langchain-ask-pdf>streamlit run app.py

**Error message:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Program Files\Python311\Scripts\streamlit.exe\__main__.py", line 4, in <module>
  File "C:\Program Files\Python311\Lib\site-packages\streamlit\__init__.py", line 55, in <module>
    from streamlit.delta_generator import DeltaGenerator as _DeltaGenerator
  File "C:\Program Files\Python311\Lib\site-packages\streamlit\delta_generator.py", line 43, in <module>
    from streamlit.elements.arrow_altair import ArrowAltairMixin
  File "C:\Program Files\Python311\Lib\site-packages\streamlit\elements\arrow_altair.py", line 36, in <module>
    from altair.vegalite.v4.api import Chart
ModuleNotFoundError: No module named 'altair.vegalite.v4'

It seems the module 'altair.vegalite.v4' is missing. However, I believe all dependencies were correctly installed.

Please, could you help to investigate and resolve this issue?

Labels: bug, help wanted, good first issue

Solved the issue: here is a summary of how we addressed the issue:

The error message indicated that the Python module altair.vegalite.v4 was not found. This module is a part of the Altair package, a statistical visualization library that streamlit depends on.

At first, we attempted to resolve the issue by installing the Altair package. However, the error persisted because the installed version of Altair was 5.0.0, which does not include the altair.vegalite.v4 module.

The altair.vegalite.v4 module is present in the 4.x.x versions of Altair. Therefore, the error was resolved by downgrading Altair to version 4.1.0 using the command pip install altair==4.1.0.

This allowed streamlit to find the required altair.vegalite.v4 module, thus solving the ModuleNotFoundError.