[Distutils] Transfering modules

Nick Coghlan ncoghlan at gmail.com
Fri Aug 18 04:03:37 EDT 2017

On 18 August 2017 at 12:17, Ian Hartley <iahartle at ucsd.edu> wrote:
> Hello,
> I have a question that I haven't been able to find online or in the python
> documentation.
> While trying to install a module I have encountered significant trouble,
> stalling my current experiment.
> I recently installed python 3.6.2, and I want to know how to transfer the
> numerous modules I have on 3.6.1 to the newest version, usable by an
> interpreter.

Without knowing more about your system (operating system, where you
installed Python from, how you're installing Python dependencies),
it's hard to say what might be going wrong, since most mechanisms for
upgrading Python will treat 3.6.2 as a direct replacement for 3.6.1,
and hence you shouldn't have to do anything at all to start using
Python 3.6.2 instead (since they're part of the same feature release
stream, they'll both use `3.6` to qualify the directories they access,
and hence should be able to see the same set of importable modules).

However, from your comments, it sounds like you managed to do a
parallel install instead, in which case the answers would be:

1. Don't do that, as you'll make life more difficult for yourself by
defeating the main point of offering in-place maintenance updates
2. If you really need to do it, *and* you're using a virtual
environment to manage your dependencies, then you can technically
change which Python an existing virtual environment is using by
fiddling with the symlinks (but I wouldn't recommend it)
3. If you're *not* using a virtual environment to manage your
dependencies, then running `python3 -m site` with each version will
tell you where their respective site-packages are, so you can copy all
the files from your 3.6.1 installation to your new 3.6.2 installation
(although again, I wouldn't really recommend it)

The ideal case would be having all your dependencies listed in a
requirements.txt file, so setting up a new virtual environment would
just be a matter of activating it and then running "pip install -r
requirements.txt". (Or, equivalently, define a conda environment file
and set up your experimental system with "conda env create":


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Distutils-SIG mailing list