Enable offline installations: poetry install --download-only; poetry install --offline
See original GitHub issue- I have searched the issues of this repo and believe that this is not a duplicate.
- I have searched the documentation and believe that my question is not covered.
Motivation
After poetry has resolved the dependencies and written the lock file, it proceeds to download and install the dependencies one by one. This could be a problem for systems which are not containerized and just checkout a repo and update their dependencies to update the code. If the internet connection breaks in the middle of the process neither the old code or the new code are fully deployed.
Feature Request (simple)
A --download-then-install
flag that would make poetry first download all the dependencies and then proceed to install the already downloaded dependencies could solve this use case.
The use would simply be:
poetry install --download-then-install
If any of the required dependencies could not be downloaded, poetry should not attempt to install neither remove anything and just fail. If all required dependencies had been downloaded successfully, then the installation / removal / updates are preformed using only the information in the local filesystem.
Feature Request (robust)
A combination of flags to separate both processes could also work, such as:
poetry install --download-only # Only downloads the dependencies
poetry install --offline # Installs dependencies only if all dependencies are in the local cache.
These command would be used in succession and the flags are exclusive. poetry install --offline
should first look at the contents of the poetry.lock
file to make sure the packages are stored in the local filesystem before performing the installation / removal / update.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:28
- Comments:12
Hey @python-poetry Can we think along of a solution here? What I have in mind now is 2 changes:
@roniemartinez It’s not enough to have local cache per machine, because then we mix all the dependencies from different projects. If I want to copy my project with all just my dependencies I don’t want to copy the entire my cache folder. Although we can use it and do not download what’s already been downloaded.
Another point that I miss now in poetry is offline installation. This will allow ship my project with all the dependencies anywhere and create the proper environment there.
So I think these 2 changes can bring some very useful features.
Currently i’m doing this:
With this packages are only installed within the correct Environment.
But with this, i’m not able to run pytest, getting ModuleNotFoundError. Seems that poetry has some additional environment?I can call tests by running pytest from poetry’s python instanceBut still having some issues, as i have relative dependencies within my poetry project. These relative dependencies are not resolved by pip and the requirements.txt