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

Doesn't work with current pdm #12

Closed
mattiadg opened this issue Aug 14, 2023 · 6 comments
Closed

Doesn't work with current pdm #12

mattiadg opened this issue Aug 14, 2023 · 6 comments

Comments

@mattiadg
Copy link

Hi,
thank you for developing this useful plugin.
I was wondering if there are plans to make it work with the current version of pdm. I also tried using the code from the open PR but still getting missing required argument config_prefix.

I would be happy to help if it would be useful.

@tgolsson
Copy link
Member

tgolsson commented Aug 14, 2023

Hey @mattiadg! I did a PR for this pre-vacation but haven't merged it yet. I'll try to get a release out this week! #11. Of course, 2.8 is out since then, but I think the specific one you see is fixed.

If you can try the branch on 2.8 and see if it works for you I'd be very happy to mark 2.8 supported too.

@danielphan2003
Copy link

I tried v23.2.0 on PDM v2.7.4 and it works, but anything later than that breaks with this error:

pdm.exceptions.CandidateNotFound: No candidate is found for `torch` that matches the environment or hashes
<omitted for brevity>
unearth.evaluator: Skipping link : none of the wheel tags(cp39-none-macosx_10_9_x86_64) are compatible
unearth.evaluator: Skipping link : none of the wheel tags(cp39-none-macosx_11_0_arm64) are compatible
unearth.evaluator: Skipping package Package(name='torch', version='2.1.0'): version doesn't match ==2.0.1+cu118
unearth.evaluator: Skipping package Package(name='torch', version='2.0.1'): version doesn't match ==2.0.1+cu118
unearth.evaluator: Skipping package Package(name='torch', version='2.0.0'): version doesn't match ==2.0.1+cu118
unearth.evaluator: Skipping package Package(name='torch', version='1.13.1'): version doesn't match ==2.0.1+cu118
unearth.evaluator: Skipping package Package(name='torch', version='1.13.0'): version doesn't match ==2.0.1+cu118
pdm.termui: Error occurs: 
Traceback (most recent call last):
  File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/danie/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/installers/synchronizers.py", line 304, in update_candidate
    self.manager.install(can)
  File "/home/danie/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/installers/manager.py", line 33, in install
    installer(str(prepared.build()), self.environment, prepared.direct_url())
                  ^^^^^^^^^^^^^^^^
  File "/home/danie/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/models/candidates.py", line 381, in build
    self.obtain(allow_all=False)
  File "/home/danie/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/models/candidates.py", line 422, in obtain
    raise CandidateNotFound(
pdm.exceptions.CandidateNotFound: No candidate is found for `torch` that matches the environment or hashes
pdm.termui: Error occurs
Traceback (most recent call last):
  File "/home/danie/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/termui.py", line 239, in logging
    yield logger
  File "/home/danie/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm_plugin_torch/main.py", line 257, in do_sync
    handler.synchronize()
  File "/home/danie/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/installers/synchronizers.py", line 451, in synchronize
    raise InstallationError("Some package operations are not complete yet")
pdm.exceptions.InstallationError: Some package operations are not complete yet

@tgolsson
Copy link
Member

tgolsson commented Oct 4, 2023

Hmm. Can you share the full config you're using? This sounds like an upstream bug but I would like to validate that before I go bother them.

@danielphan2003
Copy link

danielphan2003 commented Oct 4, 2023

For reproducing the error, I'm following PDM's other installation methods via pyprojectx.

Here is my pyproject.toml:

[tool.pdm]

[project]
name = ""
version = ""
description = ""
authors = [
    {name = "danielphan2003"},
    {name = "Daniel Phan", email = "[email protected]"},
]
dependencies = []
requires-python = ">=3.11"
license = {text = "MIT"}
readme = "README.md"

[tool.pdm.scripts]
post_install = "pdm plugin add pdm-plugin-torch==23.2.0"

[tool.pdm.plugins.torch]
dependencies = [
   "torch==2.0.1"
]
enable-cpu = true

enable-cuda = true
cuda-versions = ["cu118"]


[tool.pyprojectx]
pdm = "pdm==2.9.3"

# commonly used tools
#black = "black"
#isort = "isort"
#pylint = "pylint"
#pre-commit = "pre-commit"
#jupyter = ["jupyter", "."]

[tool.pyprojectx.aliases]
install = "pdm install"
run = "pdm run"
outdated = "pdm update --outdated"
test = "pdm run pytest"

# example aliases
#clean = "rm -rf .venv .pytest_cache dist"
#clean-all = "pw@ clean && rm -rf .pyprojectx"
#black = "black src tests"
#isort = "isort src tests"
#check-pylint = "pylint src tests"
#check-black = "black src tests --check"
#check = "pw@ check-black && pw@ check-pylint && pw@ test"
#build = "pw@ install && pw@ check && pw@ pdm build"
#notebook = "jupyter notebook -y"

[tool.pyprojectx.os.win.aliases]
# example os specific aliases
#clean = "rmdir /s/q .venv .pytest_cache dist"
#clean-all = "pw@ clean & rmdir /s/q .pyprojectx"

My exact commands were:

curl -LO https://github.com/pyprojectx/pyprojectx/releases/latest/download/wrappers.zip && unzip wrappers.zip && rm -f wrappers.zip
./pw --init pdm
./pw pdm install
./pw pdm torch lock
./pw pdm torch install cu118

@tgolsson
Copy link
Member

tgolsson commented Oct 4, 2023

Thanks, added it to our backlog and will try to look soon. I'm eyeing pdm-project/pdm#2102 if it stopped working between 2.7.4 and 2.8.0, but there might be some changed API we're now misusing.

@tgolsson
Copy link
Member

This is ~sort of fixed in the next release, hopefully made this afternoon. Unfortunately the fix doesn't work due to pdm-project/pdm#2151 only being available in 2.9, so PDM 2.8 can't be supported without a lot of work.

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

No branches or pull requests

3 participants