I lost nearly all my modules installing 3.7
Terry Reedy
tjreedy at udel.edu
Thu Jun 28 20:52:25 EDT 2018
On 6/28/2018 6:45 PM, Elliott Roper wrote:
> On 28 Jun 2018, Terry Reedy wrote
>> 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.
>
> I can't see the pip commands you mention for writing a file from 3.6
and
> reading it back for 3.7
> Is it pip freeze -r <file> followed by pip install -r<file>? If so, what is
> meant by 'the given requirements file' in the freeze options?
'pip freeze' sends the requirements list to stdout in alphabetical
order. You redirect or copy-paste to a file. I have not done this, but
apparently -r <file> uses file as a template for selecting and ordering
the requirements. I presume pip will ignore any versions in the
template and list the actual installed versions.
I believe you got the install right.
> When I look inside site-packages in ~/Library (see below) I see many packages
> that pip lists, but by no means all. F'instance numpy and scipy. They can be
> found in /Library's site-packages however.
>>
>>
>>> 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.
>
> Aha! That is most helpful
>
> Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24)
> [Clang 6.0 (clang-600.0.57)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> (python prompt)>>> import sys
> .>>>sys.path
> ['', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python37.zip', #
> no such file
sys.path included directories that might be present. In this case, a
zipped version of the stdlib.
> '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7', # 207
> items, none matching pip intstallable modules
> '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-
> dynload',# 69 items, none matching pip installable modules
> '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-
> packages'] # just pip and setuptools are in here
> .>>> ^D
site-packages is the default for 3rd parth packages. It can have .pth
files that extend the directory to effectively include other directories.
> EiPro:~ elliott$ python3.6
> Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 05:52:31)
> [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> .>>> import sys
> (python prompt)>>> sys.path
> ['', '/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip', #
> no such file
> '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6', # 207
> items, none matching pip intstallable modules
> '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-
> dynload',# 65 items, none matching pip installable modules
> '/Users/elliott/Library/Python/3.6/lib/python/site-packages', # 103 items
> some matching items that appear in pip3.6 list
> '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-
> packages'] # numpy, scipy, pandas etc. are here. These might have been
> modules I needed sudo -H to update
> .>>>
>
> What I did not make clear that my 'elliott' user is not an Administrator. If
> I log into my admin account (which I hardly ever do), it thinks my Python3 is
> 3.7, list there also shows the hugely abbreviated collection of modules
> namely pip and setuptools. pip list shows a list of modules so old as to be
> unrecognisable.
I expect the system install to be 2.7, python3 link to 3.7 either
because that is the most recent 3x installed or the most recent version.
> It looks like I have a tangled mess. Is there a way of getting rid of all the
> pythons except Apple's museum piece and starting again? It is a hobby for me.
> I have no need for backward compatibility. I think if I could install 3.7
> site wide from my non-admin account, I would be happiest. The standard
> install pretty much worked up to 3.6
> pip
> Would it be safe to delete everything on python's sys.path and re-install
> from the download .pkg
I suspect you can get rid of 3.6, 3.5, 3.4, but I am not a Mac user. I
hope someone who is answers.
--
Terry Jan Reedy
More information about the Python-list
mailing list