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

Specific pip cache location environment variables #13043

Closed
1 task done
zerothi opened this issue Oct 25, 2024 · 6 comments
Closed
1 task done

Specific pip cache location environment variables #13043

zerothi opened this issue Oct 25, 2024 · 6 comments
Labels
type: docs Documentation related type: support User Support

Comments

@zerothi
Copy link

zerothi commented Oct 25, 2024

What's the problem this feature will solve?

On HPC systems, or educational systems where a large number of users are using pip to install packages.
For course specific guides, they tend to install the same packages, and thus has a huge number of duplicated cached wheels located in their respective home folders.

Additionally on HPC systems, one will have a backup of the HOME folders which contains the necessary folders. However, backing up a pip cache seems irrelevant (configuring the backup to disable this folder could be done, but annoying).

Describe the solution you'd like

I would like an environment variable that governs the place of the cache (on HPC facilities this could be specified as a default sourced script.

I would propose the name:

PIP_CACHE_HOME

to match the XDG_CACHE_HOME naming convention.

It is clear that XDG_CACHE_HOME is not a good idea to change, since we don't want to alter other programs cache locations.

Alternative Solutions

We have played with the thought of using the /etc/pip.conf for this:

[global]
cache-dir = /glorious/cache

however, it isn't clear how to easily remove a variable using configuration files?

I.e. how can a user disable the cache-dir to just use the XDG_CACHE_HOME variable instead?

[global]
cache-dir = <what to put here to clear it>

Additional context

Nothing to add.

Code of Conduct

@zerothi zerothi added S: needs triage Issues/PRs that need to be triaged type: feature request Request for a new feature labels Oct 25, 2024
@notatallshaw
Copy link
Member

notatallshaw commented Oct 25, 2024

Does PIP_CACHE_DIR not already work?

@zerothi
Copy link
Author

zerothi commented Oct 25, 2024

Does PIP_CACHE_DIR not already work?

Ha, I totally missed that option, thanks!!!

Clearly looking in the wrong places of the documentation.

@zerothi zerothi closed this as completed Oct 25, 2024
@notatallshaw
Copy link
Member

Every pip option in the config (like cache-dir) has an associated environmentable variable as PIP_<UPPER_LONG_NAME>: https://pip.pypa.io/en/stable/topics/configuration/#environment-variables

I would honestly like these all spelt out explicitly in the docs for better SEO, but that's a seperate issue.

@zerothi
Copy link
Author

zerothi commented Oct 25, 2024

Yes, that top line in that particular section was exactly what I was missing.

I would suggest that section only has:

pip’s command line options can be set with environment variables using the format PIP_<UPPER_LONG_NAME> . 

* Dashes (-) have to be replaced with underscores (_).
* Repeateable options (like ``--verbose``) requires integers as options

with less content it is more likely to see the PIP_<UPPER_LONG_NAME> phrase above. I saw the item list and expected that to contain all available options.

Otherwise just an entry in the list that says PIP_<UPPER_LONG_NAME> would also work, because that clarifies its association with the CMD.

My 2 cents.

Thanks again.

@notatallshaw notatallshaw added type: docs Documentation related type: support User Support and removed type: feature request Request for a new feature S: needs triage Issues/PRs that need to be triaged labels Oct 25, 2024
@notatallshaw
Copy link
Member

Well, pip is a volunteer project, so doc improvement PRs are usually quite welcome.

@zerothi
Copy link
Author

zerothi commented Oct 27, 2024

@notatallshaw, done, see #13050.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: docs Documentation related type: support User Support
Projects
None yet
Development

No branches or pull requests

2 participants