Skip to content

pip install “offline mode” #8057

@uranusjr

Description

@uranusjr

What's the problem this feature will solve?
I started wondering whether this is possible when reading #8043. When pip initialises an isolated build environment, it currently access package repositories to get the build tools. This can however be cumbersome when the user does not have Internet access.

Describe the solution you'd like
An --offline flag that makes pip use only the network cache to install things. This includes sdists, wheels, and also the index/find-links pages. This would solve the network-less bootstrapping problem as long as the user has installed all the build tools before (and has not cleared the cache). The flag would also need to be passed to PEP 517 hooks.

Alternative Solutions
Currently the user can use --no-index --find-links and point pip to the relevent wheels. But this needs the user to plan ahead and download the wheels. pip’s network cache does not expose the file names, and is not practically usable as a --fine-links source.

As a hack, the wheels of setuptools and wheel are actually available in stdlib’s ensurepip package. But this does not work with other PEP 517 backends.

Additional context
This probably needs some works with improving pip’s network cache, and might even be impossible (I haven’t poked at the cache implementation). But I feel this would be a good feature if it’s possible to implement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    UXUser experience relatedtype: feature requestRequest for a new feature

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions