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

minio 7.2.1 requires urllib3>=2.0 #1378

Closed
ydc-0 opened this issue Dec 26, 2023 · 10 comments
Closed

minio 7.2.1 requires urllib3>=2.0 #1378

ydc-0 opened this issue Dec 26, 2023 · 10 comments

Comments

@ydc-0
Copy link
Contributor

ydc-0 commented Dec 26, 2023

Issue

To reproduce

pip install urllib3\<2.0
pip install minio==7.2.1
python -c 'import minio'

Failure Logs

~ pip install urllib3\<2.0
...
Successfully installed urllib3-1.26.18

➜  ~ pip install minio 
...
Successfully installed argon2-cffi-23.1.0 argon2-cffi-bindings-21.2.0 minio-7.2.1 pycryptodome-3.19.0

[notice] A new release of pip is available: 23.3.1 -> 23.3.2
[notice] To update, run: pip install --upgrade pip

➜  ~ python -c 'import minio'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "***/.pyenv/pyenv/versions/3.11.4/lib/python3.11/site-packages/minio/__init__.py", line 41, in <module>
    from .api import Minio
  File "***/.pyenv/pyenv/versions/3.11.4/lib/python3.11/site-packages/minio/api.py", line 44, in <module>
    from urllib3.response import BaseHTTPResponse
ImportError: cannot import name 'BaseHTTPResponse' from 'urllib3.response' (***/.pyenv/pyenv/versions/3.11.4/lib/python3.11/site-packages/urllib3/response.py)
@ydc-0 ydc-0 changed the title minio 7.2.1 typing requires urllib3>=2.0 minio 7.2.1 requires urllib3>=2.0 Dec 26, 2023
@balamurugana
Copy link
Member

Feel free to send a PR

@ydc-0
Copy link
Contributor Author

ydc-0 commented Dec 26, 2023

@balamurugana Do you prefer to add urllib3>2.0 to install_requires or make minio compatible with urllib 1.x?

@balamurugana
Copy link
Member

@balamurugana Do you prefer to add urllib3>2.0 to install_requires or make minio compatible with urllib 1.x?

@ydc-0 urllib3>2.0 to install_requires

@mwagnurr
Copy link

7.2.0 was still working without issues and just now our pipelines are breaking due to these urllib3 errors. I don't understand why this breaking change was introduced with a patch version in https://github.com/minio/minio-py/releases/tag/7.2.1

If I'm not missing something then just adding urllib3>=2.0 to install_requires will not change the fact that this is a breaking change, which is why I would suggest that the changes in 7.2.1 are reverted and instead released with a proper major version increase

@balamurugana
Copy link
Member

What is the error you are getting?

@anehx
Copy link

anehx commented Dec 27, 2023

We're having this issue as well. I'd really suggest that we add support for urllib 1 and 2 instead of forcing the v2 version just because of typing..

I'll try to find the time to submit a PR for this.

@anehx
Copy link

anehx commented Dec 27, 2023

I investigated a little further: The only issue is the import of BaseHTTPResponse which minio uses for typing.

This class was added in urllib3 v2 and does not exist in v1. IMO we have multiple options to resolve this:

  1. We add urllib3>=2 as dependency in install_requires (as mentioned here) - this would force all applications using minio in combination with urllib3 v1 to downgrade to version 7.2.0 just because of typing.
  2. We use try / catch to import HTTPResponse instead of BaseHTTPResponse if the app uses version 1 of urllib3. This would work, but we'd tell the typing system that HTTPResponse is the same as BaseHTTPResponse which is simply not true.
  3. We import HTTPResponse and use that in our typing.

What do you think is the way to go @balamurugana @mwagnurr @ydc-0 ?

@balamurugana
Copy link
Member

@anehx I suggest to use urllib3>=2 i.e. no change. urllib3 v1 is in maintenance mode and it won't get any new feature. Users of urllib3 v1 and don't want to upgrade to urllib3 v2 could use minio-py v7.2.0

@ydc-0
Copy link
Contributor Author

ydc-0 commented Dec 28, 2023

@anehx In fact, I'm still using minio==7.2.0 in my project, because there are other packages that require urllib3<2.

BTW, pip install minio urllib3<2 will still install minio==7.2.1, must add minio!=7.2.1 or minio<=7.2.0 to requirements.txt when using urllib3<2

✗ pip install minio urllib3<2
    Uninstalling minio-7.2.2:
      Successfully uninstalled minio-7.2.2
Successfully installed minio-7.2.1 urllib3-1.26.18   # do not work

✗ pip install minio!=7.2.1 urllib3\<2
Successfully installed minio-7.2.0

✗ pip install --upgrade minio urllib3\>2
Successfully installed minio-7.2.2 urllib3-2.1.0

@ydc-0
Copy link
Contributor Author

ydc-0 commented Dec 28, 2023

@balamurugana Is it possible to avoid pip install minio==7.2.1 by default when there are urllib3<2? May yank the version 7.2.1? https://peps.python.org/pep-0592/

If pip install minio urllib3<2 could install minio==7.2.0, it would help others to not have a hard limit of minio.

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

4 participants