I sifted through many similar questions but couldn't find an answer to my question. I am trying to create a conda environment not only with a specific Python version, but a specific platform too. The following command (and variations thereof) fails:
conda create -n test python=3.9.11-macos11
I am not sure how conda sources different Python versions, but the version above is available on Python.org, and I want that specific version. Alternatively it would be useful to know if environments can be created with local Python archives (e.g. .pkg
or .tgz
files on-disk but not "installed" on the system); I tried using python=file://path/to/python-3.9.11-macos11.pkg
and the FTP URL directly but to no avail.
I am on an M1 Mac and installed conda with Miniconda3-latest-MacOSX-arm64.sh
. The built-in Python version indicates the correct architecture:
$ python3 -c "import os; print(os.uname().machine)"
arm64
However Python versions installed via conda
do not:
$ conda create -n test python=3.9
$ conda activate test
$ python3 -c "import os; print(os.uname().machine)"
x86_64
FYI this is unrelated to setting SYSTEM_VERSION_COMPAT=0
(but to be sure I tried it and it doesn't help). Installing and using the Python version linked above does yield the expected result, hence my question.
It looks like the default channels for conda were not set correctly during the installation of Miniconda. Creating a file ~/.condarc
as below yields the expected behavior simply using python=3.9
.
Note that the first channel is osx-arm64
and not osx-64
, which corresponds to the channels listed here:
channels:
- main/osx-arm64
- main/noarch
- free/osx-64
- free/noarch
- r/osx-64
- r/noarch