Problem deinstalling and installing properly Pytorch

Hi there,
quite new to machine learning and a junior in coding (in whole different sphere up until now) so sorry for the dumb question.

Trying to run Peter Baylies generator as well as the StyleGan2-ADA-pytorch version on an Ubuntu 18.04. I use both Conda and Pip to install the required dependencies however I’ve had particular problem with Installing/Deinstalling Pytorch with torchvision.

I had problems importing torch.nn whilst having torch v 1.7.x and the respective torchvision. I ran “conda list torch” and it said there is no such module installed.

Then tried to deinstall in the Conda environment (despite it saying there is no such module) using both:
-conda remove torch torchvision
-pip deinstall torch torchvision


Now “conda list torch” gave me version 1.7.x and the torchfile version

Ran the same commands again and now it gives 1.11.0 and torchfile version
under Build it says pypi_0 and py_0 for torch and torchfile respectively and
pypi and conda-forge for the “Channel” for each one respectively.

I was thinking of manually deleting everything I see related to torch within the environment’s packages folder but am afraid to do so without a clear understanding if this might mess up other dependencies.

I don’t want to start over from scratch. My questions are:

  1. How should I proceed to purge and reinstall Torch for my conda evironment ( as I know setting up path manually is a necessity any such advice would be greatly appreciated)
  2. Is there a specific torch version which is a minimum requirement in order to have the nn package? I am currently with Cuda 11.4 with cudnn 8.2.1. …
    The original file has Torch set for install at torch==1.7.1 torchvision==0.8.2

Thanks in advance

Setting manual paths should not be necessary and I’m unsure which paths you would like to set where.

  1. Rerun pip uninstall torch -y and conda uninstall pytorch -y a few times (same for torchvison) until both claim these packages cannot be found anymore. Afterwards reinstall the libs again. I would also be careful about installing packages in the base environment as I’ve had issues in the past where they were interacting with packages in other conda environments (I wasn’t able to narrow down why this was happening).

  2. No, I think torch.nn was shipped in one of the very early relases already, so probably anything after some internal alpha releases should have this module.