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.

Installing dependencies but not app

See original GitHub issue

My current setup uses a requirements.txt which lists all my dependencies (and transitive dependencies), which I basically generate from pip-tools. To deploy my app, I do pip install -r requirements.txt then pip install -e ., to install the dependencies and the app, respectively.

What is great with this system is that it works correctly with Docker, caching the dependencies and keeping my builds very fast:

# This part will be cached, only reinstalling if I change the requirements
ADD requirements.txt ./
RUN pip install -r requirements.txt

# This part runs every time I change any of the app's code, but is fast because dependencies are installed
ADD setup.py app ./
RUN pip install -e .

I am not sure how to get this working with pipenv. If I install -e ./, my app appears in Pipfile, and there’s no way for me to install only the dependencies. If I don’t put my app in Pipfile, I need to copy all the dependencies from setup.py to Pipfile.

That makes the build for anyone using Docker hundreds of time slower, and is a huge barrier to Docker users moving to pipenv.


Expected result

Being able to use Pipfile in my Docker build.

Actual result

Build is made very slow by the fact I can’t cache installation of the dependencies.

Steps to replicate

This fails because . is not copied yet (it might even try to grab the app from Git):

ADD Pipfile Pipfile.lock ./
RUN pipenv install

I am not sure what’s a good fix for this, or if it’s high profile enough for pipenv devs to address. A way to install dependencies but not the app would solve this. A way to have Pipfile.lock list the dependencies from setup.py without having it list the app would be another way.

Anyone else using pipenv to build applications deployed via Docker?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:19 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
techalchemycommented, Apr 2, 2018

@remram44 how is this a terrible solution? Lock the dependency graph locally. Then remove your own package from the lockfile. Then copy your lockfile.

I can’t follow any aspect of your use case that would make this not work for you. Can you provide some output demonstrating exactly what you’re trying to do and why this doesn’t accomplish that?

1reaction
cholivercommented, Apr 1, 2018

Maybe I’m not understanding something, but why can’t you do pipenv install -e . ahead of time (i.e. so that everything’s tracked in Pipfile.lock), and then have your Dockerfile as something like:

ADD Pipfile Pipfile.lock setup.py ./
RUN pipenv install --deploy
ADD app ./
...

That way Docker caching still works, so long as you don’t change your deps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deploying app with dependency, dependency not installing
I am have created 2 applications with deployment types, one for R Library and the other one for R Studio. R Studio needs...
Read more >
Install dependencies from pyproject.toml but not the package
I have a python package that I want to install inside a docker file. pyproject.toml looks like:
Read more >
Deployment doesn't automatically install dependencies - fails
Hi, I'm tryiing to deploy a Nuxt.js app as a simple web service. ... “nuxt” is not found, because the dependencies are never...
Read more >
yarn install
Running yarn with no command will run yarn install , passing through any ... Install all the dependencies, but only allow one version...
Read more >
How to install only the dependencies of a package?
Or just install it and then remove the application (but not its dependencies). And/or install an updated/fixed package after building it.
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