Snowflake-connector-python 3.0.4 requires urllib3<1.27,>=1.21.1, but you have urllib3 2.0.4

Deployed with a requirements.txt but get an error message on urllib3 which is incompatible

snowflake-connector-python 3.0.4 requires urllib3<1.27,>=1.21.1, but you have urllib3 2.0.4 which is incompatible. As we can see - I am specifying urlllib3==1.21.1 in the requirements.txt - it seems like the environment is loading 2.04 before the requirements.txt - how to fix?

This is my requirements.txt file

numpy
matplotlib
pandas
urllib3==1.21.1
pyarrow==10.0.1
pillow==9.5
asn1crypto==1.5.1
certifi==2023.5.7
cffi==1.15.1
charset-normalizer==3.1.0
cryptography==40.0.2
filelock==3.12.0
idna==3.4
oscrypto==1.3.0
packaging==23.1
pycparser==2.21
pycryptodomex==3.18.0
PyJWT==2.7.0
pyOpenSSL==23.1.1
pytz==2023.3
requests==2.31.0
sortedcontainers==2.4.0
typing_extensions==4.6.0
snowflake-connector-python==3.0.4

I read the Snowflake python driver documentation carefully and changed my requirements.txt to:

n

umpy
matplotlib
pandas
urllib3==1.26.0
-r https://raw.githubusercontent.com/snowflakedb/snowflake-connector-python/main/tested_requirements/requirements_38.reqs

But now I get an error message:

ERROR: Cannot install urllib3==1.26.0 and urllib3==1.26.16 because these package versions have conflicting dependencies.

(In a previous commit to GH I had specified 1.26.16)

Looks like server-side caching

No, you are actually specifying conflicting requirements. The included requirements file requirements_38.reqs already asks for urllib3==1.26.16 , you don’t need to ask for it again.

You’re right. I took it out - and it sill doesn’t work

The Streamlit docker is already loading urllib3=-2.0.4 or one of the libraries in the snowflake connector is loading urllib3==2.0.4

Here is the requirements.txt now:
numpy
matplotlib
pandas

Generated on: Python 3.8.16

asn1crypto==1.5.1
certifi==2023.5.7
cffi==1.15.1
charset-normalizer==3.1.0
cryptography==40.0.2
filelock==3.12.0
idna==3.4
oscrypto==1.3.0
packaging==23.1
pycparser==2.21
pycryptodomex==3.18.0
PyJWT==2.7.0
pyOpenSSL==23.1.1
pytz==2023.3
requests==2.31.0
sortedcontainers==2.4.0
typing_extensions==4.6.0
urllib3==1.26.16
snowflake-connector-python==3.0.4

Throws error:

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.
snowflake-connector-python 3.0.4 requires urllib3<1.27,>=1.21.1, but you have urllib3 2.0.4 which is incompatible.
Successfully installed MarkupSafe-2.1.3 altair-5.0.1 attrs-23.1.0 backports.zoneinfo-0.2.1 blinker-1.6.2 cachetools-5.3.1 certifi-2023.7.22 charset-normalizer-3.2.0 click-8.1.6 decorator-5.1.1 gitdb-4.0.10 gitpython-3.1.32 idna-3.4 importlib-metadata-6.8.0 importlib-resources-6.0.0 jinja2-3.1.2 jsonschema-4.18.4 jsonschema-specifications-2023.7.1 markdown-it-py-3.0.0 mdurl-0.1.2 numpy-1.24.4 packaging-23.1 pandas-2.0.3 pillow-9.5.0 pkgutil-resolve-name-1.3.10 protobuf-4.23.4 pyarrow-12.0.1 pydeck-0.8.0 pygments-2.15.1 pympler-1.0.1 python-dateutil-2.8.2 pytz-2023.3 pytz-deprecation-shim-0.1.0.post0 referencing-0.30.0 requests-2.31.0 rich-13.4.2 rpds-py-0.9.2 six-1.16.0 smmap-5.0.0 streamlit-1.25.0 tenacity-8.2.2 toml-0.10.2 toolz-0.12.0 tornado-6.3.2 typing-extensions-4.7.1 tzdata-2023.3 tzlocal-4.3.1 urllib3-2.0.4 validators-0.20.0 watchdog-3.0.0 zipp-3.16.2
WARNING: You are using pip version 22.0.3; however, version 23.2.1 is available.
You should consider upgrading via the '/home/adminuser/venv/bin/python -m pip install --upgrade pip' command.

I have python code that works in streamlit properly It reads from a snowflake table into a dataframe exposes sliders and draws a graph

I copied the file, git committed, pushed and deployed to streatmlit

the same exact python script returns an error ```
snowflake-connector-python 3.0.4 requires urllib3<1.27,>=1.21.1, but you have urllib3 2.0.4 which is incompatible.

This works
https://baseball-metrics-graph.streamlit.app/

Same script does not work
https://baseball-metrics-t2.streamlit.app/

yes but i fixed that and the problem persists.
i even copied a script that works as is and the copied script crashes on this error

This is what seems to be happening in streamlit cloud:

  1. The packages in requirements.txt are installed, including urllib3==1.26.16.
  2. Since streamlit is still missing, it is installed along with its dependencies, without paying any consideration to already installed packages. So the latest urllib3 compatible with streamlit (urllib3==2.0.4) is installed

I was able to fix it by adding streamlit==1.25.0 to requirements.txt.

thx - sounds right if a bit bizarre. will test soon -

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.