Vision: from torchvision.models.detection.faster_rcnn import FastRCNNPredictor builtins.ModuleNotFoundError: No module named 'torchvision.models'; 'torchvision' is not a package

Created on 4 Oct 2019  Â·  15Comments  Â·  Source: pytorch/vision

Have tried all of the methods. The torch vision is installed successfully.Some attachments that say.
Screenshot from 2019-10-04 17-09-49
Need help. Any other way only torch vision models can be installed?

question binaries

All 15 comments

Hi,

You are following the wrong installation instructions. You installed a very old version of torchvision (0.1.8), which doesn't have those models (and uninstalled 0.4 on the way)

I'd recommend doing

pip uninstall torchvision

and then follow the instructions in https://pytorch.org/get-started/locally/

pip install torchvision

Hi,

tried that. Still the same error!

"from torchvision.models.detection.faster_rcnn import FastRCNNPredictor
builtins.ModuleNotFoundError: No module named 'torchvision.models';
'torchvision' is not a package"

On Fri, Oct 4, 2019 at 5:22 PM Francisco Massa notifications@github.com
wrote:

Closed #1414 https://github.com/pytorch/vision/issues/1414.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/pytorch/vision/issues/1414?email_source=notifications&email_token=AGZ36FAF7AYQ6E7IZGOLFGLQM4U6VA5CNFSM4I5OZIQ2YY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOUAVJIWA#event-2687145048,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGZ36FGAI2OZ23AWP7G7CXLQM4U6VANCNFSM4I5OZIQQ
.

Open #1414

Even tried for the latest torch vision.

pip install torchvision==0.4

Can you do torchvision.__version__? This will probably indicate that you are using an older version.

You probably have a conflict in your system, and the solution is to remove all instances of torchvision that you currently have, and re-install.

so here is an attachment. I am using latest version of torch vision
Screenshot from 2019-10-04 20-21-10
, under packages.

Reopened #1414

This doesn't mean that your installation is using the latest version of torchvision.

Can you do

conda uninstall torchvision
pip uninstall torchvision
pip uninstall torchvision

and try installing again? That is most probably a conflict with your install.

I'll keep the issue open due to your request, but I've just now re-compiled torchvision and everything works fine

This worked! Thank you! I guess I myself had to close it!
upload

    -

Say, may you tell which version of torchvision are you using? I'm using 0.2.2 now and there is no module named detection in torchvision.models. Thanks :)

@feiyangsuo detection models are available in the 0.3.0 version of torchvision, and last released version is 0.6.0.

Installation instructions can be found in https://pytorch.org/get-started/locally/

import torchvision.optim as optim
ModuleNotFoundError: No module named 'torchvision.optim'

import torchvision.optim as optim
ModuleNotFoundError: No module named 'torchvision.optim'

from torch import optim
since torchvision has no optim module.
BTW, pls don't repeat a question for such many times, which may get others hard to find answers to their question

import torchvision.optim as optim
ModuleNotFoundError: No module named 'torchvision.optim'

from torch import optim
since torchvision has no optim module.
BTW, pls don't repeat a question for such many times, which may get others hard to find answers to their question

Sorry, thanks. The problem has been fixed in last night.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

300LiterPropofol picture 300LiterPropofol  Â·  3Comments

a-maci picture a-maci  Â·  3Comments

ArashJavan picture ArashJavan  Â·  3Comments

Abolfazl-Mehranian picture Abolfazl-Mehranian  Â·  3Comments

yxlabs picture yxlabs  Â·  4Comments