5

I already installed Python 3.9.2 as it supports ARM64 as recommended in Python.org

I created a virtual environment after that using python3 -m venv py39

Now I need to have another environment but with Python 3.8.8 as Tensorflow is supporting 3.8 only. How could I create another virtual environment with Python 3.8 while maintaining the other 3.9 env. In case of asking me to use conda, Does conda support Mac M1 ARM64 as it doesn't according to my search

I found same question asked many times but for windows and answers are very old like: Use different Python version with virtualenv 11 Years ago

Maged
  • 818
  • 1
  • 8
  • 17
  • From the docs it appears that full official support of Apple M1 started with 3.9.1: As of 3.9.1, Python now fully supports building and running on macOS 11.0 (Big Sur) and on Apple Silicon Macs (based on the ARM64 architecture). (*What's New*) – BoarGules May 20 '21 at 11:59

4 Answers4

3

Is there a reason you're tied to conda?

The reason I ask is there are easier routes to getting isolated Python environments, which might have moved a bit faster on the needed M1 migrations.

I recommend at least checking out

If you are tied to conda, it seems like there are some related posts: How can I run Python 3.9.1 natively on M1 Mac?

Justin Rice
  • 1,111
  • 12
  • 13
1

i baught M1 and started struggling with packages and setup M1 is really fast but i was having too much issues one of the issue is python environments on intel it was very easy finally i over come to the problem with python using miniforge

here are the steps i followed

brew install miniforge

Then init zsh shell using conda

conda init zsh 

and finally instantiate required python env below command will install all the dependencies

conda create -n .venv python=3.7.6

then lastly activate the environment

conda activate .venv
Mansur Ul Hasan
  • 2,898
  • 27
  • 24
1

I was having issues after following above solutions but it didn't work for me

bash-5.1$ conda activate .venv

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run

    $ conda init <SHELL_NAME>

Currently supported shells are:
  - bash
  - fish
  - tcsh
  - xonsh
  - zsh
  - powershell

See 'conda init --help' for more information and options.

IMPORTANT: You may need to close and restart your shell after running 'conda init'.

i have zsh so i switched to bash shell and everything was started working for me

0

I found out, with pyenv and miniforge it is no problem to work with conda, even with older versions like 3.8, which seemed to be a constrained on M1. With

brew update
brew install pyenv
pyenv install miniforge3-4.10
pyenv global miniforge3-4.10
conda create -n new_env python=3.8
conda activate new_env
conda install poetry
poetry new project
cd project
poetry add open3d

With this you can install any package and can use conda in every way you want, as far as I tested it. Instead of peotry you can of course use conda install {package} in the usual way.

lewis206
  • 13
  • 4
  • But we cannot install python2 (`python=2.7` for example). Did you try it? – Anh-Thi DINH May 17 '21 at 21:01
  • Yes, that works for me. You need to say `python=2`. Then it installs `2.7.15`. Would be nice, if you could reproduce it. – lewis206 May 19 '21 at 06:37
  • I couldn't, it says `PackagesNotFoundError: The following packages are not available from current channels: python=2`. :( – Anh-Thi DINH May 19 '21 at 10:14
  • Btw, I think there are some differences between your "miniforge" and mine. I installed it directly from [the official github page](https://github.com/conda-forge/miniforge), not via `pyenv`. I've just installed miniforge via `pyenv` but my "old" one is still there. Can you tell me how to use pyenv's miniforge to crearte a new conda env? – Anh-Thi DINH May 19 '21 at 10:19
  • Sure, I will update the post, to make it a bit more clear. But I am not sure how it works in the background. Could be, that it is not running as fast as other versions. But at least it works. – lewis206 May 20 '21 at 11:40