Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vicente-gonzalez-ruiz/b62fe635d566de1ace432d3e40f724b3 to your computer and use it in GitHub Desktop.
Save vicente-gonzalez-ruiz/b62fe635d566de1ace432d3e40f724b3 to your computer and use it in GitHub Desktop.
1. You must be using the Nvidia kernel (`nvidia-smi` should show info). This basically implies that the kernel recognizes the GPU.
2. Follow the instructions provided at https://www.tensorflow.org/install/pip:
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -o Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
source ~/.bashrc
conda create --name tf python=3.9
conda activate tf
conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/
mkdir -p $CONDA_PREFIX/etc/conda/activate.d
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/' > $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh
pip install --upgrade pip
pip install tensorflow
3. Install CUDA:
sudo pacman -S cuda
export CUDA_DIR=/opt/cuda/
export XLA_FLAGS="--xla_gpu_cuda_data_dir=/opt/cuda"
4. Remove miniconda installer:
rm ~/Miniconda3-latest-Linux-x86_64.sh
5. (optional) Install jupyter:
pip install jupyter
0. Remember to activate the virtual environment!!
conda activate tf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment