Skip to content

Instantly share code, notes, and snippets.

@zepadovani
Last active June 15, 2023 18:31
Show Gist options
  • Save zepadovani/5624207ccb714ad102282329ff3368cb to your computer and use it in GitHub Desktop.
Save zepadovani/5624207ccb714ad102282329ff3368cb to your computer and use it in GitHub Desktop.
Manjaro + Tensorflow 2.12 + miniconda + GPU

1. install miniconda (use script from site instead of AUR)

2.1 - Create environmente:

conda create -n mlconda_3.10.11 python==3.10.11

2.2 - Activate:

conda activate mlconda_3.10.11

2.3 - Check if NVIDIA driver is installed

nvidia-smi
  1. Install CUDA e cuDNN:
conda install -c conda-forge cudatoolkit=11.8.0
pip install nvidia-cudnn-cu11==8.6.0.163

(for future versions of TensorFlow and Python, check the specific versions of CUDA and cuDNN here: https://www.tensorflow.org/install/source)

  1. Add the paths of CUDA and cuDNN to the miniconda environments:
mkdir -p $CONDA_PREFIX/etc/conda/activate.d
echo 'CUDNN_PATH=$(dirname $(python -c "import nvidia.cudnn;print(nvidia.cudnn.__file__)"))' >> $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/:$CUDNN_PATH/lib' >> $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh
  1. Install pip packages (tensorflow and whatever you will need):
pip install tensorflow=2.12.0
  1. IMPORTANT! Symlink cuda! Cuda is installed in /opt/cuda, but tensorflow is lookin for it at /usr/local/cuda. So we will symlink the real path to the expected one:
sudo ln -s /opt/cuda /usr/local/cuda  
@zepadovani
Copy link
Author

(alternatively, use a docker image... in pyenv it seems to be a hell to configure everything)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment