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

pip version check file doesn't honor cache-dir #3905

Closed
nehaljwani opened this issue Aug 11, 2016 · 5 comments · Fixed by #5419
Closed

pip version check file doesn't honor cache-dir #3905

nehaljwani opened this issue Aug 11, 2016 · 5 comments · Fixed by #5419
Labels
auto-locked Outdated issues that have been locked by automation good first issue A good item for first time contributors to work on type: enhancement Improvements to functionality

Comments

@nehaljwani
Copy link
Contributor

nehaljwani commented Aug 11, 2016

  • Pip version: 7.1.0
  • Python version: 2.7.6
  • Operating System: Fedora 22

My pip config looks like:

[dev@machine ~] $ cat ~/.config/pip/pip.conf 
[global]
cache-dir=/ssd/dev/.pip/cache

Whenever I try to install any package, it caches the wheels in the cache-dir as specified above. However, the pip-version check is performed and the file selfcheck.json and it's lock file is placed in the directory: $HOME/.cache/pip/ , which should have been inside the cache-dir as specified above.

I get around this problem by specifying the following in the pip config (but it's not a very good solution):

disable-pip-version-check=true
@pradyunsg pradyunsg added type: enhancement Improvements to functionality good first issue A good item for first time contributors to work on labels Jun 29, 2017
@tomfbiz
Copy link
Contributor

tomfbiz commented May 16, 2018

I'm at PyCon sprints, researching this before making changes.

I was able to recreate this issue using the latest pip (10.0.1)

Looking in the code, I found that in pip._internal.utils.outdated there are two classes that write out the selfcheck.json file.

For users not in virtual environmnets
pip._internal.utils.outdated.GlobalSelfCheckState puts selfcheck.json in the directory specified in USER_CACHE_DIR
For users in virtual environments
pip._internal.utils.outdated.VirtualenvSelfCheckState puts pip-selfcheck.json in the directory specified in sys.prefix

I am not certain if we would want to change this for both scenarios or just for users not in virtual environments.

From looking at the code, it looks like the change would be as follows:

pip._internal.utils.outdated.pip_version_check has access to to the configured cache directory in options.cache_dir
To fix the problem, this value could be passed through as an argument into pip._internal.utils.outdated.load_selfcheck_state and from there into pip._internal.utils.outdated.GlobalSelfCheckState.__init__
And possibly into pip._internal.utils.outdated.VirtualenvSelfCheckState.__init_

@pradyunsg
Copy link
Member

Hey @tomfbiz! Are you on IRC?

@dstufft
Copy link
Member

dstufft commented May 16, 2018

Quick look suggests we can kill the virtual env file completely, and just use the per user cache file for all environments, and then plumb the cache-dir file through appropriately.

Does that answer your question?

@pradyunsg
Copy link
Member

Noting here that we (mostly @dstufft, @tomfbiz :P) had a discussion on IRC and we're likely simply removing the virtualenv specific file.

@lock
Copy link

lock bot commented Jun 2, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 2, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation good first issue A good item for first time contributors to work on type: enhancement Improvements to functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants