DrTRD DrTRD - 1 year ago 56
Python Question

Decrementing Python

I've got a package that depends on an earlier version of Python -- I'm running 3.5.1, but the package only supports up through Python 3.4. I'd like to clone my current environment, decrement my Python version to 3.4, and then update all other packages to the latest version compatible with Python 3.4. How do I do that?

When I clone my root environment and attempt:

conda install python=3.4

I receive the message:

Error: 'conda' can only be installed into the root directory.

I'm working on Windows currently. Any ideas would be much appreciated.

Answer Source

Create a new environment:

conda create -n py34  python=3.4

activate it:

source activate py34

(no source on Windows)

Install all your packages:

(py34) conda install package1 package2

This keeps your original Python 3.5 install and you can activate Python 3.4 whenever you need it. Deactivate with deactivate.

You can export names and versions of all packages you have currently installed with:

conda list --export > list_of_my_packages

Use this file to create your new py34 environment:

conda create --file list_of_my_packages -n py34  python=3.4

You might get a warning about packages missing form the current channels. Either add more channels or edit this list, opening the file in an editor.

Finally, you can update all packages to the latest version with:

conda update all