I'm having this issue running a script and it looks like it missed some dependencies, but as you can see below. After installing the missing libraries, it doesn't make any sense.
[ericfoss@maverick-fossum-ddns-net packages]$ python -c "import utils"
[ericfoss@maverick-fossum-ddns-net packages]$ python -c "import requests"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/requests/__init__.py", line 64, in <module>
from . import utils
ImportError: cannot import name utils
[ericfoss@maverick-fossum-ddns-net packages]$
Any idea why utils
can be imported, but requests
can't?
This error generally occurs when a class cannot be imported due to one of the following reasons: The imported class is in a circular dependency. The imported class is unavailable or was not created. The imported class name is misspelled.
Python's ImportError ( ModuleNotFoundError ) indicates that you tried to import a module that Python doesn't find. It can usually be eliminated by adding a file named __init__.py to the directory and then adding this directory to $PYTHONPATH .
In Python, ImportError occurs when the Python program tries to import module which does not exist in the private table. This exception can be avoided using exception handling using try and except blocks. We also saw examples of how the ImportError occurs and how it is handled.
Check if Requests requirements are satisfied:
$ pip show requests
...
Requires: certifi, idna, chardet, urllib3
I hit the same error but I was missing idna
. After installing it the issue resolved.
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