Cuda for PyTorch and Cuda for Tensorflow

I want to install PyTorch and for that I visited PyTorch official website, and they give me a command to install it with Cuda:

pip3 install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio===0.9.0 -f https://download.pytorch.org/whl/torch_stable.html

The version of Cuda, they want me to install for PyTorch, is 11.1. But I already have Cuda install in my computer which is Cuda 11.2 (for TensorFlow 2.5.0). My question is if I install PyTorch with that command they gave me, will it remove Cuda 11.2 ? If it removed Cuda 11.2 and replace it with Cuda 11.1, then TensorFlow won't be able to run on GPU. Do I have to sacrifice TensorFlow in order to use PyTorch ? Is there any method to them keep both ?

Topic cuda pytorch tensorflow deep-learning machine-learning

Category Data Science


One way to sort out your issue is to create virtual environments. Below are two ways to set up virtual environments

  • pip virtual environment
  • conda virtual environment

I suggest to go for setting up anaconda (conda) virtual environment for different versions of Tensorflow, Pytorch, CUDA

Follow this guide, Guide to conda for tensorflow and pytorch

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.