[Tutor] Can't use packages in newly installed python 3.11.3

Mats Wichmann mats at wichmann.us
Tue Apr 11 14:17:47 EDT 2023


On 4/11/23 12:02, Dennis Lee Bieber wrote:
> On Tue, 11 Apr 2023 18:15:36 +0200, Torbjörn Svensson Diaz
> <torbjorn.svensson.diaz at gmail.com> declaimed the following:
> 
>>
>> 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!
> 
> 	Numpy and Scipy (and pretty much anything one installs with pip) are
> 3rd-party packages, handled by other developers. As such, they may not be
> compatible with newer releases of Python -- or won't be compatible until
> some months later.
> 
> 	FYI: my Python 3.10 install uses numpy 1.24.2, and scipy 1.10.1 -- the
> versions you have installed are quite old.
> 
> 	I had tried installing Python 3.11 a few weeks ago, but pip was unable
> to install numpy for that version. Numpy github page implies that 1.24.2
> supports Python 3.8 to 3.11; it appears to have been released Feb 5 -- but
> (I'm on Windows) pip binaries may not have been available -- don't know
> about your OS; it may build from source files. I also don't know where
> Linux would store the packages. Windows stores them in a subdirectory of
> the installed Python version; as a result, different Python installs have
> their own packages and you'd have to run pip install using the pip from the
> new Python version to add the compatible packages.

You can always ask Python.  A given Python's sys.path has where it will 
search. And pip can tell you where a package lives. For example, on a 
current Fedora system:

$ python3 -m pip show numpy
Name: numpy
Version: 1.22.0
Summary: NumPy is the fundamental package for array computing with Python.
Home-page: https://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email:
License: BSD
Location: /usr/lib64/python3.11/site-packages

That's quite typical (might be lib instead of lib64) for a system install.

A self-built install is probably (although it's a configure-time 
parameter) in a similar path, but starting with /usr/local instead of /usr

As far as what's ready on PyPI to install via pip, there's pypi itself, 
and there's a less official "Python Readiness" page:

https://pyreadiness.org/3.11/





More information about the Tutor mailing list