Posts: 4,653
Threads: 1,496
Joined: Sep 2016
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?
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,802
Threads: 77
Joined: Jan 2018
Jan-01-2024, 07:02 AM
(This post was last modified: Jan-01-2024, 07:02 AM by Gribouillis.)
Which interpreter is executed by py3 ? Is it the same interpreter as the pip command?
« We can solve any problem by introducing an extra level of indirection »
Posts: 4,653
Threads: 1,496
Joined: Sep 2016
(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.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,802
Threads: 77
Joined: Jan 2018
(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)"
« We can solve any problem by introducing an extra level of indirection »
Posts: 4,653
Threads: 1,496
Joined: Sep 2016
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>
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Posts: 4,802
Threads: 77
Joined: Jan 2018
Jan-14-2024, 08:23 AM
(This post was last modified: Jan-14-2024, 09:05 AM by Gribouillis.)
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.
« We can solve any problem by introducing an extra level of indirection »
Posts: 4,653
Threads: 1,496
Joined: Sep 2016
(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.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
|