Skip to content

Instantly share code, notes, and snippets.

@krokrob
Last active August 6, 2021 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krokrob/6172adbe04ec854e6c5bf4dc3e9f132d to your computer and use it in GitHub Desktop.
Save krokrob/6172adbe04ec854e6c5bf4dc3e9f132d to your computer and use it in GitHub Desktop.

Apple Silicon x TensorFlow

Config

Open a Terminal window.

Open your zsh config file:

code ~/.zshrc

Comment the line:

type -a pyenv > /dev/null && eval "$(pyenv init -)" && eval "$(pyenv virtualenv-init -)" && RPROMPT+='[🐍 $(pyenv_prompt_info)]'

💾 Save and close.


Open your zsh profile:

code ~/.zprofile

Check you have the following lines, copy/paste them if not:

# Setup the PATH for pyenv binaries and shims
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
type -a pyenv > /dev/null && eval "$(pyenv init --path)"

💾 Save and close.

Quit and restart your Terminal

Python 3.9.6

Install Python 3.9.6:

brew upgrade pyenv
pyenv install 3.9.6
pyenv global 3.9.6

Quit and restart your Terminal

Conda virtual environment

Install and initialize Conda:

brew install miniforge
conda init zsh

Create and activate a virtual environment:

conda create --name lewagon
echo 'conda activate lewagon && PROMPT=$(echo $PROMPT | sed "s/($CONDA_DEFAULT_ENV) //") && RPROMPT+="[🐍 $CONDA_DEFAULT_ENV]"' >> ~/.zshrc

Quit and restart your Terminal

TensorFlow

Install the bootcamp required packages:

pip install -U pip
pip install -U pytest pylint ipdb pyyaml nbresult autopep8 flake8 lxml requests bs4 "pandas<1.4" matplotlib "numpy<1.20" "scikit-learn<0.25" yapf jupyterlab seaborn plotly nbconvert xgboost statsmodels pandas-profiling dtale jupyter-resource-usage

Install TensorFlow:

conda install tensorflow

Checks

Check the requirements:

curl https://gist.githubusercontent.com/krokrob/f833e9fd734bc9a4cdd0c6a9cd0b545b/raw/322006a69f4745d658bfc1f3698d49a7624961c9/conda_check.sh > conda_check.sh && zsh conda_check.sh && rm conda_check.sh

Check the package loading:

curl https://gist.githubusercontent.com/krokrob/90e35dee7ed2b20852b099331510b369/raw/09178c49db6e7537eed68335a25fbb00c7ca1fd4/pip_check.py > pip_check.py && python pip_check.py && rm pip_check.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment