I have installed torch and torchvision via Pipenv using wheels provided on the website. Here's Pipfile:
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
pylint = "*"
[packages]
numpy = "*"
pillow = "*"
torch-win = {file = "https://download.pytorch.org/whl/cu101/torch-1.4.0-cp37-cp37m-win_amd64.whl#egg=torch-win", sys_platform = "== 'win32'"}
torchvision-win = {file = "https://download.pytorch.org/whl/cu101/torchvision-0.5.0-cp37-cp37m-win_amd64.whl#egg=torchvision-win", sys_platform = "== 'win32'"}
[requires]
python_version = "3.7"
When I try to import torchvision, I get an error: ModuleNotFoundError: No module named six. It successfully imports the module after adding six = "*" in the Pipfile and installing everything again.
Steps to reproduce the behavior:
Pipfile from above and run pipenv installimport torchvision Stack trace:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\<USER>\Desktop\<PROJECT>\.venv\lib\site-packages\torchvision\__init__.py", line 4, in <module>
from torchvision import datasets
File "C:\Users\<USER>\Desktop\<PROJECT>\.venv\lib\site-packages\torchvision\datasets\__init__.py", line 1, in <module>
from .lsun import LSUN, LSUNClass
File "C:\Users\<USER>\Desktop\<PROJECT>\.venv\lib\site-packages\torchvision\datasets\lsun.py", line 5, in <module>
import six
ModuleNotFoundError: No module named 'six'
Successful import of torchvision.
PyTorch version: 1.4.0
Is debug build: No
CUDA used to build PyTorch: 10.1
OS: Microsoft Windows 10 Enterprise
GCC version: Could not collect
CMake version: Could not collect
Python version: 3.7
Is CUDA available: Yes
CUDA runtime version: 10.1.105
GPU models and configuration: Could not collect
Nvidia driver version: Could not collect
cuDNN version: Could not collect
Versions of relevant libraries:
[pip3] numpy==1.18.2
[pip3] torch==1.4.0
[pip3] torchvision==0.5.0
[conda] Could not collect
conda, pip, source): Pipenv from wheel (see PipfileThanks for the bugreport!
This seems to be an issue in Windows. @peterjc123 could you have a look? Maybe now that we are Python3-only we should remove all instances of six in the codebase for simplicity?
EDIT: created an issue to remove six dependency in https://github.com/pytorch/vision/issues/2015
Sorry, I've never tried this before. But I agree with @fmassa that we could remove the dependency six since only python 3 packages are available for Windows.
@peterjc123 I think a quick fix for now is just to add six as a dependency for the windows packages? IIRC we have those as dependency for the Linux / OSX
Okay, no problem.
@fmassa Looks like six is already added as a requirement during pip install. https://github.com/pytorch/vision/blame/master/setup.py#L72
Yeah, that's true.
I don't know precisely why this is happening with Pipenv, I think it should work.
Anyway, we will be soon removing six as a dependency, and the fix for now is just to install six as well, so I'd say this will be transitively fixed soon
Fixed via #2015.
Most helpful comment
Sorry, I've never tried this before. But I agree with @fmassa that we could remove the dependency
sixsince only python 3 packages are available for Windows.