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

Unable to export requirements.txt from unpinned dependencies (PySide6) #1730

Closed
1 task done
omars44 opened this issue Feb 21, 2023 · 0 comments · Fixed by j178/pdm#1
Closed
1 task done

Unable to export requirements.txt from unpinned dependencies (PySide6) #1730

omars44 opened this issue Feb 21, 2023 · 0 comments · Fixed by j178/pdm#1
Labels
🐛 bug Something isn't working 💝 good first issue Good for newcomers ❓ help wanted Extra attention is needed

Comments

@omars44
Copy link

omars44 commented Feb 21, 2023

Possibly related to: #1729

When trying to export requirements.txt with this dependency and no lock file, an exceptions is thrown

resolvelib.resolvers.RequirementsConflicted: Requirements conflict: NamedRequirement(name='PySide6', marker=None, extras=set(), specifier=<SpecifierSet('')>, editable=False, prerelease=False)

This however works normally when pinned:

dependencies = [
    "PySide6>=6.4.2",
]

pyproject.toml

[project]
name = 'example'
dynamic = ['version']
description = ''
authors = [
    {name = 'User', email = 'user@example.com'},
]
dependencies = [
    'PySide6'
]
requires-python = '>=3.9,<3.10'
license = {text = 'MIT'}

[project.optional-dependencies]
dev = [
    'mkdocs-material',
    'mkdocstrings',
    'mkdocstrings-python',
    'mkdocs-git-revision-date-plugin',
    'bump2version',
    'build'
]

[build-system]
requires = ['pdm-pep517']
build-backend = 'pdm.pep517.api'

[project.scripts]
pdm = 'pdm.core:main'

[tool.coverage.run]
branch = true
parallel = true
omit = [
  'example/__about__.py',
]

[tool.coverage.report]
exclude_lines = [
  'no cov',
  'if __name__ == .__main__.:',
  'if TYPE_CHECKING:',
]

[tool.mypy]
disallow_untyped_calls = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
check_untyped_defs = true
disallow_subclassing_any = true
warn_no_return = true
strict_optional = true
no_implicit_optional = true
disallow_any_generics = true
disallow_any_unimported = true
warn_redundant_casts = true
warn_unused_configs = true
show_traceback = true
always_true = 'MYPYC'


[tool.pytest]
testpaths='tests/'
  • I have searched the issue tracker and believe that this is not a duplicate.

Steps to reproduce

  1. create a an empty directory
  2. create the above pyproject.toml
  3. try to export to a requirements file
pdm export -v -o requirements.txt

Actual behavior

Requirements Conflict exception is thrown

pdm export -v -o requirements.txt
The exported requirements file is no longer cross-platform. Using it on other platforms may cause unexpected result.
STATUS: Resolving packages from lockfile...
Traceback (most recent call last):
  File "/home/user/.local/share/pdm/venv/lib/python3.9/site-packages/resolvelib/resolvers.py", line 372, in resolve
    self._add_to_criteria(self.state.criteria, r, parent=None)
  File "/home/user/.local/share/pdm/venv/lib/python3.9/site-packages/resolvelib/resolvers.py", line 173, in _add_to_criteria
    raise RequirementsConflicted(criterion)
resolvelib.resolvers.RequirementsConflicted: Requirements conflict: NamedRequirement(name='PySide6', marker=None, extras=set(), specifier=<SpecifierSet('')>, editable=False, prerelease=False)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/.local/bin/pdm", line 8, in <module>
    sys.exit(main())
  File "/home/user/.local/share/pdm/venv/lib/python3.9/site-packages/pdm/core.py", line 259, in main
    return Core().main(args)
  File "/home/user/.local/share/pdm/venv/lib/python3.9/site-packages/pdm/core.py", line 191, in main
    raise cast(Exception, err).with_traceback(traceback)
  File "/home/user/.local/share/pdm/venv/lib/python3.9/site-packages/pdm/core.py", line 186, in main
    f(project, options)
  File "/home/user/.local/share/pdm/venv/lib/python3.9/site-packages/pdm/cli/commands/export.py", line 71, in handle
    candidates = resolve_candidates_from_lockfile(
  File "/home/user/.local/share/pdm/venv/lib/python3.9/site-packages/pdm/cli/actions.py", line 142, in resolve_candidates_from_lockfile
    mapping, *_ = resolve(
  File "/home/user/.local/share/pdm/venv/lib/python3.9/site-packages/pdm/resolver/core.py", line 35, in resolve
    result = resolver.resolve(requirements, max_rounds)
  File "/home/user/.local/share/pdm/venv/lib/python3.9/site-packages/resolvelib/resolvers.py", line 521, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/home/user/.local/share/pdm/venv/lib/python3.9/site-packages/resolvelib/resolvers.py", line 374, in resolve
    raise ResolutionImpossible(e.criterion.information)
resolvelib.resolvers.ResolutionImpossible: [RequirementInformation(requirement=NamedRequirement(name='PySide6', marker=None, extras=set(), specifier=<SpecifierSet('')>, editable=False, prerelease=False), parent=None)]

Expected behavior

Either a complain about a missing lock file
or lock and then successfully produce the requirements.txt

Environment Information

pdm info && pdm info --env
PDM version:
  2.4.5
Python Interpreter:
  /usr/bin/python3 (3.9)
Project Root:
  /home/user/dev/python/example-cookiecutter/example
Project Packages:
  /home/user/dev/python/example-cookiecutter/example/__pypackages__/3.9
{
  "implementation_name": "cpython",
  "implementation_version": "3.9.2",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "5.10.0-21-rt-amd64",
  "platform_system": "Linux",
  "platform_version": "#1 SMP PREEMPT_RT Debian 5.10.162-1 (2023-01-21)",
  "python_full_version": "3.9.2",
  "platform_python_implementation": "CPython",
  "python_version": "3.9",
  "sys_platform": "linux"
}
@omars44 omars44 added the 🐛 bug Something isn't working label Feb 21, 2023
@frostming frostming added ❓ help wanted Extra attention is needed 💝 good first issue Good for newcomers labels Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working 💝 good first issue Good for newcomers ❓ help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants