Python Forum
scipy looks like it installs, but does not - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: General (https://python-forum.io/forum-1.html)
+--- Forum: News and Discussions (https://python-forum.io/forum-31.html)
+--- Thread: scipy looks like it installs, but does not (/thread-41359.html)



scipy looks like it installs, but does not - Skaperen - Jan-01-2024

Output:
lt1a/root/2 /root 22# time logcmd -s install-scipy pip install --upgrade --cache-dir /var/lib/pip-cache scipy Script started, file is ./20231231-231415-980183-install-scipy.log 23:14:15 [980188] EXECUTING: 'pip' 'install' '--upgrade' '--cache-dir' '/var/lib/pip-cache' 'scipy' Requirement already satisfied: scipy in /usr/local/lib/python3.8/dist-packages (1.10.1) Requirement already satisfied: numpy<1.27.0,>=1.19.5 in /usr/local/lib/python3.8/dist-packages (from scipy) (1.24.4) WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv [[ 0m1s real 1.388 - user 0.727 - sys 0.069 - 57.34% ]] 23:14:16 [980188] FINISHED - status = 0 Script done, file is ./20231231-231415-980183-install-scipy.log [[ 0m2s real 2.423 - user 0.738 - sys 0.070 - 33.36% ]] lt1a/root/2 /root 23# py3 Python 3.8.10 (default, Nov 22 2023, 10:22:35) [GCC 9.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import scipy Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'scipy' >>> lt1a/root/2 /root 24#
any ideas what is goofed?


RE: scipy looks like it installs, but does not - Gribouillis - Jan-01-2024

Which interpreter is executed by py3? Is it the same interpreter as the pip command?


RE: scipy looks like it installs, but does not - Skaperen - Jan-02-2024

(Jan-01-2024, 07:02 AM)Gribouillis Wrote: Which interpreter is executed by py3? Is it the same interpreter as the pip command?
Output:
lt1a/forums/3 /home/forums 4> which py3 /usr/host/bin/py3 lt1a/forums/3 /home/forums 5> ls -il /usr/host/bin/py3 144853 lrwxrwxrwx 1 root root 22 Dec 7 18:45 /usr/host/bin/py3 -> ../../../bin/python3.8 lt1a/forums/3 /home/forums 6> ls -il ../../../bin/python3.8 2278 -rwxr-xr-x 1 root root 5465880 Nov 22 05:22 ../../../bin/python3.8 lt1a/forums/3 /home/forums 7> ls -il /usr/bin/python3.8 2278 -rwxr-xr-x 1 root root 5465880 Nov 22 05:22 /usr/bin/python3.8 lt1a/forums/3 /home/forums 8> ls -il /bin/python3.8 2278 -rwxr-xr-x 1 root root 5465880 Nov 22 05:22 /bin/python3.8 lt1a/forums/3 /home/forums 9> /bin/python3.8 Python 3.8.10 (default, Nov 22 2023, 10:22:35) [GCC 9.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> lt1a/forums/3 /home/forums 10> /usr/bin/python3.8 Python 3.8.10 (default, Nov 22 2023, 10:22:35) [GCC 9.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> lt1a/forums/3 /home/forums 11>
Ubuntu 20.4 replicates /bin and /usr/bin so either path to python3 works. i am doing this as root to ensure that everything is available system-wide for all users.


RE: scipy looks like it installs, but does not - Gribouillis - Jan-02-2024

(Jan-01-2024, 04:24 AM)Skaperen Wrote: Requirement already satisfied: scipy in /usr/local/lib/python3.8/dist-packages (1.10.1)
This line indicates the directory containing the scipy package. Check that this directory is in sys.path. Try
Output:
py3 -c "import sys; print(sys.path)"



RE: scipy looks like it installs, but does not - Skaperen - Jan-14-2024

Output:
lt1a/forums/3 /home/forums 4> py3 -c "import sys; print(sys.path)" ['', '/home/forums', '/home/forums/py', '/home/forums/py/lib', '/home/forums/lib', '/usr/host/lib/py', '/usr/host/lib', '/usr/local/lib/py', '/usr/local/lib', '/lib/python38.zip', '/lib/python3.8', '/lib/python3.8/lib-dynload', '/lib/python3/dist-packages'] lt1a/forums/3 /home/forums 5>



RE: scipy looks like it installs, but does not - Gribouillis - Jan-14-2024

We see that /usr/local/lib/python3.8/dist-packages is not in sys.path, which is why Python doesn't find scipy. I don't know why it is so but you are a specialist of strange configurations. Get the path to sitecustomize.py by running
Output:
py3 -c 'import sitecustomize; print(sitecustomize)'
In sitecustomize.py you can add the line
import sys
sys.path.append('/usr/local/lib/python3.8/dist-packages')
Now scipy should be importable.


RE: scipy looks like it installs, but does not - Skaperen - Jan-22-2024

(Jan-14-2024, 08:23 AM)Gribouillis Wrote: In sitecustomize.py you can add the line
i do not find file sitecustomize.py in my /usr tree.
Output:
Python 3.8.10 (default, Nov 22 2023, 10:22:35) [GCC 9.4.0] on linux
i did find /usr/lib/python2.7/sitecustomize.pyc but i don't believe that gets involved.