Importerror: Cannot Import name ‘interpolationMode‘ from ’torchvision.transforms‘ stepping on the pit record

tags: small thing  pytorch  Deep learning

There is an error when running the Resone code.

ImportError: cannot import name ‘InterpolationMode’ from ‘torchvision.transforms’ (C:\ProgramData\Anaconda3\lib\site-packages\torchvision\transforms_init_.py)

But there is no relevant solution on the Internet.
So you can rule it yourself and record the following.
The error code is as follows:

from torchvision.transforms import Resize,InterpolationMode

Determine your own TORCHVISION, TOCH version.
use

import torchvision
print("Torchvision Version: ",torchvision.__version__)

import torch
print(torch.__version__)

The output is:

Torchvision Version:  0.8.1
1.7.0

Then find the latest official document and view the corresponding module
https://pytorch.org/vision/0.9/transforms.html

There is a module for searching.

When you return, check your corresponding version of the official document 0.8.1

No, so the version is too low.

Then build a new Conda environment to reinstall the TORCH and TORCHVISION.
The update of PyTorch and TORCHVISION, uninstallation and second installation (see this article is enough)
Refer to this

Intelligent Recommendation

ImportError: cannot import name 'connections' from 'haystack'

ImportError: cannot import name ‘connections’ from ‘haystack’ haystack and django-haystack, these two packages have conflicts. The online method just deletes the haystack, but ...

ImportError: cannot import name 'Bar' from 'pyecharts'

Recently been plagued by pyecharts from pyecharts import Bar Error message: Checked a lot of information, did not find the answer under the official github, and finally had to contact the author, and ...

ImportError: cannot import name 'Map' from 'pyecharts'

When using pyecharts draw a map, according to methods online, but the above error occurred No version is specified during installation, use the following command to install directly: You will successf...

ImportError: cannot import name 'BDeuScore' from 'pgmpy.estimators.BDeuScore'

Pgmpy package itself solve the problem The first step is to find __init__.py found references BDeuScore, as shown in the B solutionDeuScore replaced BdeuScore The second part, open BDeuScore, found th...

ImportError: cannot import name 'auto' from 'tqdm'

ImportError: cannot import name ‘auto’ from ‘tqdm’ Error phenomenon: import tensorflow_datasets as tfds, this line of code will report above. Cause of error: tqdm is not up-to-...

More Recommendation

ImportError cannot import name _imaging from PIL

This is the import problem of PIL,As shown below The solution is as follows: Update your pillow (or install the specified version), the command is as follows: pip install --upgrade pillow Note: Every ...

ImportError: cannot import name 'cross_validation' from 'sklearn'

When using sklearn (scikit-learn) import cross_validation, the error is reported as follows: ImportError: cannot import name 'cross_validation' from 'sklearn'  The original code is: the reason: s...

ImportError: cannot import name 'PILLOW_VERSION' from 'PIL'

When importing torchvision in the python environment, the following error occurred  ImportError: cannot import name 'PILLOW_VERSION' from 'PIL'  My system environment is as follows, surround...

ImportError: cannot import name 'six' from 'django.utils'

Solution: Check the path where the error occurred, what package has the error, and clear what package, use pip to upgrade the package to the latest version, basically solve it Because the newly upgrad...

ImportError: cannot import name 'urlopen' from 'urllib'

Python Natural Language Processing P88 Python 2.x and Python 3.x have different library locations amended to:...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top