0

I opened my anaconda prompt(anaconda 3) and as usual, the (base) term appeared before every command I enter, which just simply means I was inside the base environment. So, I entered this line for installing pytorch ( the one in this link https://pytorch.org/get-started/locally/ )

conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c conda-forge

And that's all. When I open my jupyter notebook and I create a new notebook by clicking New -> Python3 , by clicking on the Kernel -> Change Kernel option, I don't see a "base" there, as I want my notebook to understand I want to use pytorch. So when I just enter

import pytorch

I get the ModuleNotFoundError. Now, as I searched different websites, this seemed to be all about activating the environment. More specifically, when I open the python.exe file that is in this directory C:\Users\MyName\anaconda3\ I see that it's written:

Warning: This Python interpreter is in a conda environment, but the environment has not been activated. Libraries may fail to load. To activate this environment please see https://conda.io/activation

But I tried entering this command both in my anaconda prompt and in my cmd,

conda activate base

but I got neither a successful message nor an error. Just nothing. and still, this pytorch doesn't appear in my Jupyter notebook and the python.exe file still says that the interpreter is in a conda environment that is not activated. I don't know how to fix this issue.

More notes about my problem:

  1. The operating system is Windows 10.

  2. I have not created a separate environment for installing pytorch. It's installed in the base environment.

  3. I have two different versions of python in my system. One is Python 3.9 which I guess is the one that my Jupyter notebook understands as Python3. ( When I click on New ) and the other version is Python 3.8. When I was installing anaconda, the installer told me it was going to install 3.8 version of python and so, my pytorch and other stuff are also installed by the 3.8 version.

  4. By entering conda --version in cmd, it shows 4.10.3 so the conda version is 4.10.3

  5. I have only set C:\Users\Myname\anaconda\condabin as an environment variable in my system. ( and also C:\Program Files\Python39\ which is for the 3.9 Python version. ) I guess I might add ( or change) some variables too but I don't know which ones.

  • I think this is similar to this question [here](https://stackoverflow.com/questions/47246350/conda-activate-not-working). See if the solutions there can help you. – NMme Aug 22 '21 at 08:41

0 Answers0