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

PDM 2.12+ Error: AttributeError: 'PyProject' object has no attribute 'resolution_overrides' #21

Open
sh-shahrokhi opened this issue Jan 23, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@sh-shahrokhi
Copy link

sh-shahrokhi commented Jan 23, 2024

Hello,

Using plugin version 23.4.0 and pdm version 2.12.2 I get this error:

❯ pdm torch lock -v
Traceback (most recent call last):
  File "/home/.local/bin/pdm", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/.local/share/pipx/venvs/pdm/lib/python3.12/site-packages/pdm/core.py", line 288, in main
    return Core().main(args or sys.argv[1:])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/.local/share/pipx/venvs/pdm/lib/python3.12/site-packages/pdm/core.py", line 208, in main
    raise cast(Exception, err).with_traceback(traceback) from None
  File "/home/.local/share/pipx/venvs/pdm/lib/python3.12/site-packages/pdm/core.py", line 203, in main
    self.handle(project, options)
  File "/home/.local/share/pipx/venvs/pdm/lib/python3.12/site-packages/pdm/core.py", line 157, in handle
    command.handle(project, options)
  File "/home/env/.pdm-plugins/lib/python3.12/site-packages/pdm_plugin_torch/main.py", line 456, in handle
    results[api] = do_lock(
                   ^^^^^^^^
  File "/home/env/.pdm-plugins/lib/python3.12/site-packages/pdm_plugin_torch/main.py", line 153, in do_lock
    provider = get_provider(project, raw_sources, strategy)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/env/.pdm-plugins/lib/python3.12/site-packages/pdm_plugin_torch/main.py", line 93, in get_provider
    normalize_name(k): v for k, v in project.pyproject.resolution_overrides.items()
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'PyProject' object has no attribute 'resolution_overrides'

Contents of pyproject.toml:

[project]
name = "img"
version = "1.0"
description = "Default template for PDM package"
authors = [
    {name = "Sam", email = ""},
]
dependencies = [
    "ipykernel>=6.29.0",
    "statsmodels>=0.14.1",
    "scikit-learn>=1.4.0",
    "scikit-image>=0.22.0",
    "scikit-optimize>=0.9.0",
    "tensorflow>=2.15.0",
    "simpleitk>=2.3.1",
    "ipympl>=0.9.3",
    "seaborn>=0.13.1",
    "pandas>=2.2.0",
    "ordered-set>=4.1.0",
    "xarray>=2024.1.0",
    "numba>=0.58.1",
    "regex>=2023.12.25",
    "nvidia-cublas-cu12>=12.3.4.1",
    "nvidia-cuda-cupti-cu12>=12.3.101",
    "nvidia-cuda-nvcc-cu12>=12.3.107",
    "nvidia-cuda-nvrtc-cu12>=12.3.107",
    "nvidia-cuda-runtime-cu12>=12.3.101",
    "nvidia-cudnn-cu12>=8.9.7.29",
    "nvidia-cufft-cu12>=11.0.12.1",
    "nvidia-curand-cu12>=10.3.4.107",
    "nvidia-cusolver-cu12>=11.5.4.101",
    "nvidia-cusparse-cu12>=12.2.0.103",
    "nvidia-nccl-cu12>=2.19.3",
    "nvidia-nvjitlink-cu12>=12.3.101",
    "sympy>=1.12",
]
requires-python = "==3.11.*"
readme = "README.md"
license = {text = "MIT"}


[tool.pdm]
distribution = false
plugins = ["pdm-plugin-torch"]

[tool.pdm.plugin.torch]
dependencies = [
   "torch==2.1.2",
   "torchvision==0.16.2",
   "torchaudio==2.1.2"
]

lockfile = "torch.lock"
enable-cpu = false

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

Error seems to come from this commit:
pdm-project/pdm@6cbd113

Thank you!

@sh-shahrokhi sh-shahrokhi changed the title AttributeError: 'PyProject' object has no attribute 'resolution_overrides' PDM 2.12+ Error: AttributeError: 'PyProject' object has no attribute 'resolution_overrides' Jan 23, 2024
@tgolsson tgolsson added the bug Something isn't working label Jan 23, 2024
@tgolsson tgolsson self-assigned this Jan 23, 2024
@AdamBajger
Copy link

AdamBajger commented Feb 14, 2024

Same issue:

plugin version 23.4.0 and pdm version 2.12.3

Contents of pyproject.toml:

name = ""
version = "0.1.0"
description = ""
authors = []
requires-python = ">=3.11,<3.12"
readme = "README.md"
license = { file = "LICENSE" }


#####################################
# Dependencies
#####################################

dependencies = [
    "numpy>=1.26.2",
    "polars>=0.20.2",
    "pandas>=2.1.4",
    "scikit-learn>=1.3.2",
    "scipy>=1.11.4",
    "pyvips>=2.2.1",
    "torchmetrics>=1.2.1",
    "Pillow>=10.1.0",
    "tqdm>=4.66.1",
    "pytest>=7.4.3",
    "albumentations>=1.3.1",
    "lightning>=2.1.3",
    "omegaconf>=2.3.0",
    "hydra-core>=1.3.2",
    "mlflow>=2.9.2",
    "captum>=0.7.0",
    "gitpython>=3.1.40",
    "humanize>=4.9.0",
    "scikit-image>=0.22.0",
    "SlideLip @ git+ssh://git@private-repo.git",
    "report @ git+ssh://git@private-repo.git",
    "torch-kmeans>=0.2.0",
    "torchaudio>=2.1.2",
]

[tool.pdm.dev-dependencies]
dev = [
    "mypy",
    "pre-commit",
    "ruff",
    "jupyter>=1.0.0",
]
test = ["pytest", "pytest-cov"]


#####################################
# Scripts
#####################################

[tool.pdm.scripts]
train = "python -m histopipe.fit +experiment={args}"
eval = "python -m histopipe.test +experiment={args}"

l = { composite = ["lint", "format", "mypy"] }
test = "pytest tests"
lint = "ruff check ."
format = "ruff format ."
mypy = "mypy ."
post_install = { composite = [
    "pre-commit install",
    "pre-commit install --hook-type commit-msg",
    "pdm plugin add pdm-plugin-torch",
] }

#####################################
# Tool configuration
#####################################

[tool.pdm.plugin.torch]
dependencies = [
   "torch>=2.1.0",
]
lockfile = "torch.lock"
enable-cpu = false

enable-rocm = false
rocm-versions = ["4.2"]

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

[tool.coverage.run]
branch = true
omit = ["tests/*"]
source = ["."]
[... coverage, ruff, mypy and pytest setting]

@classner
Copy link

Same issue...

classner added a commit to classner/pdm-plugin-torch that referenced this issue Feb 26, 2024
classner added a commit to classner/pdm-plugin-torch that referenced this issue Feb 26, 2024
@sumowi
Copy link

sumowi commented Mar 8, 2024

update the api

# File "D:\ProtableAIPC\PortableApps\Pipx\venvs\pdm\lib\site-packages\pdm_plugin_torch\main.py", line 96, in get_provider
# normalize_name(k): v for k, v in project.pyproject.resolution_overrides.items()

# Update resolution_overrides to resolution in new release
    overrides = {
        normalize_name(k): v for k, v in project.pyproject.resolution.items()
    }

@kotoroshinoto
Copy link

after applying the above fix it was able to proceed.

There are some warnings about deprecated usages for other operations though.

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

No branches or pull requests

6 participants