Open
Description
I'm encountering this error when locally building some cloud functions written in python.
ModuleNotFoundError: No module named 'urllib3.packages.six.moves'
This is the traceback :
Traceback (most recent call last):
File "/home/elia/lavoro/estinguo/estinguo-server-python/env/bin/functions-framework-python", line 8, in <module>
sys.exit(_cli())
^^^^^^
File "/home/elia/lavoro/estinguo/estinguo-server-python/env/lib64/python3.12/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/elia/lavoro/estinguo/estinguo-server-python/env/lib64/python3.12/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/home/elia/lavoro/estinguo/estinguo-server-python/env/lib64/python3.12/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/elia/lavoro/estinguo/estinguo-server-python/env/lib64/python3.12/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/elia/lavoro/estinguo/estinguo-server-python/env/lib64/python3.12/site-packages/functions_framework/_cli.py", line 36, in _cli
app = create_app(target, source, signature_type)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/elia/lavoro/estinguo/estinguo-server-python/env/lib64/python3.12/site-packages/functions_framework/__init__.py", line 380, in create_app
raise e from None
File "/home/elia/lavoro/estinguo/estinguo-server-python/env/lib64/python3.12/site-packages/functions_framework/__init__.py", line 361, in create_app
spec.loader.exec_module(source_module)
File "<frozen importlib._bootstrap_external>", line 995, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/home/elia/lavoro/estinguo/estinguo-server-python/functions/main.py", line 3, in <module>
from google.cloud import firestore
File "/home/elia/lavoro/estinguo/estinguo-server-python/env/lib64/python3.12/site-packages/google/cloud/firestore/__init__.py", line 18, in <module>
from google.cloud.firestore_v1 import gapic_version as package_version
File "/home/elia/lavoro/estinguo/estinguo-server-python/env/lib64/python3.12/site-packages/google/cloud/firestore_v1/__init__.py", line 27, in <module>
from google.cloud.firestore_v1._helpers import GeoPoint
File "/home/elia/lavoro/estinguo/estinguo-server-python/env/lib64/python3.12/site-packages/google/cloud/firestore_v1/_helpers.py", line 22, in <module>
from google.api_core import gapic_v1
File "/home/elia/lavoro/estinguo/estinguo-server-python/env/lib64/python3.12/site-packages/google/api_core/gapic_v1/__init__.py", line 16, in <module>
from google.api_core.gapic_v1 import config
File "/home/elia/lavoro/estinguo/estinguo-server-python/env/lib64/python3.12/site-packages/google/api_core/gapic_v1/config.py", line 26, in <module>
from google.api_core import retry
File "/home/elia/lavoro/estinguo/estinguo-server-python/env/lib64/python3.12/site-packages/google/api_core/retry/__init__.py", line 17, in <module>
from .retry_base import exponential_sleep_generator
File "/home/elia/lavoro/estinguo/estinguo-server-python/env/lib64/python3.12/site-packages/google/api_core/retry/retry_base.py", line 30, in <module>
import requests.exceptions
File "/home/elia/lavoro/estinguo/estinguo-server-python/env/lib64/python3.12/site-packages/requests/__init__.py", line 43, in <module>
import urllib3
File "/home/elia/lavoro/estinguo/estinguo-server-python/env/lib64/python3.12/site-packages/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/home/elia/lavoro/estinguo/estinguo-server-python/env/lib64/python3.12/site-packages/urllib3/connectionpool.py", line 11, in <module>
from .exceptions import (
File "/home/elia/lavoro/estinguo/estinguo-server-python/env/lib64/python3.12/site-packages/urllib3/exceptions.py", line 2, in <module>
from .packages.six.moves.http_client import (
ModuleNotFoundError: No module named 'urllib3.packages.six.moves'
This is the Pip list :
Package Version
------------------------ --------
blinker 1.7.0
CacheControl 0.14.0
cachetools 5.3.3
certifi 2024.2.2
cffi 1.16.0
chardet 3.0.4
charset-normalizer 3.3.2
click 8.1.7
cloudevents 1.9.0
cryptography 42.0.5
deprecation 2.1.0
firebase-admin 6.4.0
firebase-functions 0.2.0
Flask 3.0.2
Flask-Cors 4.0.0
functions-framework 3.5.0
google-api-core 2.17.1
google-api-python-client 2.121.0
google-auth 2.28.1
google-auth-httplib2 0.2.0
google-cloud 0.34.0
google-cloud-core 2.4.1
google-cloud-firestore 2.15.0
google-cloud-storage 2.15.0
google-crc32c 1.5.0
google-events 0.11.0
google-resumable-media 2.7.0
googleapis-common-protos 1.62.0
grpcio 1.62.0
grpcio-status 1.62.0
gunicorn 21.2.0
httplib2 0.22.0
idna 2.7
itsdangerous 2.1.2
Jinja2 3.1.3
MarkupSafe 2.1.5
msgpack 1.0.8
packaging 23.2
pip 24.0
proto-plus 1.23.0
protobuf 4.25.3
pyasn1 0.5.1
pyasn1-modules 0.3.0
pycparser 2.21
PyJWT 2.8.0
pyparsing 3.1.2
PyYAML 6.0.1
requests 2.20.0
rsa 4.9
typing_extensions 4.10.0
uritemplate 4.1.1
urllib3 1.24.1
watchdog 4.0.0
Werkzeug 3.0.1
Does anyone know how to solve the problem? I also tried with the latest version of urllib3 (2.2.1) and when installing the lib I get an error regarding the incompatibility of the urllib3 library and the requests library
pip install urllib3
Collecting urllib3
Using cached urllib3-2.2.1-py3-none-any.whl.metadata (6.4 kB)
Using cached urllib3-2.2.1-py3-none-any.whl (121 kB)
Installing collected packages: urllib3
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
requests 2.20.0 requires urllib3<1.25,>=1.21.1, but you have urllib3 2.2.1 which is incompatible.
Successfully installed urllib3-2.2.1