Reputation: 469
I am running python3.9 on ubuntu 18.04. I already went ahead and rand the command sudo apt-get install python-scipy
and got the message:
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-scipy is already the newest version (0.19.1-2ubuntu1).
The following packages were automatically installed and are no longer required:
linux-hwe-5.4-headers-5.4.0-42 linux-hwe-5.4-headers-5.4.0-53
linux-hwe-5.4-headers-5.4.0-56 linux-hwe-5.4-headers-5.4.0-58
linux-hwe-5.4-headers-5.4.0-59 linux-hwe-5.4-headers-5.4.0-60
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 12 not upgraded.
Yet, when I try to run my python3.9 code which uses from scipy import integrate
, I get the error:
ModuleNotFoundError: No module named 'scipy'
I already read this post and tried uninstalling and installing scipy using
sudo apt-get install python3-scipy
But this did not work. Any suggestions?
Edit 1: I tried sudo pip3 install scipy
which produced the message:
The directory '/home/nick/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/nick/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Yet, when I tried to run the code again, I still get the same ImportError
.
Upvotes: 6
Views: 14012
Reputation: 28
Try
pip3 install scipy
,
if that returns an ERRNO 13: access denied
then try pip3 install scipy --user
Upvotes: 0
Reputation: 765
Maybe try
python3.9 -m pip install scipy --user
which would use pip of python3.9 to install the package to a place without sudo privilege
Upvotes: 7