Skip to content

Instantly share code, notes, and snippets.

@mjkvaak
Last active February 15, 2022 09:07
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 mjkvaak/ad0fea057d5a733dc76524825f21dee2 to your computer and use it in GitHub Desktop.
Save mjkvaak/ad0fea057d5a733dc76524825f21dee2 to your computer and use it in GitHub Desktop.
Installation of Tensorflow 2.X with GPU on Ubuntu 18.04/20.04 with conda and pip
# install nvidia-drivers: see gist.github.com/mjkvaak/5769ebdfbf6598b3fd0ece66b3c12a3c
# create conda environment
conda create --name myenv python=3.9 pip
conda activate myenv
# install cuda drivers
conda install -c anaconda cudatoolkit=11.3
conda install -c conda-forge cudnn
# install tensorflow; change the version according to your preference
VERSION=2.7
pip install --upgrade pip
pip install tensorflow==$VERSION keras==$VERSION
# confirm that installation was successfull
python -c "import tensorflow as tf; print(tf.__version__); print(tf.config.list_physical_devices('GPU'))"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment