You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there. I've been using nixpacks in Railway for a while, but I'm also pretty new to the nix universe in general. Basically, I have a Python application which depends on pandas, which depends on numpy. Here's an equivalent nixpacks.toml which reproduces the error:
Now I can build and run this image without problems. Pandas is in fact available from the virtualenv:
nixpacks build . --name pandastest
docker run -it pandastest
<module 'pandas' from '/opt/venv/lib/python3.10/site-packages/pandas/__init__.py'>
The problem is when trying to import pandas from a Python shell:
docker run -it --entrypoint bash pandastest
root@fb4d21ee17c4:/app# . /opt/venv/bin/activate
(venv) root@fb4d21ee17c4:/app# python
Python 3.10.15 (main, Sep 7 2024, 00:20:06) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/venv/lib/python3.10/site-packages/pandas/__init__.py", line 19, in <module>
raise ImportError(
ImportError: Unable to import required dependencies:
numpy: 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.
If I then try to import numpy, I can see the underlying error:
>>> import numpy
Traceback (most recent call last):
File "/opt/venv/lib/python3.10/site-packages/numpy/_core/__init__.py", line 23, in <module>
from . import multiarray
File "/opt/venv/lib/python3.10/site-packages/numpy/_core/multiarray.py", line 10, in <module>
from . import overrides
File "/opt/venv/lib/python3.10/site-packages/numpy/_core/overrides.py", line 7, in <module>
from numpy._core._multiarray_umath import (
ImportError: libstdc++.so.6: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/venv/lib/python3.10/site-packages/numpy/__init__.py", line 114, in <module>
from numpy.__config__ import show_config
File "/opt/venv/lib/python3.10/site-packages/numpy/__config__.py", line 4, in <module>
from numpy._core._multiarray_umath import (
File "/opt/venv/lib/python3.10/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 "/opt/venv/bin/python"
* The NumPy version is: "2.2.6"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: libstdc++.so.6: cannot open shared object file: No such file or directory
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/venv/lib/python3.10/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.
This seems to be very nix-specific. So I found this discussion in the NixOS forum which addresses the same NumPy error and suggests a solution to get a pandas-powered Python shell. However, I'm not sure how to do the same thing with nixpacks. Could someone please point me in the right direction?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there. I've been using nixpacks in Railway for a while, but I'm also pretty new to the nix universe in general. Basically, I have a Python application which depends on pandas, which depends on numpy. Here's an equivalent nixpacks.toml which reproduces the error:
And the requirements.txt file:
Now I can build and run this image without problems. Pandas is in fact available from the virtualenv:
The problem is when trying to import pandas from a Python shell:
If I then try to import numpy, I can see the underlying error:
This seems to be very nix-specific. So I found this discussion in the NixOS forum which addresses the same NumPy error and suggests a solution to get a pandas-powered Python shell. However, I'm not sure how to do the same thing with nixpacks. Could someone please point me in the right direction?
Regards,
Francisco
Beta Was this translation helpful? Give feedback.
All reactions