Create conda environment with platform-specific python version

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.

More context

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.

Read more here: Source link