Open eaaltonen opened 6 months ago
Issue #5617 hits the same assertion, and could be related.
I do not know what this is trying to achieve but I am not at all surprised that it does not work
I would think that the best you can hope for from poetry here is a cleaner error.
I'm hitting the same error. It worked without issue ~3 weeks ago. It also worked today until I tried to install a new dependency. Nothing else has changed in my environment.
I found a work around here: https://github.com/vmware/vsphere-automation-sdk-python/issues/355#issuecomment-1870295459
I can reliably reproduce this with just docutils
[tool.poetry]
name = "example"
version = "0.0.0"
description = ""
authors = []
[tool.poetry.dependencies]
docutils = ">=0.19.0"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
If you poetry lock
in an empty venv, I get
Package docutils (0.21.post1) not found.
If you then pip install docutils
, then poetry lock
, it produces:
AssertionError
at ~/.local/share/pypoetry/venv/lib/python3.12/site-packages/poetry/mixology/partial_solution.py:151 in _register
147│ name = assignment.dependency.complete_name
148│ old_positive = self._positive.get(name)
149│ if old_positive is not None:
150│ value = old_positive.intersect(assignment)
→ 151│ assert value is not None
152│ self._positive[name] = value
153│
154│ return
155│
I first ran into this locally, but have since tried it inside a vanilla python docker container, and it produced the same results.
I’m trying to install apache-airflow with poetry. I ran into the same error because of the docutils
dependency for airflow.
docutils is nothing much to do with this issue, which specifically covers the bizarro vsphere sdk stuff
the docutils thing will be caused by the mis-publishing of docutils 0.21.0 as per eg https://github.com/python-poetry/poetry/issues/9293, you'll want to exclude the bad docutils versions I expect
For whatever reason github search did not route me to #9293 (although that issue does seem to be more focused on actually addressing the former error that you get when docutils isnt yet in the venv); and i'm not particularly interested in the mis-published docutils issue itself.
This issue, other the other hand (from a layperson not familiar with poetry internals) seems more generally about dependency versions that hit this assertion. Regardless of the reason, the fact that poetry is bailing out of installation/locking with a bare assert and no information seems like the "bug" here, unless either case can be made to not fail at all.
Were the offending line instead:
# assert value is not None
if value is None:
raise RuntimeError(f"Resolution failure: {old_positive} and {assignment} cannot be reconciled")
I probably would have fiddled with my version constraints until it worked rather than even searching github issues.
A few notes:
I suspect if we remove this spurious ‘/‘ it will fix this bug
I did more debugging:
In vsphere setup.py we have the following:
setup(name='vsphere-automation-sdk',
version='1.86.0',
description='VMware vSphere Automation SDK for Python',
url='https://github.com/vmware/vsphere-automation-sdk-python',
author='VMware, Inc.',
license='MIT',
packages=[],
install_requires=[
'lxml >= 4.3.0',
'pyVmomi >=6.7',
'vapi-runtime @ file://localhost/{}/lib/vapi-runtime/vapi_runtime-2.44.0-py2.py3-none-any.whl'.format(os.getcwd()),
'vcenter-bindings @ file://localhost/{}/lib/vcenter-bindings/vcenter_bindings-4.2.0-py2.py3-none-any.whl'.format(os.getcwd()),
'vapi-common-client @ file://localhost/{}/lib/vapi-common-client/vapi_common_client-2.44.0-py2.py3-none-any.whl'.format(os.getcwd()),
'vmwarecloud-aws @ file://localhost/{}/lib/vmwarecloud-aws/vmwarecloud_aws-1.64.0-py2.py3-none-any.whl'.format(os.getcwd()),
'nsx-python-sdk @ file://localhost/{}/lib/nsx-python-sdk/nsx_python_sdk-4.1.2.0.0-py2.py3-none-any.whl'.format(os.getcwd()),
'nsx-policy-python-sdk @ file://localhost/{}/lib/nsx-policy-python-sdk/nsx_policy_python_sdk-4.1.2.0.0-py2.py3-none-any.whl'.format(os.getcwd()),
'nsx-vmc-policy-python-sdk @ file://localhost/{}/lib/nsx-vmc-policy-python-sdk/nsx_vmc_policy_python_sdk-4.1.2.0.0-py2.py3-none-any.whl'.format(os.getcwd()),
'nsx-vmc-aws-integration-python-sdk @ file://localhost/{}/lib/nsx-vmc-aws-integration-python-sdk/nsx_vmc_aws_integration_python_sdk-4.1.2.0.0-py2.py3-none-any.whl'.format(os.getcwd()),
'vmwarecloud-draas @ file://localhost/{}/lib/vmwarecloud-draas/vmwarecloud_draas-1.23.0-py2.py3-none-any.whl'.format(os.getcwd()),
]
)
So vmwarecloud-draas get setup as a requirement with an url looking like
vmwarecloud-draas @ file://localhost//home/user/.../lib/vmwarecloud-draas/vmwarecloud_draas-1.23.0-py2.py3-none-any.whl
Note the duplicate '/' on localhost//home
Here's a commit which remove this duplicate '/' so install can move forward and complete successfully.
https://github.com/bamiaux/poetry/commit/ab5825c805cb00d3d04f011aa13ee8dc074d3463
I'm not particularly pleased with this fix, maybe there is a more elegant solution
Description
Trying to install project with dependency to
/vsphere-automation-sdk-python
fails withAssertionError
.On an otherwise empty directory with the
pyproject.toml
provided below, thepoetry install
command failed.Workarounds
Use
venv
andpip
instead.Poetry Installation Method
pip
Operating System
Ubuntu 22.04
Poetry Version
Poetry (version 1.8.2)
Poetry Configuration
Python Sysconfig
No response
Example pyproject.toml
Poetry Runtime Logs