This borrows from https://jordanthomasg.medium.com/python-development-on-macos-with-pyenv-2509c694a808.
Install Homebrew if necessary.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Before installing pyenv do the following:
brew install openssl readline sqlite3 xz zlib tcl-tk
For HuggingFace models (and maybe for other ML models and things to work correctly), install the following before python.
brew install git-lfs
brew install xz
Install pyenv.
brew install pyenv
Add pyenv initializer to shell startup script
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
Reload your profile.
source ~/.zshrc
List possible pyenv versions.
pyenv install -l
Install a particular version.
pyenv install 3.12.2
Set it to be the global python.
pyenv global 3.12.2
Install packages for Machine Learning
pip install --upgrade pip
pip install -U numpy
pip install -U pandas
pip install -U pyarrow
pip install -U matplotlib
pip install -U seaborn
pip install "altair[all]"
pip install -U scipy
pip install -U scikit-learn
pip install -U streamlit
pip install -U tqdm
pip install -U jupyterlab
pip install -U notebook
pip install -U ipywidgets
pip install -U torch
pip install -U torchvision
pip install -U pytorch-lightning
pip install -U lightning