[Tutor] Can't use packages in newly installed python 3.11.3
Mats Wichmann
mats at wichmann.us
Tue Apr 11 12:56:28 EDT 2023
On 4/11/23 10:15, Torbjörn Svensson Diaz wrote:
> Hello, dear tutors!
>
> I recently installed Python 3.11.3 from source from an xz-file
> downloaded from Python.org. I followed the instructions on
> https://ubuntuhandbook.org/index.php/2021/10/compile-install-python-3-10-ubuntu/ and were successful in installing it. However, when I try to import numpy and scipy the following message prints:
>
>
> ModuleNotFoundError: No module named 'numpy'
>
> I also have Python 3.10.6 installed and when I use that instead, I have
> no problems importing numpy and scipy. Also, according to pip3 I have
> numpy 1.21.5 and scipy 1.8.0 installed. (I ran "pip3 list".)
> What can i do to make my installed packages work in Python 3.11.3? Is it
> a flaw to have two python 3s installed at the same time? What am I to
> do? Please help me out!
No, it's fine. But you need to have the packages you need for a given
Python installation set up in that installation.
Let's say your newly built Python is accessible as python3.11. Do:
python3.11 -m pip list
If they're missing (as they certainly are, since you wouldn't be getting
"No module" messages otherwise), install them the same way:
python3.11 -m pip install numpy
If your Python went to a system location (e.g. /usr/local/bin, which is
common for Linux builds), install the numpy in your user account so you
don't have to use "sudo" for installs:
python3.11 -m pip install --user numpy
More information about the Tutor
mailing list