I lost nearly all my modules installing 3.7

Terry Reedy tjreedy at udel.edu
Thu Jun 28 13:46:33 EDT 2018


On 6/28/2018 1:08 PM, Elliott Roper wrote:
> I have done something stupid. Don't know what.

It appears that you ran 3.7 expecting that modules installed for 3.6 
would magically be available for 3.7.

There is a pip command for making an editable file of installed 
packages.  Run that in 3.6, perhaps after updating everything.

There is another pip command for using that file to install everything 
listed.  Run that in 3.7.

> My $PATH looks like this
> XXXMac:~ elliott$ echo $PATH
> /Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Pyth
> on.framework/Versions/3.6/bin:/Library/Frameworks/Python.framework/Versions/3.
> 5/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Users/elliott/bin
> :/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/MacGPG2/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/git/bin
> 
> pip3 list or pip3.7 list gives me
> Package Version
> ---------- -------
> pip 10.0.1
> setuptools 39.0.1

This is the content of the 3.7 site-packages.

>>>> import numpy as np
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> ModuleNotFoundError: No module named 'numpy'
> So it is not lying to me!!!
> 
> pip list or pip3.6 list
> gives the whole caboodle I was expecting with a far smaller version number
> for setuptools.

The content of the 3.6 site-packages directory.

> My understanding is that the whole $PATH is searched in order to resolve an
> import, but it isn't.

The OS searches the OS path, which you listed above.
Python searches its sys.path, which it creates when started.
Run >>> import sys; sys.path to see the contents.
Unless macOS is more different than I think, you should see a 3.7 
site-packages when running 3.7.

> It might be relevant that I have had a bit of hassle installing module
> updates in the past. I would get an error saying the module version being
> replaced could not be deleted with permissions errors which I resolved with a
> bit of sudo -H.
> 
> Python 3.6 is still working properly when invoked explicitly
> 


-- 
Terry Jan Reedy




More information about the Python-list mailing list