Hi, I’m encountering an error that module 'torchvision' has no attribute 'datasets' when I’m trying to run pytorch-cifar today. But when I run it a few days ago, it worked.
I don’t know what is wrong with my pytorch. I tried to reinstall the torchvision and the running still ends up in failure. The version of pytorch on my computer is 0.3.1.
@smth Thanks for your attention, smth. I installed multi versions of Pytorch by Annaconda and I strayed into a bad env where pytorch installation is uncompleted. Now I move to the correct env and no error occurs. Thanks again.
Traceback (most recent call last):
File "tools/train_net.py", line 17, in <module>
from core.data import make_data_loader
File "./core/data/__init__.py", line 2, in <module>
from .build import make_data_loader
File "./core/data/build.py", line 10, in <module>
from core.data import Datasets as D
File "./core/data/Datasets/__init__.py", line 2, in <module>
from .coco import COCODataset
File "./core/data/Datasets/coco.py", line 29, in <module>
class COCODataset(torchvision.datasets.CocoDetection):
AttributeError: module 'torchvision' has no attribute 'datasets'
(embedmask) fei@yagi15:~/code/IDEstimation$ python
Python 3.7.6 (default, Jan 8 2020, 19:59:22)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> print(torch.__version__)
1.4.0
>>> import torchvision
>>> print(torchvision.__version__)
0.5.0
>>>
Hi, I got the same problem and don’t know how to solve it. I confirmed that my torch and torchvision packages have been installed competely. @smth
Could you create a new environment and install PyTorch as well as torchvision again?
Something seems to be broken in your installation, when you are able to import torchvision, but not torchvision.datasets.
Dear @ptrblck I followed your instruction and create a new envs to test my code, unfortunately, the mentioned weird problem still exists. The same error for torchvision.transforms