Resolved- Unresolved import oauth2client.client or oauth2client.service_account
Today in this article, we will cover below aspects,
Issue:
Python code execution gives error Unresolved import oauth2client or runtime error called.
“No Module named ‘oauth2client’
You may also see errors like unresolved import oauth2client.
Resolution
To resolve the issue No Module named oauth2client, you need to add the missing package to your project.
Below commands let me add the missing packages. (FYI – I was using Visual Studio 2019 with python support)
pip install oauth2client
----- Installing 'oauth2client' -----
Collecting oauth2client
Using cached oauth2client-4.1.3-py2.py3-none-any.whl (98 kB)
Collecting pyasn1>=0.1.7
Using cached pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)
Collecting httplib2>=0.9.1
Downloading httplib2-0.20.2-py3-none-any.whl (96 kB)
Collecting six>=1.6.1
Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting rsa>=3.1.4
Using cached rsa-4.8-py3-none-any.whl (39 kB)
Collecting pyasn1-modules>=0.0.5
Using cached pyasn1_modules-0.2.8-py2.py3-none-any.whl (155 kB)
Collecting pyparsing!=3.0.0,!=3.0.1,!=3.0.2,!=3.0.3,<4,>=2.4.2; python_version > "3.0"
Downloading pyparsing-3.0.6-py3-none-any.whl (97 kB)
Installing collected packages: pyasn1, pyparsing, httplib2, six, rsa, pyasn1-modules, oauth2client
Successfully installed httplib2-0.20.2 oauth2client-4.1.3 pyasn1-0.4.8 pyasn1-modules-0.2.8 pyparsing-3.0.6 rsa-4.8 six-1.16.0
WARNING: You are using pip version 20.1.1; however, version 21.3.1 is available.
You should consider upgrading via the 'C:\Users\code\source\repos\Code\env\Scripts\python.exe -m pip install --upgrade pip' command.
----- Successfully installed 'oauth2client' -----
References:
That’s all! Happy coding!
Does this help you fix your issue?
Do you have any better solutions or suggestions? Please sound off your comments below.
Please bookmark this page and share it with your friends. Please Subscribe to the blog to receive notifications on freshly published(2024) best practices and guidelines for software design and development.