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

I can't install ctranslate2 with PDM #1690

Closed
1 task done
nickchomey opened this issue Feb 8, 2023 · 1 comment · Fixed by j178/pdm#1
Closed
1 task done

I can't install ctranslate2 with PDM #1690

nickchomey opened this issue Feb 8, 2023 · 1 comment · Fixed by j178/pdm#1
Labels
🐛 bug Something isn't working

Comments

@nickchomey
Copy link

nickchomey commented Feb 8, 2023

  • I have searched the issue tracker and believe that this is not a duplicate.

Make sure you run commands with -v flag before pasting the output.

Steps to reproduce

pdm add ctranslate2

Actual behavior

It tries to install v 1.20.1 even though v.3.4.0 is the latest. There arent' any other packages installed in this freshly-initialized project.

Adding packages to default dependencies: ctranslate2
🔒 Lock successful
Changes are written to pdm.lock.
Changes are written to pyproject.toml.
Synchronizing working set with lock file: 1 to add, 0 to update, 0 to remove

  ✖ Install ctranslate2 1.20.1 failed
Retry failed jobs
  ✖ Install ctranslate2 1.20.1 failed

ERRORS:
add ctranslate2 failed:
Traceback (most recent call last):
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/nick/.local/share/pdm/venv/lib/python3.10/site-packages/pdm/installers/synchronizers.py", line 236, in install_candidate
    self.manager.install(can)
  File "/home/nick/.local/share/pdm/venv/lib/python3.10/site-packages/pdm/installers/manager.py", line 39, in install
    installer(str(prepared.build()), self.environment, prepared.direct_url())
  File "/home/nick/.local/share/pdm/venv/lib/python3.10/site-packages/pdm/models/candidates.py", line 363, in build
    self.obtain(allow_all=False)
  File "/home/nick/.local/share/pdm/venv/lib/python3.10/site-packages/pdm/models/candidates.py", line 415, in obtain
    raise CandidateNotFound(
pdm.exceptions.CandidateNotFound: No candidate is found for `ctranslate2` that matches the environment or hashes

If I specify v3.4.0 in pyproject.toml, this shows:

Updating the lock file...
🔒 Lock failed
Unable to find a resolution because the following dependencies don't work on all Python versions defined by the project's `requires-python`: >=3.10.
  python>=3.7,<3.12 (from <Candidate [email protected] from https://pypi.org/simple/ctranslate2/>)
To fix this, you can change the value of `requires-python` in pyproject.toml.
See /home/nick/tmp/pdm-lock-m31emvfc.log for detailed debug log.
[ResolutionImpossible]: Unable to find a resolution

and this is what is in the error log

  python>=3.7,<3.12 (from [email protected])
pdm.termui: Error occurs
Traceback (most recent call last):
  File "/home/nick/.local/share/pdm/venv/lib/python3.10/site-packages/pdm/termui.py", line 240, in logging
    yield logger
  File "/home/nick/.local/share/pdm/venv/lib/python3.10/site-packages/pdm/cli/actions.py", line 117, in do_lock
    raise ResolutionImpossible("Unable to find a resolution") from None
resolvelib.resolvers.ResolutionImpossible: Unable to find a resolution

Expected behavior

I expect to be able to install the package

Environment Information

# Paste the output of `pdm info && pdm info --env` below:
PDM version:
  2.4.3
Python Interpreter:
  /home/nick/zxcv/zxcv/.venv/bin/python (3.10)
Project Root:
  /home/nick/zxcv/zxcv
Project Packages:
  None
{
  "implementation_name": "cpython",
  "implementation_version": "3.10.6",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "5.15.79.1-microsoft-standard-WSL2",
  "platform_system": "Linux",
  "platform_version": "#1 SMP Wed Nov 23 01:01:46 UTC 2022",
  "python_full_version": "3.10.6",
  "platform_python_implementation": "CPython",
  "python_version": "3.10",
  "sys_platform": "linux"
}
@nickchomey nickchomey added the 🐛 bug Something isn't working label Feb 8, 2023
@nickchomey
Copy link
Author

nickchomey commented Feb 8, 2023

The issue is that CTranslate2 has python_requires=">=3.7,<3.12", and, by default, PDM only sets requires-python = ">=3.x" when you use pdm init or pdm use.

There's a lengthy debate about the matter here - https://discuss.python.org/t/requires-python-upper-limits/12663/

I'm not at all qualified to make a ruling on the matter, but perhaps PDM could implement some sort of mechanism for dealing with this?

A couple ideas:

  1. give us a prompt to set an upper bound for python-requires
  2. have an automated mechanism that will start rolling back the maximum python version that is in use in the project, bounded by what we've set as the minimum version. So, CTranslate2 wants 3.7<= version < 3.12 and PDM starts as 3.x <= version <4.0. When that fails, the 4.0 upper bound could be iterated downwards towards 3.x until it satisfies <3.12. The result, in my case, would be python-requires = ">=3.10, <3.12 rather than what is implicitly set behind the scenes as python-requires = ">=3.10, <4.0"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant