Today I've got a problem with pipenv - Locking your Pipfile with pipenv. Check out how easy it is!

In the previous article about pipfile I've presented some key commands how to use this powerful yet effortless python management tool.

This time let's dive a bit further!

The case with problem.

Pipenv is a great tool, but in some cases it may fail in one or another way.

Today I had a bit of failure of this tool. But it was not pipenv fault. It was a more Pip and System dependencies problem.

To the point - I installed psycopg2 with Pipenv but forgot that it needs postgres-dev package at the system. It failed.

While it failed, Pipenv made a call and did not create Pipfile.lock - a lock file.

So immediatelly after I've realized what just happend, I've created a docker image ( Ha!) with a pipenv(1.0) and postgresql system dependency(2.0).

Then I've found that I could easily make it with pipenv lock which was incredible.

Pipenv locking

Pipfile.lock will be generated whenever you make :

  • pipenv install --dev
  • pipenv install [package-name]
  • pipenv uninstall [package-name]

One of the times when your Pipfile.lock may not be updated is - when the Pipfile has been changed, i.e. when you made some git - merging process and changed versions of packages in Pipfile.

Then you may need to refresh your Pipfile.lock because that changes are not reflected in Pipfile.lock.

To do that you will use pipenv lock - isn't it easy ?.



That's it :) Comment, share or don't :)

If you have any suggestions what I should blog about in the next articles - please give me a hint :)

See you in the next episode! Cheers!


comments powered by Disqus