Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError for urllib3 >= 2.0.0 #654

Closed
psavery opened this issue May 23, 2023 · 12 comments
Closed

ImportError for urllib3 >= 2.0.0 #654

psavery opened this issue May 23, 2023 · 12 comments

Comments

@psavery
Copy link

psavery commented May 23, 2023

urllib3 version 2.0.0 was just released last month.

This release includes a commit where iter_fields() was removed.

However, iter_fields() is still being imported by the anaconda-client here.

So we have to downgrade urllib3 to be less than version 2.0.0 if we want to use anaconda-client.

psavery added a commit to HEXRD/hexrdgui that referenced this issue May 23, 2023
This needs to be done until [this issue is fixed](anaconda/anaconda-client#654).

Fixes: #1474

Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
@joverlee521
Copy link

We also ran into the same issue and had to pin urllib3<2.

psavery added a commit to HEXRD/hexrd that referenced this issue May 23, 2023
This needs to be done until [this issue is fixed](anaconda/anaconda-client#654).

Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
psavery added a commit to HEXRD/hexrd that referenced this issue May 23, 2023
This needs to be done until [this issue is fixed](anaconda/anaconda-client#654).

Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
realthunder added a commit to realthunder/FreeCADMakeImage that referenced this issue May 24, 2023
saransh13 pushed a commit to HEXRD/hexrd that referenced this issue May 26, 2023
This needs to be done until [this issue is fixed](anaconda/anaconda-client#654).

Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
@akbarinto1
Copy link

IMG-20230608-WA0004

@charris
Copy link

charris commented Jun 25, 2023

Has this issue been fixed?

@psavery
Copy link
Author

psavery commented Jun 26, 2023

@charris no, it looks like the removed function is still being imported here on master.

@travishathaway
Copy link

travishathaway commented Jul 28, 2023

I ran into a separate issue while running the anaconda upload command (I was trying to upload a new package). I have urllib3=2.0.3 installed.

Traceback (most recent call last):
  File "/Users/computeruser/opt/conda_x86_64/lib/python3.11/site-packages/requests_toolbelt/_compat.py", line 48, in <module>
    from requests.packages.urllib3.contrib import appengine as gaecontrib
ImportError: cannot import name 'appengine' from 'requests.packages.urllib3.contrib' (/Users/computeruser/opt/conda_x86_64/lib/python3.11/site-packages/urllib3/contrib/__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/computeruser/opt/conda_x86_64/bin/anaconda", line 7, in <module>
    from binstar_client.scripts.cli import main
  File "/Users/computeruser/opt/conda_x86_64/lib/python3.11/site-packages/binstar_client/__init__.py", line 29, in <module>
    from .utils.multipart_uploader import multipart_files_upload
  File "/Users/computeruser/opt/conda_x86_64/lib/python3.11/site-packages/binstar_client/utils/multipart_uploader.py", line 5, in <module>
    from requests_toolbelt import MultipartEncoder, MultipartEncoderMonitor
  File "/Users/computeruser/opt/conda_x86_64/lib/python3.11/site-packages/requests_toolbelt/__init__.py", line 12, in <module>
    from .adapters import SSLAdapter, SourceAddressAdapter
  File "/Users/computeruser/opt/conda_x86_64/lib/python3.11/site-packages/requests_toolbelt/adapters/__init__.py", line 12, in <module>
    from .ssl import SSLAdapter
  File "/Users/computeruser/opt/conda_x86_64/lib/python3.11/site-packages/requests_toolbelt/adapters/ssl.py", line 16, in <module>
    from .._compat import poolmanager
  File "/Users/computeruser/opt/conda_x86_64/lib/python3.11/site-packages/requests_toolbelt/_compat.py", line 50, in <module>
    from urllib3.contrib import appengine as gaecontrib
ImportError: cannot import name 'appengine' from 'urllib3.contrib' (/Users/computeruser/opt/conda_x86_64/lib/python3.11/site-packages/urllib3/contrib/__init__.py)
conda list -n base
# packages in environment at /Users/computeruser/opt/conda:
#
# Name                    Version                   Build  Channel
anaconda-client           1.12.0          py311hecd8cb5_0
appnope                   0.1.2           py311hecd8cb5_1001
asttokens                 2.0.5              pyhd3eb1b0_0
attrs                     22.1.0          py311hecd8cb5_0
backcall                  0.2.0              pyhd3eb1b0_0
beautifulsoup4            4.12.2          py311hecd8cb5_0
boltons                   23.0.0             pyhd8ed1ab_0    conda-forge
brotli-python             1.0.9           py311h814d153_9    conda-forge
brotlipy                  0.7.0           py311h6c40b1e_1002
bzip2                     1.0.8                h0d85af4_4    conda-forge
c-ares                    1.19.1               h0dc2134_0    conda-forge
ca-certificates           2023.7.22            h8857fd0_0    conda-forge
cctools                   927.0.2              h5ba7a2e_4
certifi                   2023.7.22       py311hecd8cb5_0
cffi                      1.15.1          py311ha86e640_3    conda-forge
chardet                   4.0.0           py311hecd8cb5_1003
charset-normalizer        3.2.0              pyhd8ed1ab_0    conda-forge
click                     8.1.6                    pypi_0    pypi
clyent                    1.2.2           py311hecd8cb5_1
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
conda                     23.7.2          py311hecd8cb5_0
conda-build               3.26.0          py311hecd8cb5_0
conda-guard               0.3.0                    pypi_0    pypi
conda-index               0.2.3           py311hecd8cb5_0
conda-libmamba-solver     23.5.0             pyhd8ed1ab_0    conda-forge
conda-package-handling    2.0.2              pyh38be061_0    conda-forge
conda-package-streaming   0.8.0              pyhd8ed1ab_0    conda-forge
cryptography              41.0.2          py311h892b619_0    conda-forge
decorator                 5.1.1              pyhd3eb1b0_0
defusedxml                0.7.1              pyhd3eb1b0_0
executing                 0.8.3              pyhd3eb1b0_0
filelock                  3.9.0           py311hecd8cb5_0
fmt                       9.1.0                hb8565cd_0    conda-forge
glob2                     0.7                pyhd3eb1b0_0
icu                       72.1                 h7336db1_0    conda-forge
idna                      3.4                pyhd8ed1ab_0    conda-forge
ipython                   8.12.0          py311hecd8cb5_0
jedi                      0.18.1          py311hecd8cb5_1
jinja2                    3.1.2           py311hecd8cb5_0
jsonpatch                 1.32               pyhd8ed1ab_0    conda-forge
jsonpointer               2.0                        py_0    conda-forge
jsonschema                4.17.3          py311hecd8cb5_0
jupyter_core              5.3.0           py311hecd8cb5_0
krb5                      1.20.1               h049b76e_0    conda-forge
ld64                      450.3                h3c32e8a_4
libarchive                3.6.2                h0b5dc4a_1    conda-forge
libcurl                   8.1.2                hbee3ae8_0    conda-forge
libcxx                    16.0.6               hd57cbcb_0    conda-forge
libedit                   3.1.20191231         h0678c8f_2    conda-forge
libev                     4.33                 haf1e3a3_1    conda-forge
libexpat                  2.5.0                hf0c8a7f_1    conda-forge
libffi                    3.4.2                h0d85af4_5    conda-forge
libiconv                  1.17                 hac89ed1_0    conda-forge
liblief                   0.12.3               hcec6c5f_0
libllvm10                 10.0.0               h21ff451_2
libmamba                  1.4.8                hc2ec11d_0    conda-forge
libmambapy                1.4.8           py311h266e549_0    conda-forge
libnghttp2                1.52.0               he2ab024_0    conda-forge
libsolv                   0.7.24               h7d26f99_1    conda-forge
libsqlite                 3.42.0               h58db7d2_0    conda-forge
libssh2                   1.11.0               hd019ec5_0    conda-forge
libxml2                   2.11.4               hd95e348_0    conda-forge
libzlib                   1.2.13               h8a1eda9_5    conda-forge
lz4-c                     1.9.4                hf0c8a7f_0    conda-forge
lzo                       2.10              haf1e3a3_1000    conda-forge
markdown-it-py            3.0.0                    pypi_0    pypi
markupsafe                2.1.1           py311h6c40b1e_0
matplotlib-inline         0.1.6           py311hecd8cb5_0
mdurl                     0.1.2                    pypi_0    pypi
more-itertools            8.12.0             pyhd3eb1b0_0
nbformat                  5.7.0           py311hecd8cb5_0
ncurses                   6.4                  hf0c8a7f_0    conda-forge
openssl                   3.1.1                h8a1eda9_1    conda-forge
packaging                 23.1               pyhd8ed1ab_0    conda-forge
parso                     0.8.3              pyhd3eb1b0_0
patch                     2.7.6             h1de35cc_1001
pexpect                   4.8.0              pyhd3eb1b0_3
pickleshare               0.7.5           pyhd3eb1b0_1003
pip                       23.1.2             pyhd8ed1ab_0    conda-forge
pkginfo                   1.9.6           py311hecd8cb5_0
platformdirs              2.5.2           py311hecd8cb5_0
pluggy                    1.2.0              pyhd8ed1ab_0    conda-forge
prompt-toolkit            3.0.36          py311hecd8cb5_0
psutil                    5.9.0           py311h6c40b1e_0
ptyprocess                0.7.0              pyhd3eb1b0_2
pure_eval                 0.2.2              pyhd3eb1b0_0
py-lief                   0.12.3          py311hcec6c5f_0
pybind11-abi              4                    hd8ed1ab_3    conda-forge
pycosat                   0.6.4           py311h5547dcb_1    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pygments                  2.15.1          py311hecd8cb5_1
pyopenssl                 23.2.0             pyhd8ed1ab_1    conda-forge
pyrsistent                0.18.0          py311h6c40b1e_0
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
python                    3.11.4          h30d4d87_0_cpython    conda-forge
python-dateutil           2.8.2              pyhd3eb1b0_0
python-fastjsonschema     2.16.2          py311hecd8cb5_0
python-libarchive-c       2.9                pyhd3eb1b0_1
python.app                1.4             py311h5547dcb_1    conda-forge
python_abi                3.11                    3_cp311    conda-forge
pytz                      2022.7          py311hecd8cb5_0
pyyaml                    6.0             py311h6c40b1e_1
readline                  8.2                  h9e318b2_1    conda-forge
reproc                    14.2.4               hb7f2c08_0    conda-forge
reproc-cpp                14.2.4               hf0c8a7f_0    conda-forge
requests                  2.31.0             pyhd8ed1ab_0    conda-forge
requests-toolbelt         0.9.1              pyhd3eb1b0_0
rich                      13.4.2                   pypi_0    pypi
ruamel.yaml               0.17.32         py311h2725bcf_0    conda-forge
ruamel.yaml.clib          0.2.7           py311h5547dcb_1    conda-forge
setuptools                68.0.0             pyhd8ed1ab_0    conda-forge
six                       1.16.0             pyhd3eb1b0_1
soupsieve                 2.4             py311hecd8cb5_0
stack_data                0.2.0              pyhd3eb1b0_0
tapi                      1000.10.8            ha1b3eb9_0
tk                        8.6.12               h5dbffcc_0    conda-forge
toolz                     0.12.0             pyhd8ed1ab_0    conda-forge
tqdm                      4.65.0             pyhd8ed1ab_1    conda-forge
traitlets                 5.7.1           py311hecd8cb5_0
tzdata                    2023c                h71feb2d_0    conda-forge
urllib3                   2.0.3           py311hecd8cb5_0
wcwidth                   0.2.5              pyhd3eb1b0_0
wheel                     0.40.0             pyhd8ed1ab_0    conda-forge
xz                        5.2.6                h775f41a_0    conda-forge
yaml                      0.2.5                haf1e3a3_0
yaml-cpp                  0.7.0                hf0c8a7f_2    conda-forge
zstandard                 0.19.0          py311h26cfcfc_2    conda-forge
zstd                      1.5.2                h829000d_7    conda-forge

@travishathaway
Copy link

I discovered today that one way to get around this is by upgrading the requests-toolbelt package to version 1.0.0. This isn't currently available on defaults so you will have to get it via conda-forge. Below is the command to use:

conda install conda-forge::requests-toolbelt

Hope this helps some of you.

@skupr-anaconda
Copy link

@travishathaway requests-toolbelt 1.0.0 is available on the main channel too

@JavascriptMick
Copy link

I was getting a similar error
ImportError: cannot import name 'appengine' from 'urllib3.contrib' (/Users/xxx/miniconda3/lib/python3.11/site-packages/urllib3/contrib/__init__.py)
but the requests-toolbelt fix worked for me also

@victorlin
Copy link

I think the issue has been resolved. iter_fields was removed in #669, released in version 1.12.0.

Not sure where the appengine error is from, I don't see any references in this repo.

psavery added a commit to HEXRD/hexrd that referenced this issue Oct 30, 2023
The [issue with anaconda-client](anaconda/anaconda-client#654) was resolved.

Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
@psavery
Copy link
Author

psavery commented Oct 30, 2023

@victorlin It looks like that is coming from requests-toolbelt. See this backtrace. I don't know if that was resolved or not.

@psavery
Copy link
Author

psavery commented Oct 30, 2023

It looks like requests-toolbelt fixed their issue with their 1.0.0 release.

I also confirmed that I no longer need to pin urllib3 to be less than 2.0.0! So I believe this issue is resolved. Closing.

@psavery psavery closed this as completed Oct 30, 2023
psavery added a commit to HEXRD/hexrdgui that referenced this issue Oct 30, 2023
The [issue with anaconda-client](anaconda/anaconda-client#654) was resolved.

Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
charris added a commit to charris/numpy that referenced this issue Oct 30, 2023
@prusswan
Copy link

prusswan commented Mar 1, 2024

not completely resolved for anaconda-navigator due to ContinuumIO/anaconda-issues/issues/13351

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants