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 is significantly slower than Poetry for installing dependency libraries. #2796

Open
1 task done
lucidfrontier45 opened this issue Apr 11, 2024 · 5 comments
Open
1 task done
Labels
🐛 bug Something isn't working

Comments

@lucidfrontier45
Copy link

lucidfrontier45 commented Apr 11, 2024

  • 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

  1. mkdir pdm_test and poetry_test and copy the corresponding pyproject.toml there.
  2. in pdm_test run pdm install --no-self
  3. remove .venv and then run pdm sync --no-self
  4. in poetry_test run poetry install --no-root
  5. remove .venv and then run poetry install --sync --no-self

pyproject.toml for PDM

[project]
name = "pdm_test"
version = "0.1.0"
description = "Default template for PDM package"
dependencies = [
    "numpyro>=0.14.0",
    "polars>=0.20.19",
    "jaxtyping>=0.2.28",
    "jpholiday>=0.1.9",
    "joblib>=1.4.0",
    "pyyaml>=6.0.1",
    "pydantic>=2.6.4",
    "typer>=0.12.3",
]
requires-python = ">=3.11"

[tool.pdm]
distribution = false

[tool.pdm.dev-dependencies]
dev = [
    "ruff>=0.3.5",
    "black>=24.3.0",
    "pyright>=1.1.358",
    "pytest-cov>=5.0.0",
    "ipykernel>=6.29.4",
    "matplotlib>=3.8.4",
]

pyproject.toml for Poetry

[tool.poetry]
name = "poetry-test"
version = "0.1.0"
description = ""
authors = []

[tool.poetry.dependencies]
python = "^3.11"
numpyro = "^0.14.0"
polars = "^0.20.19"
jaxtyping = "^0.2.28"
jpholiday = "^0.1.9"
joblib = "^1.4.0"
pyyaml = "^6.0.1"
pydantic = "^2.6.4"
typer = "^0.12.3"

[tool.poetry.group.dev.dependencies]
ruff = "^0.3.5"
black = "^24.3.0"
pyright = "^1.1.358"
pytest-cov = "^5.0.0"
ipykernel = "^6.29.4"
matplotlib = "^3.8.4"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

Actual behavior

  • PDM without lockfile: 1m42s
  • PDM with lockfile: 1m20s
  • Poetry without lockfile: 18s
  • Poetry with lockfile: 4s

Expected behavior

PDM cases take as long as equivalent Poetry cases.

Environment Information

# Paste the output of `pdm info && pdm info --env` below:

❯ pdm info
INFO: Virtualenv /mnt/data/du/workspace/pdm_test/.venv is reused.
PDM version:
  6.13.3
Python Interpreter:
  /mnt/data/du/workspace/pdm_test/.venv/bin/python (3.11)
Project Root:
  /mnt/data/du/workspace/pdm_test
Local Packages:

❯ pdm info --env
{
  "implementation_name": "cpython",
  "implementation_version": "3.11.2",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "5.15.133.1-microsoft-standard-WSL2",
  "platform_system": "Linux",
  "platform_version": "#1 SMP Thu Oct 5 21:02:42 UTC 2023",
  "python_full_version": "3.11.2",
  "platform_python_implementation": "CPython",
  "python_version": "3.11",
  "sys_platform": "linux"
}

❯ poetry -V
Poetry (version 1.8.2)
@lucidfrontier45 lucidfrontier45 added the 🐛 bug Something isn't working label Apr 11, 2024
@lucidfrontier45 lucidfrontier45 changed the title PDM is significantly slower compared to Poetry for installing dependency libraries. PDM is significantly slower than Poetry for installing dependency libraries. Apr 11, 2024
@deronnax
Copy link
Sponsor Contributor

deronnax commented Apr 11, 2024

I already noticed the same thing while experimenting. A ran a quick test with the PEP 621 branch of Poetry on our biggest project with 185 final dependencies (meaning, present in the lock file): with lock file already generated, 2m37 install time of PDM and... 8 seconds for Poetry. Lock time is also faster: without cache, 2m37 for PDM, 40s for Poetry. With cache, 1m25 for PDM, 22s for Poetry.

@noirbizarre
Copy link
Member

I would like to work a bit on improving performances.
Would mind sharing the lockfile ?

@deronnax
Copy link
Sponsor Contributor

You can take this one, it's very similar to what we have in our CI

@huxuan
Copy link
Contributor

huxuan commented Apr 16, 2024

Seems we can also use the dependencies here [1], as it is also mentioned in pdm's documentation [2].

[1] https://github.com/lincolnloop/python-package-manager-shootout
[2] https://pdm-project.org/latest/dev/benchmark/

@SealedServant
Copy link

I wonder if uv could be used in place of unearth for package downloading. It's supposed to be blazing fast.

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

5 participants