This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Is there a way to install Python version 2 on Mac with M3 chips?

Hi, All,

Is there a way to install Python version 2 on Mac with M3 chips?

Thanks,

Xiao

ngs python

Did you try installing it through Conda?

Regards,

Nitin N.

Tried conda create --name env_py2 python=2.7.18 but failed with error below:

Collecting package metadata (current_repodata.json): done Solving environment: unsuccessful attempt using repodata from current_repodata.json, retrying with next repodata source. Collecting package metadata (repodata.json): done Solving environment: failed

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

  • python=2.7.18

Current channels:

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.

I think you need to enable the x86_64 packages and run them using Rosetta2. There are multiple options to to this. I have two different conda installations on my M1pro (one using arm64 one using x86_64) and I activate them separately to keep the package architectures separate. However, you can also allow x86_64 packages in arm64 environments: https://stackoverflow.com/questions/70205633/cannot-install-python-3-7-on-osx-arm64

1 answer

This is how I installed python2 on my MacOS Sonoma (14.5) with M3 chips.

  1. brew install pyenv
  2. pyenv install 2.7.18
  3. pyenv init, and follow instructions to append the following to ~/.zprofile and ~/.zshrc
  4. sudo nano ~/.zshrc, append the following:
    export PYENV_ROOT="$HOME/.pyenv" [[ -d $PYENV_ROOT/bin ]] && export
    PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init -)"
  1. To exit nano, press “control + x”, the press “y”.
  2. Refresh shell with exec "$SHELL"
  3. Check installed python versions with pyenv versions
  4. Choose a version to run locally or globally, for example, pyenv local 2.7.18 , pyenv global 3.12.4, or use system version with pyenv global system.

Log in to answer this question.