23
Setting up Python Development Environment on Apple M1
I recently moved to Apple M1. It was an awesome experience for my NodeJs, Java projects.
But a poor experience for python projects. I could not even install numpy properly.
I did not want to use Rosetta much. So, I had to install numpy using source. But then pandas did not install, then scipy has problems… Tired.
If you’ve reached here, you would have got a lot of articles where people tried to install by source or other ways. In this story, I am jumping straight to the solution which worked for me using miniforge
Install miniforge
brew install miniforge
Setup conda with your shell(zsh or bash, whatever you use)
conda init zsh
Create your venv using desired python version
conda create -n .venv python=3.9.2
This will create a virtual env for python 3.9.2. All the packages you install will go inside this environment.
Now you can just go your python code directory and activate virtual env.
cd /path/to/my/python/source/dir
conda activate .venv
Install the packages. Few packages I was not able to find in conda so if I install using pip that worked fine.
conda install numpy
conda install pandas
Or using Pip
pip install celery
That’s it, now you can simply run your app.
Hope this helps you. :)
You can follow me on Twitter — @kravigupta . You can also connect on LinkedIn — kravigupta.
Cheers!!
23