I'm using the Google Calendar API to fetch some events and I'm using a venv to house all the packages required, and I've run into a simple problem: google.auth.transport.requests
can't function correctly, citing the requests
package is not installed.
Code and error:
The problem can be observed using a single line of code:
from google.auth.transport.requests import Request
The following error is dumped to the console from google.auth.transport.requests
(at the bottom of two tracebacks):
File "<string>", line 3, in raise_from
ImportError: The requests library is not installed, please install the requests package to use the requests transport.
Failed attempts
- Deleting and remaking the venv.
- Install modules with --no-cache-dir and --ignore-installed.
Information
- Executing
import requests
orfrom google.auth.transport.requests import Request
from the console fromenv\Scripts\python
works without problem. - The same lines when put in a file
temp.py
when placed inside the following directories execute in the following manner:AutoMate\
: SafeAutoMate\src\
: SafeAutoMate\src\sources\
: ErrorAutoMate\src\sources\temp\
: Safe (sources\temp only made for debugging)AutoMate\src\sources\util\
: Safe.
Note: All tests here and below have been ran from AutoMate\ using env\Scripts\python
and env\Scripts\pip
.
None of the google auth modules have been installed in the pip outside of the venv.
The project structure is as follows:
AutoMate
| temp.py
├───env
│ ├───Include
│ ├───Lib
│ └───Scripts
└───src
│ AutoMate.pyw
│
└───sources
│ calendar.py --> Problematic file
│ whatsapp.py
│ __init__.py
│
└───util
- Output of
env\Scripts\pip list
:
Package Version
------------------------ ---------
cachetools 4.2.1
certifi 2020.12.5
chardet 4.0.0
google-api-core 1.26.1
google-api-python-client 2.0.2
google-auth 1.27.1
google-auth-httplib2 0.1.0
google-auth-oauthlib 0.4.3
googleapis-common-protos 1.53.0
httplib2 0.19.0
idna 2.10
oauthlib 3.1.0
packaging 20.9
pip 21.0.1
protobuf 3.15.5
pyasn1 0.4.8
pyasn1-modules 0.2.8
pyparsing 2.4.7
pytz 2021.1
requests 2.25.1
requests-oauthlib 1.3.0
rsa 4.7.2
selenium 3.141.0
setuptools 49.2.1
six 1.15.0
uritemplate 3.0.1
urllib3 1.26.3