[Distutils] Transfering modules

Chris Jerdonek chris.jerdonek at gmail.com
Sat Aug 19 00:03:18 EDT 2017


On Fri, Aug 18, 2017 at 1:03 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On 18 August 2017 at 12:17, Ian Hartley <iahartle at ucsd.edu> wrote:
>> 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).

I would just like to point out that the normal workflow for pyenv [1],
which seems very popular (and which I use), is to do parallel installs
rather than upgrades. The OP didn't actually say "upgrade," so it's
possible they're using a tool like pyenv. I believe the OP's original
questions would also apply to users of pyenv -- i.e. having a simple
way to "copy" installed dependencies from one pyenv install to a new
one.

In practice, I myself don't have this issue since I usually install
from requirements.txt, as you suggested, Nick.

--Chris

[1] https://github.com/pyenv/pyenv



>
> 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":
> https://conda.io/docs/using/envs.html#create-environment-file-by-hand)
>
> Cheers,
> Nick.
>
> --
> Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
> _______________________________________________
> Distutils-SIG maillist  -  Distutils-SIG at python.org
> https://mail.python.org/mailman/listinfo/distutils-sig


More information about the Distutils-SIG mailing list