hypermodern-python: Dependency errors when using python 3.9 and 3.8
Issue
When using python version 3.9: For me, all nox sessions where install_with_constrains is used with python version 3.9 fail.
For instance running the tests session works fine, till chapter 4. After adding more nox sessions and installing more dependencies I started to see multiple dependencies for different python versions (I am following the tutorial using python 3.9 and 3.8 respectively).
After some research, it seems this problem is related to Duplicate dependency export #1970
Console Output
CLICK ME
nox > Running session tests-3.9
nox > Re-using existing virtual environment at .nox/tests-3-9.
nox > poetry install --no-dev
Installing dependencies from lock file
Package operations: 2 installs, 0 updates, 11 removals
• Removing coverage (5.3)
• Removing iniconfig (1.1.1)
• Removing packaging (20.4)
• Removing pluggy (0.13.1)
• Removing py (1.9.0)
• Removing pyparsing (2.4.7)
• Removing pytest (6.1.1)
• Removing pytest-cov (2.10.1)
• Removing pytest-mock (3.3.1)
• Removing six (1.15.0)
• Removing toml (0.10.1)
• Installing mypy-extensions (0.4.3)
• Installing typing-extensions (3.7.4.3)
Installing the current project: hypermodern-bersten (0.1.0)
nox > poetry export --dev --format=requirements.txt --output=/tmp/tmppd82bei6
nox > pip install --constraint=/tmp/tmppd82bei6 coverage[toml] pytest pytest-cov pytest-mock
nox > Command pip install --constraint=/tmp/tmppd82bei6 coverage[toml] pytest pytest-cov pytest-mock failed with exit code 1:
Ignoring atomicwrites: markers 'python_version >= "3.5" and python_full_version < "3.0.0" and sys_platform == "win32" and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5") or sys_platform == "win32" and python_version >= "3.5" and python_full_version >= "3.4.0" and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5")' don't match your environment
Ignoring attrs: markers 'python_version == "3.8" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version == "3.8"' don't match your environment
Ignoring colorama: markers 'python_version >= "3.5" and python_full_version < "3.0.0" and sys_platform == "win32" and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5") and platform_system == "Windows" or sys_platform == "win32" and python_version >= "3.5" and python_full_version >= "3.5.0" and (python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5") and platform_system == "Windows"' don't match your environment
Ignoring decorator: markers 'python_version == "3.8" and python_full_version < "3.0.0" and python_full_version >= "2.7.0" or python_version == "3.8" and python_full_version >= "3.2.0"' don't match your environment
Ignoring importlab: markers 'python_version == "3.8" and python_full_version >= "2.7.0"' don't match your environment
Ignoring networkx: markers 'python_version == "3.8" and python_full_version >= "2.7.0"' don't match your environment
Ignoring ninja: markers 'python_version == "3.8"' don't match your environment
Ignoring pytype: markers 'python_version == "3.8"' don't match your environment
Ignoring pyyaml: markers 'python_version == "3.8" and python_full_version < "3.0.0" or python_version == "3.8" and python_full_version >= "3.5.0"' don't match your environment
Ignoring six: markers 'python_version == "3.8" and python_full_version < "3.0.0" and python_full_version >= "2.7.0" or python_version == "3.8" and python_full_version >= "3.4.0"' don't match your environment
Ignoring typed-ast: markers 'python_version == "3.8"' don't match your environment
Collecting coverage==5.3
Using cached coverage-5.3-cp39-cp39-manylinux1_x86_64.whl (228 kB)
Collecting pytest-cov==2.10.1
Using cached pytest_cov-2.10.1-py2.py3-none-any.whl (19 kB)
Collecting pytest-mock==3.3.1
Using cached pytest_mock-3.3.1-py3-none-any.whl (11 kB)
Collecting pytest==6.1.1
Using cached pytest-6.1.1-py3-none-any.whl (272 kB)
Collecting toml==0.10.1
Using cached toml-0.10.1-py2.py3-none-any.whl (19 kB)
Requirement already satisfied: attrs>=17.4.0 in ./.nox/tests-3-9/lib/python3.9/site-packages (from pytest==6.1.1->-c /tmp/tmppd82bei6 (line 176)) (20.2.0)
Collecting pluggy==0.13.1
Using cached pluggy-0.13.1-py2.py3-none-any.whl (18 kB)
Collecting iniconfig==1.1.1
Using cached iniconfig-1.1.1-py2.py3-none-any.whl (5.0 kB)
Collecting packaging==20.4
Using cached packaging-20.4-py2.py3-none-any.whl (37 kB)
Collecting py==1.9.0
Using cached py-1.9.0-py2.py3-none-any.whl (99 kB)
Collecting pyparsing==2.4.7
Using cached pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
Collecting six
ERROR: In --require-hashes mode, all requirements must have their versions pinned with ==. These do not:
six from https://files.pythonhosted.org/packages/ee/ff/48bde5c0f013094d729fe4b0316ba2a24774b3ff1c52d924a8a4cb04078a/six-1.15.0-py2.py3-none-any.whl#sha256=8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced (from packaging==20.4->-c /tmp/tmppd82bei6 (line 146))
nox > Session tests-3.9 failed.
About this issue
- Original URL
- State: open
- Created 4 years ago
- Comments: 23 (5 by maintainers)
Commits related to this issue
- fix: remove --require-hashes mode Due to issues with pytype not pinning dependency versions, I'm removing the explicit version checking semantics. See also: * https://github.com/google/pytype/issues... — committed to ToddG/hypermodern-python-seed by ToddG 4 years ago
- Fix nox tests See https://github.com/cjolowicz/hypermodern-python/issues/174#issuecomment-745364836 — committed to villainy/grpc-interceptor by d5h 4 years ago
- Fix nox as per https://github.com/cjolowicz/hypermodern-python/issues/174#issuecomment-769863925 — committed to rarescosma/der-py by rarescosma 3 years ago
- fix bug with hash checks, see https://github.com/cjolowicz/hypermodern-python/issues/174 — committed to arthist-lmu/artigo by kristbaum 2 years ago
- Fix pip issues in deploy pipeline https://github.com/cjolowicz/hypermodern-python/issues/174#issuecomment-769863925 — committed to happybara-io/WorkflowBuddy by I-Dont-Remember 2 years ago
For everyone not using the Cookiecutter and/or nox-poetry, I would recommend passing
--without-hashestopoetry export, and using pip’s new resolver.This seems to continue to persist in 3.10.
hi @staticdev
2021.1.29 was just released.
The cause definitely seems to be the changes to pip with the new resolver becoming the default in version 20.3. Looks like the way constraints file work has changed in this version. https://github.com/pypa/pip/issues/9020 and https://pip.pypa.io/en/latest/user_guide/#watch-out-for cleared it up for me.
It seems that the only solution, other than not upgrading pip, is to add “–without-hashes” to the “poetry export” command in
install_with_constraints. I couldn’t find anything else, anyway.For me, doing the environment variable approach recommended above and then also pinning the Pip version itself together worked out fine.
One difference between your build and mine is that you’re using the latest version of Nox, whereas we’ve pinned the previous version of it (2020.5.24). Nox has a
virtualenvas a dependency, so I wonder if that might somehow be getting in the way.Also, we’re using
poetry==1.0.9as a pinned install rather than the latest version. Not sure where the issue is coming from for you but my guess is probably that it’s coming from deeper in the dependency tree with the version numbers involved of everything else.@wanderrful That didn’t work for me =/ https://github.com/DontShaveTheYak/cloud-radar/actions/runs/420486474
Unless you mean pinning pip with poetry or some other way? Pinning
virtualenvworked. I did not try the environment variable approach.I ended up just using
--without-hashesas pinning the version was not a long-term fix since it’s not a bug but the behavior going forward.Glad you found a workaround. I would suspect that this is triggered by changes to constraints file handling in pip’s new resolver. Pip is bundled with virtualenv. You could then also “solve” this by pinning pip to a version before the new resolver became the default, setting the environment variable VIRTUALENV_PIP to 20.2.4
@wanderrful
Here is what I am currently using:
Then using it within nox sessions as:
I hope that helps.
https://github.com/cjolowicz/hypermodern-python/blob/400386bd73109fa2163ddfd05c05b6dc7d316afc/noxfile.py#L30-L39
I fixed this problem by adding
--without-hashesparameter to theinstall_with_constraintsfunction in noxfile.