0

One aim behind conda environments is to rebuild/reinstall an old version of a tool/package for testing, comparing outputs, or most importantly for reproducibility purposes. Whenever I create an environment with an old version of python (say python3.6, python2.7, ...), conda is unable to find them in its channels list.

For install, the below doesn't work, even when specific channels are used upon search

conda install -c conda-forge python=3.6.7

or

conda install -c tboyer python=3.6.8

How can we install an old version of python and/or packages with their dependencies (at the time)

klebsiella
  • 53
  • 2
  • You didn't mention you are on **osx-arm64**. Marked duplicate applies similarly to anything below Python 3.8. – merv Dec 07 '22 at 16:36

1 Answers1

0

Conda has guardrails to prevent users from changing Python versions (beyond patches) in-place in an existing environment. It can be forced, but it doesn't ever make sense to do this, because it entails changing almost every package build in the environment, so you might as well just make a new one.

Instead, use the conda create command to create a dedicated environment for your replication. E.g.,

conda create -n py367 -c conda-forge python=3.6.7

works fine for me. Even better practice is for one to keep a YAML record of how an environment was created and use that.

py367.yaml

name: py367
channels:
  - conda-forge
dependencies:
  - python=3.6.7

creating with

conda env create -f py367.yaml

Also, not sure why the tboyer channel is mentioned (maybe you know them), but generally one should not use random Anaconda Cloud user channels unless you trust the user.

merv
  • 67,214
  • 13
  • 180
  • 245
  • Sure, I am using a dedicated env for that and not trying to change the existing one. I tried your solution and got "PackagesNotFoundError: The following packages are not available from current channels: - python=3.6.7" My list of channels is: conda.anaconda.org/conda-forge/osx-arm64 conda.anaconda.org/conda-forge/noarch conda.anaconda.org/bioconda/osx-arm64 conda.anaconda.org/bioconda/noarch repo.anaconda.com/pkgs/main/osx-arm64 repo.anaconda.com/pkgs/main/noarch repo.anaconda.com/pkgs/r/osx-arm64 repo.anaconda.com/pkgs/r/noarch – klebsiella Dec 07 '22 at 08:45
  • Sorry, the `conda install` command implies making a change to an existing environment. But turns out it's a platform (**osx-arm64**) issue. – merv Dec 07 '22 at 16:37