Math zombie
Math zombie

Reputation: 59

conda does not install packages in environment

I installed anaconda on my windows and created a new environment abc. I activated abc environment using conda activate abc and then used the command conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch to install pytorch. But when I use conda list command after deactivating my environment, I can find all the pytorch packages there. Does this mean that the packages were installed in the base environemnt instead of abc? Why are same packages listed when I call conda list from the environment or from outside?

Why is C:\ProgramData\Anaconda3\envs empty? Isn't it supposed to contain abc environment? Also I cannot find torch packages in C:\ProgramData\Anaconda3\pkgs but they are present in C:\ProgramData\Anaconda3\Lib\site-packages. Why is that?

Upvotes: 1

Views: 4738

Answers (2)

FlyingTeller
FlyingTeller

Reputation: 20462

Why is C:\ProgramData\Anaconda3\envs empty?

The default location for environments on windows is not in the ProgramData folder, but under Users somewhere (cannot check right now), because the ProgramData folder needs admin privileges to write to by default. You can check easily by runnning this command:

conda info --envs

which prints a list of environments and their location

Also I cannot find torch packages in C:\ProgramData\Anaconda3\pkgs

That is not the location where python packages are installed to. It is only a sort of cache that anaconda uses for downloads. site-packages is where python packages are located

but they are present in C:\ProgramData\Anaconda3\Lib\site-packages. Why is that?

That, plus your description from above has me believe that you have probably installed torch also in the base environment. Check if you find torch in the site-packages for the abc environment.

To find out where that is, use the conda info --envs command from above

Alternatively, you can always run this command in your anaconda prompt to find out where torch is imported from:

python -c "import torch; print(torch)"

Try it from your base and also from your abc environment

Upvotes: 0

SCKU
SCKU

Reputation: 833

But when I use conda list command after deactivating my environment, I can find all the pytorch packages there. Does this mean that the packages were installed in the base environemnt instead of abc?

No, when you deactivating your env (e.g. abc) you go to base env. then conda list will show the pacakges in base env

Why is C:\ProgramData\Anaconda3\envs empty? Isn't it supposed to contain abc environment?

It's strange. you can use conda create -n test python=3 -y, then check whether the test env is in there.

Also I cannot find torch packages in C:\ProgramData\Anaconda3\pkgs but they are present in C:\ProgramData\Anaconda3\Lib\site-packages. Why is that?

becuase you install a python packages, it should be there (site-packages). but you should install packages within env, so try to solve the env problems first.

and, if you still have some install problems, beside read the doc, conda is easy to reinstall, just delete the mini/anaconda folder and reinstall using .exe/.msi etc again.

Upvotes: 1

Related Questions