The error that I am getting when I use import torchvision
is this:
Error Message
"*Traceback (most recent call last):
File "/Users/gokulsrin/Desktop/torch_basics/data.py", line 4, in <module>
import torchvision
ModuleNotFoundError: No module named 'torchvision'*"
I don't know what to do. I have tried changing the version of python from the native one to the one downloaded through anaconda. I am using anaconda as a package manager and have installed torch vision through anaconda as well as through pip commands.
Solution 1: Using pip to install pytorch – Here is the pip command to install PyTorch. The above command will install the latest version of the PyTorch module. You can specify any other version with the same command. Now if you are using python 3 then specifically we can use pip3 in the above command.
To install PyTorch, you have to run the installation command of PyTorch on your command prompt. This command is available on https://pytorch.org/. Select language and cuda version as per your requirement. Now, run python -version, and Conda -version command to check Conda and python packages are installed or not.
This library is part of the PyTorch project. PyTorch is an open source machine learning framework.
From PyTorch
installing Docs you should follow these steps:
In Anaconda use this command:conda install pytorch torchvision cpuonly -c pytorch
In Pip use this command:pip3 install torch==1.3.1+cpu torchvision==0.4.2+cpu -f https://download.pytorch.org/whl/torch_stable.html
Note: If you have an enabled CUDA card you can change the cpuonly
option to cudatoolkit=10.1
or cudatoolkit=9.2
After successfully installing the package you can import it with the command import torchvision
and the output should look like this:
Otherwise, there is something wrong when you are downloading the package from the Internet
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With