[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem loading numpy and other on a venv in a guix system
From: |
zimoun |
Subject: |
Re: Problem loading numpy and other on a venv in a guix system |
Date: |
Wed, 30 Nov 2022 13:37:43 +0100 |
Hi,
On Wed, 30 Nov 2022 at 09:47, Wojtek Kosior via <help-guix@gnu.org> wrote:
cd /tmp/
> guix shell python python-virtualenv coreutils
> virtualenv -p python3 somedirectory
> . ./somedirectory/bin/activate
> pip install numpy
python3 -c 'import numpy'
leads to,
--8<---------------cut here---------------start------------->8---
Traceback (most recent call last):
File "/tmp/somedirectory/lib/python3.9/site-packages/numpy/core/__init__.py",
line 23, in <module>
from . import multiarray
File
"/tmp/somedirectory/lib/python3.9/site-packages/numpy/core/multiarray.py", line
10, in <module>
from . import overrides
File
"/tmp/somedirectory/lib/python3.9/site-packages/numpy/core/overrides.py", line
6, in <module>
from numpy.core._multiarray_umath import (
ImportError: libz.so.1: 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 "<string>", line 1, in <module>
File "/tmp/somedirectory/lib/python3.9/site-packages/numpy/__init__.py", line
140, in <module>
from . import core
File "/tmp/somedirectory/lib/python3.9/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.9 from "/tmp/somedirectory/bin/python3"
* The NumPy version is: "1.23.5"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: libz.so.1: cannot open shared object file: No such file or
directory
--8<---------------cut here---------------end--------------->8---
That’s because the Numpy from pip is linked to system-wide library,
--8<---------------cut here---------------start------------->8---
$ ldd
somedirectory/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-x86_64-linux-gnu.so
linux-vdso.so.1 (0x00007ffde12e0000)
libopenblas64_p-r0-742d56dc.3.20.so =>
/tmp/somedirectory/lib/python3.9/site-packages/numpy/core/../../numpy.libs/libopenblas64_p-r0-742d56dc.3.20.so
(0x00007f6f1223d000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f6f120dd000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
(0x00007f6f120ba000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6f11ec8000)
/lib64/ld-linux-x86-64.so.2 (0x00007f6f1481a000)
libgfortran-040039e1.so.5.0.0 =>
/tmp/somedirectory/lib/python3.9/site-packages/numpy/core/../../numpy.libs/libgfortran-040039e1.so.5.0.0
(0x00007f6f11a3b000)
libquadmath-96973f99.so.0.0.0 =>
/tmp/somedirectory/lib/python3.9/site-packages/numpy/core/../../numpy.libs/libquadmath-96973f99.so.0.0.0
(0x00007f6f117fc000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f6f117e0000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1
(0x00007f6f117c5000)
--8<---------------cut here---------------end--------------->8---
and they are not found. Well, if you are running Guix on foreign
distro, you can manually fix the issue with this “missing” libz library
by setting LD_LIBRARY_PATH=/lib/x86_64-linux-gnu/. But you get another
issue:
--8<---------------cut here---------------start------------->8---
$ LD_LIBRARY_PATH=/lib/x86_64-linux-gnu/ python3 -c 'import numpy'
python3: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found
(required by
/gnu/store/lvip6h5pamjwmvnkwg60sjb63ph8698k-python-3.9.9/lib/libpython3.9.so.1.0)
python3: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found
(required by
/gnu/store/lvip6h5pamjwmvnkwg60sjb63ph8698k-python-3.9.9/lib/libpython3.9.so.1.0)
--8<---------------cut here---------------end--------------->8---
Well, I do not know if the Guix package “python-virtualenv” is working
in “guix shell”.
Cheers,
simon