Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: type object 'requests_failed_to_import' has no attribute 'get' #3

Closed
nerox8664 opened this issue Sep 24, 2018 · 2 comments

Comments

@nerox8664
Copy link

@nerox8664 nerox8664 commented Sep 24, 2018

I got this error when I had tried to import preresnet18 model.

Code:

from pytorchcv.model_provider import get_model as ptcv_get_model
net = ptcv_get_model("PreResNet18", pretrained=True)

Error log:

Downloading /home/nero/.torch/models/preresnet18-1018-98958fd2.pth.zip from https://github.com/osmr/imgclsmob/releases/download/v0.0.39/preresnet18-1018-98958fd2.pth.zip...
download failed, retrying, 4 attempts left
Downloading /home/nero/.torch/models/preresnet18-1018-98958fd2.pth.zip from https://github.com/osmr/imgclsmob/releases/download/v0.0.39/preresnet18-1018-98958fd2.pth.zip...
download failed, retrying, 3 attempts left
Downloading /home/nero/.torch/models/preresnet18-1018-98958fd2.pth.zip from https://github.com/osmr/imgclsmob/releases/download/v0.0.39/preresnet18-1018-98958fd2.pth.zip...
download failed, retrying, 2 attempts left
Downloading /home/nero/.torch/models/preresnet18-1018-98958fd2.pth.zip from https://github.com/osmr/imgclsmob/releases/download/v0.0.39/preresnet18-1018-98958fd2.pth.zip...
download failed, retrying, 1 attempt left
Downloading /home/nero/.torch/models/preresnet18-1018-98958fd2.pth.zip from https://github.com/osmr/imgclsmob/releases/download/v0.0.39/preresnet18-1018-98958fd2.pth.zip...
Traceback (most recent call last):
  File "convert.py", line 135, in <module>
    net = ptcv_get_model("PreResNet18", pretrained=True)
  File "/home/nero/Files/Workspace/env/lib/python3.6/site-packages/pytorchcv/model_provider.py", line 190, in get_model
    net = _models[name](**kwargs)
  File "/home/nero/Files/Workspace/env/lib/python3.6/site-packages/pytorchcv/models/preresnet.py", line 582, in preresnet18
    return get_preresnet(blocks=18, model_name="preresnet18", **kwargs)
  File "/home/nero/Files/Workspace/env/lib/python3.6/site-packages/pytorchcv/models/preresnet.py", line 461, in get_preresnet
    local_model_store_dir_path=root)))
  File "/home/nero/Files/Workspace/env/lib/python3.6/site-packages/pytorchcv/models/model_store.py", line 133, in get_model_file
    overwrite=True)
  File "/home/nero/Files/Workspace/env/lib/python3.6/site-packages/pytorchcv/models/model_store.py", line 220, in _download
    raise e
  File "/home/nero/Files/Workspace/env/lib/python3.6/site-packages/pytorchcv/models/model_store.py", line 204, in _download
    r = requests.get(url, stream=True, verify=verify_ssl)
AttributeError: type object 'requests_failed_to_import' has no attribute 'get'

Environment:

  • Python 3.6.6
  • PyTorch 0.4.0
@nerox8664

This comment has been minimized.

Copy link
Author

@nerox8664 nerox8664 commented Sep 24, 2018

Fixed that with:

pip install requests

It's better to add this dependency to package requirements.

@osmr osmr closed this in 83b95bb Sep 26, 2018
@osmr

This comment has been minimized.

Copy link
Owner

@osmr osmr commented Sep 26, 2018

Thanks, I fixed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.