pdm-project / pdm

A modern Python package and dependency manager supporting the latest PEP standards
https://pdm-project.org
MIT License
7.97k stars 409 forks source link

The install cache is invalid and the package cannot be installed through the cache. #3310

Open AboutDark opened 5 days ago

AboutDark commented 5 days ago

Describe the bug

Using the pdm add command will re-download the installed package. The cache does not work properly.

To reproduce

pdm add requests

Expected Behavior

The corresponding version of the requests package is installed through the cache instead of re-downloading.

Environment Information

PDM version: 2.20.1 Python Interpreter: venv\Scripts\python.exe (3.12) Project Root: pdmtest Local Packages:

{ "implementation_name": "cpython", "implementation_version": "3.12.0", "os_name": "nt", "platform_machine": "AMD64", "platform_release": "11", "platform_system": "Windows", "platform_version": "10.0.22631", "python_full_version": "3.12.0", "platform_python_implementation": "CPython", "python_version": "3.12", "sys_platform": "win32" }

pdm -v output

PDM, version 2.20.1

Additional Context

No response

Are you willing to submit a PR to fix this bug?

frostming commented 3 days ago

all downloadings are also cached, I don't see what is not working.

AboutDark commented 1 day ago

The installed packages are indeed cached. When I use the add command again, these cached packages are not read. They will still be downloaded and installed again through the network. This will cause a lot of network overhead.

frostming commented 22 hours ago

They will still be downloaded and installed again through the network. This will cause a lot of network overhead.

Can you confirm that? The HTTP responses are cached so it won't consult the internet even it appears so.

AboutDark commented 13 hours ago

The http response cache doesn't seem to be working properly. Can you help me check if there is a problem with my configuration?

build_isolation = True cache_dir = C:*\pdm\pdm\Cache check_update = True global_project.fallback = False global_project.fallback_verbose = True global_project.path = C:*\pdm\pdm\global-project global_project.user_site = False install.cache = False install.cache_method = symlink install.parallel = True log_dir = C:*\pdm\pdm\Logs pypi.ignore_stored_index = False pypi.json_api = False pypi.url = https://pypi.org/simple pypi.verify_ssl = True python.install_root = C:*\pdm\pdm\python python.providers = ['venv', 'path', 'asdf', 'pyenv', 'rye', 'winreg', 'macos'] python.use_pyenv = True python.use_venv = True request_timeout = 15 strategy.inherit_metadata = True strategy.resolve_max_rounds = 10000 strategy.save = minimum strategy.update = reuse theme.error = red theme.info = blue theme.primary = cyan theme.req = bold green theme.success = green theme.warning = yellow use_uv = False venv.backend = virtualenv venv.in_project = True venv.location = C:*****\pdm\pdm\venvs venv.prompt = {project_name}-{python_version} venv.with_pip = False

Home configuration (C:*****\pdm\pdm\config.toml): cache_dir = D:\pdm\Cache install.cache = True

AboutDark commented 13 hours ago

I modified the code in my local environment and the package cache has been restored to work. However, the http response is not working properly yet.