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.

a way to tell that the virtualenv and Pipfile.lock are in sync?

See original GitHub issue

Ran the following

pipenv run ...
Creating a virtualenv for this project…
Using /usr/bin/python2.7 to create virtualenv…
⠋Running virtualenv with interpreter /usr/bin/python2.7
New python executable in /home/user/.virtualenvs/...-RVyaMy2x/bin/python2.7
Also creating executable in /home/user/.virtualenvs/...-RVyaMy2x/bin/python
Installing setuptools, pip, wheel...done.
...
ImportError: No module named yaml
Describe your environment
  1. Ubuntu 16.04
  2. Python 2.7.12
  3. pipenv, version 8.3.2
Expected result

Expected one of the following:

  1. Automatically install dependencies when pipenv run ... is called and all dependencies aren’t in the virtualenv
  2. Add optional flag to do 1
  3. Add command to test if dependencies are installed so that I can run pipenv install before running pipenv run ... (as it stands now, pipenv install is fairly time consuming so I don’t want to run it unconditionally)
  4. Modify pipenv check to check if all dependencies are installed and correct

I can try to make this change, just wanted to make sure it’s something that you’d be okay merging.

Actual result

Virtualenv was installed but packages were not.

Steps to replicate

Run pipenv run ... on a python file with Pipfile.lock present, without running pipenv install first.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:19 (12 by maintainers)

github_iconTop GitHub Comments

13reactions
kennethreitzcommented, Nov 22, 2017

i don’t care what your expectation is, i’m closing it. thank you — it has been noted, as i said 😃

7reactions
nfishercommented, Mar 9, 2018

It would be super useful for speeding up CI builds if sync had a flag to exit if everything is in sync. A lot of SaaS CI platforms include code caches such as Travis, AWS codebuild, Bitbucket Pipelines, etc. The code cache is restored at the beginning of a run and if the dependencies didn’t require updates it could shave 30s or more off of the build.

As it is pipenv sync --dev takes about 30s with a private build. It contains 100 or so deps in total. If pipenv verify (or whatever) had a return code of 1 on “out of sync” and 0 when it’s “in sync”.

Basically it would allow me to write something like this;

pipenv verify --dev
if [ $? -eq 1 ]; then
pipenv sync --dev
fi

If pipenv did the above internally that would be even better!

I will look at doing a diff between pipenv lock -r and pip freeze in the interim.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to know if a virtualenv requires a sync in order to avoid ...
Currently pipenv doesn't provide a method to check if the existing virtualenv matches the Pipfile.lock it relates to.
Read more >
Advanced Usage of Pipenv - Read the Docs
lock is out–of–date, instead of generating a new one. Or you can install packages exactly as specified in Pipfile.lock using the sync command:....
Read more >
Basic Usage of Pipenv - Python Packaging Authority
--system — Use the system pip command rather than the one from your virtualenv. --deploy — Make sure the packages are properly locked...
Read more >
pipenv Documentation - Read the Docs
PIPENV FEATURES​​ Generates and checks file hashes for locked dependencies when installing from Pipfile. lock. Automatically install required Python version when ...
Read more >
Common Pipenv Errors and How to Solve Them: Why Won't it ...
Locking Issue: Pipfile Contains a Reference to an Inexistent Package ... Pipfile won't lock when it tries to install packages that don't exist,...
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