1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Build env for Tensor-flow and ML on Mac(Apple Silicon)

Last updated at Posted at 2024-08-31

agenda

  • homebrew
  • pyenv
  • metal as GPU driver
  • tensor-flow

homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

pyenv

brew install xz
brew install pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(pyenv init -)"' >> ~/.zshrc

source ~/.zshrc

pyenv install --list
pyenv install 3.10.14
pyenv global 3.10.14

miniforge

brew install miniforge

condaの環境設定について、スクラップ&ビルドをしやすくするために名前をつけておく

conda env list
# baseのみの想定

conda create -n py310
conda activate py310

※activateに失敗する場合はターミナルの確実な再起動(Dock上のアイコンにて終了を選択する)または、PCの再起動をする

なお、作った環境以外を使いたい場合などはdeactivateする

conda deactivate

tensorflow

conda install -c apple tensorflow-deps
pip install tensorflow-macos
pip install tensorflow-metal

check

import tensorflow as tf
print(tf.__version__)

transformer

conda install -c huggingface transformers

ML

conda install -c conda-forge scikit-learn
conda install -c conda-forge pandas
conda install -c conda-forge jupyterlab notebook
conda install -c pytorch torchvision
conda install -c conda-forge matplotlib
conda install -c conda-forge polars
conda install -c scitools cartopy
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?