Adding third party modules to Python

My Anaconda Windows installation did not have an installable package for “torchvision” and “opencv’.  Typically, out of sheer laziness I would just use the Anaconda GUI, switch to my pyTorch environment and search for the missing pieces.  But they were completely missing.

So I had no choice but to launch the Windows “conda” cli that gets installed whenever you do a Windows Anaconda installation. There I switched to my pyTorch conda environment which I had initially created as “Anaconda3”.  I could have called it “pyTorch”, but that would have been a rational choice and where is the fun in that?

I switched to my pyTorch environment using the “activate Anaconda3” command.

Happily I typed at the prompt:

conda install torchvision

And…nothing.  There was no torchvision package for windows.  In fact, all the torchvision packages available were for either Linux or MacOs  It was still not time for the gnashing of teeth, so as a last resort I tried:

pip install torchvision

And that worked. Fortunately, installing the most stable version of OpenCV wasn’t as traumatic:

conda install opencv

…worked without a pip. While in the conda prompt environment just type, python and at the python prompt…

import torchvision

import cv2

to check that things are ok.


There are two places to look for Python modules to add to your Anaconda environment:

  •   -> use conda command line to install
  •          -> use pip to install

If you can’t find what you are looking for in either one, then it’s time for the gnashing of teeth.


As a “best practices” sort of thing, I am no longer using the Anaconda Navigator GUI for package installations.  Instead, I first look for the packages in and then install the latest version with the conda cli. The versions listed on the Anaconda Navigator GUI may not be the latest one and it might not even warn you.

Leave a Reply

Your email address will not be published. Required fields are marked *