ModuleNotFoundError: No module named 'request' in Python
Question:
I was trying to install a module named panda
, to clarify, I actually want to use the panda
package instead of pandas
. I installed it using pip install panda
, and cmd
displayed requirement already satisfied. Normally, I could use this module by using this code:
import panda
But when I typed in this line of code, python gave me this error that did not make any sense:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:Usersxyccx_mdrrjg8AppDataRoamingPythonPython310site-packagespanda__init__.py", line 1, in <module>
from request import PandaRequest
ModuleNotFoundError: No module named 'request'
I was importing panda
, and it said that ModuleNotFoundError: No module named 'request'
. There is no connection between this error message and the code that I wrote. How should I fix this bug?
Answers:
It looks like this library suffers from relative import errors, which is weird for such a popular library.
To fix it, go to the python/site-packages/panda
directory, in your case, it is C:Usersxyccx_mdrrjg8AppDataRoamingPythonPython310site-packagespanda
.
In the __init__.py
, change the first 5 lines to:
from . request import PandaRequest
from . models import Video, Cloud, Encoding, Profile, Notifications, PandaDict
from . models import GroupRetriever, SingleRetriever
from . models import PandaError
from . upload_session import UploadSession
In upload_session.py
, change the third line to:
from . models import Video
I was trying to install a module named panda
, to clarify, I actually want to use the panda
package instead of pandas
. I installed it using pip install panda
, and cmd
displayed requirement already satisfied. Normally, I could use this module by using this code:
import panda
But when I typed in this line of code, python gave me this error that did not make any sense:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:Usersxyccx_mdrrjg8AppDataRoamingPythonPython310site-packagespanda__init__.py", line 1, in <module>
from request import PandaRequest
ModuleNotFoundError: No module named 'request'
I was importing panda
, and it said that ModuleNotFoundError: No module named 'request'
. There is no connection between this error message and the code that I wrote. How should I fix this bug?
It looks like this library suffers from relative import errors, which is weird for such a popular library.
To fix it, go to the python/site-packages/panda
directory, in your case, it is C:Usersxyccx_mdrrjg8AppDataRoamingPythonPython310site-packagespanda
.
In the __init__.py
, change the first 5 lines to:
from . request import PandaRequest
from . models import Video, Cloud, Encoding, Profile, Notifications, PandaDict
from . models import GroupRetriever, SingleRetriever
from . models import PandaError
from . upload_session import UploadSession
In upload_session.py
, change the third line to:
from . models import Video