streamlit version: 1.41.1
OS: archlinux
(running on local machine)
Summary:
Streamlit uses my archlinux python-numpy-2.2.1-2 despite running out a venv with numpy 1.23.1 version installed.
More details:
Due to some dependency issues between numpy, bokeh and the python version itself, I need to run
python 3.10.16
bokeh 2.4.3
numpy 1.23.1
I tried setting this up using pyenv and pipenv and alternatively uv , to the same result.
If I activate the venv and run streamlit, it uses the python 3.10.16 version BUT still uses my system’s numpy 2.2.1 , which is not compatible with the rest of the setup.
I would appriciate any tips on howto resolve this issue.
this is also irritating me, but here is a log (I redacted some user paths):
You can now view your Streamlit app in your browser.
Local URL: http://localhost:8501
Network URL: http://10.133.8.24:8501
2025-01-17 10:36:26.890 Uncaught app execution
Traceback (most recent call last):
File "/usr/lib/python3.13/site-packages/numpy/_core/__init__.py", line 23, in <module>
from . import multiarray
File "/usr/lib/python3.13/site-packages/numpy/_core/multiarray.py", line 10, in <module>
from . import overrides
File "/usr/lib/python3.13/site-packages/numpy/_core/overrides.py", line 7, in <module>
from numpy._core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy._core._multiarray_umath'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.13/site-packages/numpy/__init__.py", line 114, in <module>
from numpy.__config__ import show_config
File "/usr/lib/python3.13/site-packages/numpy/__config__.py", line 4, in <module>
from numpy._core._multiarray_umath import (
File "/usr/lib/python3.13/site-packages/numpy/_core/__init__.py", line 49, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.10 from "<redacted>/.venv/bin/python3"
* The NumPy version is: "2.2.1"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: No module named 'numpy._core._multiarray_umath'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<redacted>/.venv/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 88, in exec_func_with_error_handling
result = func()
File "<redacted>/.venv/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 579, in code_to_exec
exec(code, module.__dict__)
File "<redacted>/display.py", line 2, in <module>
import numpy as np
File "/usr/lib/python3.13/site-packages/numpy/__init__.py", line 119, in <module>
raise ImportError(msg) from e
ImportError: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python interpreter from there.
There might be a PATH misconfiguration or something that is prioritizing a global installation. Can you uninstall numpy from your global environment and then try again to create a clean environement and install numpy there?