What Is Wrong With the Local Cache
pip detected that its cache directory is owned by a different user (often because pip was previously run with sudo), so it disables caching for safety.
The upstream service may be fine. This is usually about bad local cache state getting in the way of an otherwise normal install or download.
Fix cache ownership or stop reusing a root-owned cache
Preferred: stop using sudo pip ... and use a venv instead, fix the ownership/permissions of the pip cache directory to match your user (exact command varies by OS and policy), and as a temporary workaround, bypass caching with python -m pip install --no-cache-dir ....
Manual cache permission checks
Find the cache directory with python -m pip cache dir, check ownership with ls -la ~/.cache/pip (and parent directories), and check whether you previously used sudo pip ... in this environment.
Why the Cache State Is Bad
Usually this comes down to pip was run with sudo and created root-owned cache directories in your home path, a shared home directory was modified by another user account, or permissions were changed by a system hardening step or file restore.
Verify the Cache Path Is Healthy Again
Re-run pip and confirm the cache warning no longer appears, and run python -m pip install <package> and confirm installs proceed normally.
Why pip disables an unsafe cache
This is the part worth understanding if the quick fix did not hold. It explains what pip is trying to do at the moment the error appears.
pip uses a cache directory to speed up installs and reduce network downloads. If that directory is owned by another user, using it can be unsafe (permission errors, or writing files as the wrong user).
pip disables the cache and prints instructions to fix ownership or sudo -H behavior.
Prevent Local State Drift
To prevent this, use venvs so you never need sudo for pip installs, in CI, set an explicit cache directory (PIP_CACHE_DIR) owned by the job user, and avoid sharing one cache directory across multiple Unix users.
Examples
The directory '/home/user/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Docs and source code
github.com/pypa/pip/blob/25.3/src/pip/_internal/cli/base_command.py
pip disables caching if the configured cache directory is not owned (or not writable) by the current user, it also suggests sudo -H when relevant. - GitHub
if options.cache_dir:
options.cache_dir = normalize_path(options.cache_dir)
if not check_path_owner(options.cache_dir):
logger.warning(
"The directory '%s' or its parent directory is not owned "
"or is not writable by the current user. The cache "
"has been disabled. Check the permissions and owner of "
"that directory. If executing pip with sudo, you should "
"use sudo's -H flag.",
options.cache_dir,
)
options.cache_dir = None