Why import torchvision.models error?

I have just written one line code:

import torchvision.models as models

but I got an error, I would appreciate it if you could help me!

the error info:

Traceback (most recent call last):
File “0_0.py”, line 15, in
import torchvision.models as models
File “/usr/local/lib/python2.7/dist-packages/torchvision/init.py”, line 2, in
from torchvision import datasets
File “/usr/local/lib/python2.7/dist-packages/torchvision/datasets/init.py”, line 1, in
from .lsun import LSUN, LSUNClass
File “/usr/local/lib/python2.7/dist-packages/torchvision/datasets/lsun.py”, line 5, in
import six
ImportError: No module named six

oh I think I should install the six first…

Got the same error in my conda venv. I tried to reinstall and upgrade everything, but that did’nt fix the issue. I’m using Windows, Python 3.6.6, 64 bit.

six can’t be imported via anaconda prompt, but if I try
pip install six
the output is:
Requirement already satisfied: six in d:\programme\anaconda\lib\site-packages (1.11.0)

Hi, I fix my problem by installing the module named ‘six’.

For your problem,
I’m not sure but I think there may be 2 or more different python environments.
Just use the command ‘pip install six’ is connected to your default python environment in your computer,
In that case, you should activate the exact environment using by your project first and then install the six module in it.

Sry for I can’t give you more advice because I’m also a new hand :slight_smile:


Hm I’m aware of activating the venv first

Ok I don’t know why pip spits out that six is already installed. As I said I upgraded this via pip install six --upgrade

Anyway, this did the job for me:
conda install -c anaconda six