question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:open
  • Created 4 years ago
  • Reactions:28
  • Comments:12

github_iconTop GitHub Comments

10reactions
nikolaikopernikcommented, Oct 9, 2021

Hey @python-poetry Can we think along of a solution here? What I have in mind now is 2 changes:

$ poetry download 
# downloads all the dependencies from the `lock` file (without any modification) to a local 
# folder inside the project (for instance `.locked` - like a project-level cache). If it is 
# possible to copy them from the local cache - they will be just copied into this local folder 
# without downloading. 

$ poetry install --offline  
# will try to install all the dependencies from the lock file without any external connections 
# (using local project cache or machine cache only). If there are not enough libs available 
# locally the installation will fail and won't install anything. 

@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.

4reactions
Kaiser1989commented, Jun 24, 2022

Currently i’m doing this:

poetry export > requirements.txt
poetry run pip download -r requirements.txt -d <lib_folder>
poetry run pip Install -r requirements.txt --no-index --find-links <lib_folder>

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 instance

poetry run python -m pytest -s

But 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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Poetry installation for offline machine - Dmitry Labazkin
How to install Poetry to machine without internet. ... installing poetry offline with new installer for the current Poetry implementation.
Read more >
Can Poetry download dependencies when building a wheel ...
Can Poetry download dependencies when building a wheel for offline installation? Ask Question. Asked 1 year, 2 months ago. Modified 7 months ago....
Read more >
Introduction | Documentation | Poetry - Python dependency ...
We provide a custom installer that will install Poetry in a new virtual environment to isolate it from the rest of your system....
Read more >
Download RPMs and their dependencies for an offline use
You will need to install it first but once installed will allow you to perform the following to download the RPM's and their...
Read more >
Installing — Basemap Matplotlib Toolkit 1.2.1 documentation
When building from source, must be built and installed separately from basemap (see build instructions below). Included in Windows binary installers.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found