Skip to content

Conversation

brycedrennan
Copy link

A python package should not specify exact versions of it's dependencies
but should instead state the minimal compatible requirements for it's
dependencies.

Otherwise we end up in unresolvable dependecy situations (like I
find myself now with urllib3) where two packages require different
specific versions. As of pip 20.3, which was released 2020-11-30, pip
will refuse to install conflicting dependecies.

You can read more about this here:

@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.712% when pulling 341983c on BlueOwlDev:packge-reqs into 7075f20 on mindflayer:master.

4 similar comments
@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.712% when pulling 341983c on BlueOwlDev:packge-reqs into 7075f20 on mindflayer:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.712% when pulling 341983c on BlueOwlDev:packge-reqs into 7075f20 on mindflayer:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.712% when pulling 341983c on BlueOwlDev:packge-reqs into 7075f20 on mindflayer:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 98.712% when pulling 341983c on BlueOwlDev:packge-reqs into 7075f20 on mindflayer:master.

@coveralls
Copy link

coveralls commented Dec 2, 2020

Coverage Status

Coverage remained the same at 98.712% when pulling 1f912c1 on BlueOwlDev:packge-reqs into 7075f20 on mindflayer:master.

@mindflayer
Copy link
Owner

mindflayer commented Dec 2, 2020

Hi @brycedrennan, I understand why you published this PR but don't actually agree about its changes.
You can specify versions directly in the Pipfile and, most important, this way you are implying that whoever uses a different version of urllib3 cannot install mocket, which it should not be the case.
Better starting with opening an issue with a real scenario which shows the problem.

@brycedrennan
Copy link
Author

brycedrennan commented Dec 2, 2020

It's not clear to me that we have the same understanding of the situation.

Before this PR, the setup.py file was driven by the requirements.txt file which had these contents:

-i https://pypi.python.org/simple
decorator==4.4.2
http-parser==0.9.0
python-magic==0.4.18
six==1.15.0
urllib3==1.25.11

You can download the tar of your package here to see that: https://pypi.org/project/mocket/3.9.3/#files

This means if any other package I install has incompatible requirements with these specific versions, I cannot list it in the same requirements.txt file of my application and have pip install -r requirements.txt succeed on pip v20.3

With the changes in this PR, your package will now be compatible with anything >= what was put in the requirements file when I generated it. In reality I should have used the last release requirements as minimum (which I'll now do). (done)

To reproduce the issue:

pip install --upgrade pip
pip install urllib3==1.26.2 mocket==3.9.3 

which results in:

ERROR: Cannot install mocket==3.9.3 and urllib3==1.26.2 because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested urllib3==1.26.2
    mocket 3.9.3 depends on urllib3==1.25.11

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies

A python package should not specify exact versions of it's dependencies
but should instead state the minimal compatible requirements for it's
dependencies.

Otherwise we end up in unresolvable dependecy situations (like I
find myself now with urllib3) where two packages require different
specific versions.  As of pip 20.3, which was released 2020-11-30, pip
will refuse to install conflicting dependecies.

You can read more about this here:
 - https://pipenv.pypa.io/en/latest/advanced/#pipfile-vs-setuppy
 - https://realpython.com/pipenv-guide/#package-distribution
 - https://blog.python.org/2020/11/pip-20-3-release-new-resolver.html
@mindflayer
Copy link
Owner

mindflayer commented Dec 2, 2020

Here you are, and thank you again for underlining this problem:

$ python3 -m venv .venv
$ source .venv/bin/activate.fish
(.venv) $ pip install --upgrade pip
Collecting pip
  Using cached pip-20.3-py2.py3-none-any.whl (1.5 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.1.1
    Uninstalling pip-20.1.1:
      Successfully uninstalled pip-20.1.1
Successfully installed pip-20.3
(.venv) $ pip install urllib3==1.26.2 mocket==3.9.4
Collecting mocket==3.9.4
  Downloading mocket-3.9.4.tar.gz (75 kB)
     |████████████████████████████████| 75 kB 1.6 MB/s 
Collecting urllib3==1.26.2
  Using cached urllib3-1.26.2-py2.py3-none-any.whl (136 kB)
Collecting decorator>=4.0.0
  Using cached decorator-4.4.2-py2.py3-none-any.whl (9.2 kB)
Collecting http-parser>=0.9.0
  Using cached http_parser-0.9.0-cp38-cp38-linux_x86_64.whl
Collecting python-magic>=0.4.5
  Using cached python_magic-0.4.18-py2.py3-none-any.whl (8.6 kB)
Collecting six>=1.5.0
  Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
Using legacy 'setup.py install' for mocket, since package 'wheel' is not installed.
Installing collected packages: urllib3, six, python-magic, http-parser, decorator, mocket
    Running setup.py install for mocket ... done
Successfully installed decorator-4.4.2 http-parser-0.9.0 mocket-3.9.4 python-magic-0.4.18 six-1.15.0 urllib3-1.26.2

https://pypi.org/project/mocket/3.9.4/

@brycedrennan
Copy link
Author

Thanks for the quick resolution of this issue. 3.9.4 resolves the conflict I had in my application.

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

Successfully merging this pull request may close these issues.

3 participants