imantha
imantha

Reputation: 3838

Anaconda channel for installing python 2.7

Since I have a mac with a M1 chip, I couldn't get Tensorflow installed using the regular version of anaconda, therefore, I installed conda using miniforge3-MacOSX-arm64.sh instead. However now I cannot create an environment with python 2.7.

conda create --name osmEnv python=2.7

I end up with the following error,

PackagesNotFoundError: The following packages are not available from current channels:

  - python=2.7

Current channels:

  - https://conda.anaconda.org/conda-forge/osx-arm64
  - https://conda.anaconda.org/conda-forge/noarch

 To search for alternate channels that may provide the conda package you're
 looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

As suggested in the comments for adding a new channel (orginal question), I also tried using the anaconda channel,

conda create --name osmEnv -c anaconda python=2.7

Which resulted in the same error. Any ideas how to get python 2.7 installed.

Upvotes: 16

Views: 15485

Answers (1)

merv
merv

Reputation: 77098

Not natively. Python 2.7 was sunsetted prior to release of the osx-arm64 platform, so there isn't any such build. One could try requesting such a build on the Conda Forge Python feedstock, but even if someone did that you'd still face the issue that most Python packages will also lack osx-arm64 builds for Python 2.7.

Emulate through Rosetta. Apple provides an x86_64 emulator, Rosetta 2, which will run x86_64 binaries, such as what would be installed with Conda environments using an osx-64 subdir. One can create environments with such a subdir setting with something like:

CONDA_SUBDIR=osx-64 conda create -n py27 python=2.7  # include other packages here

# ensure that future package installs in this env stick to 'osx-64'
conda activate py27
conda config --env --set subdir osx-64

Just be mindful to always have the environment activated when installing any additional packages. Rosetta should automatically kick in when launching python with such an environment activated.

Upvotes: 56

Related Questions