0

I am using different environment (Conda) for the project (python 3.10.9). When I import libraries and packages etc, it is importing from that environment's path. But when I import streamlit-extras package, even though it is installed on the same environment, It is searching from other version (python 3.7) and therefore giving ModuleNotFound Error. I looked here and other questions but couldn't solve my problem. I checked the current environment's location and streamlit-extras is there.

ModuleNotFoundError: No module named 'streamlit_extras.let_it_rain'
Traceback:
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)
File "/Users/abduraimovusmanjon/Desktop/danger/pages/1__Insights.py", line 16, in <module>
    from streamlit_extras.let_it_rain import rain

As seen from the error, it is looking some other path (python 3.7) for only this package, even if the package is located on the same environment which I am working. Any other import is working without problem. enter image description here

Is there easier way that whenever I import, python will stick on the current environment? Or any other way to solve this issue?

Thanks in advance for help!

Maurice Meyer
  • 17,279
  • 4
  • 30
  • 47
PivotAl
  • 35
  • 5

1 Answers1

1

It looks like you have another installed version of streamlit-extras, which was installed outside of the pip package manager.

And that other version takes precedence over the pip one.

You can check your PATH variable: it will show you which directories are looked at to resolve your streamlit-extras and the order in which they are checked.

One of the earlier paths likely points to /Library/Frameworks/Python.framework/Versions/3.7/lib. Either remove it, or re-order paths so that your Conda environment path shows first.

tacon
  • 321
  • 1
  • 6