Founder and CEO, ConnectDome. Founder, DomeCode. I also produce music apart from coding and managing a startup.
Yeah, you read that right. I actually think that pipenv is better than venv for there are multiple reasons and a whole lot of thought behind it.
Tl;Dr: Use pipenv for better compatibility.
What do I mean?
The other day I was setting up my project on my new machine so I did the usual :
These steps seem usual but what followed was grim, the ghastly error named
and no suggestions when I type :). It's something no one likes to look at. I looked up on StackOverflow and other places on how to fix it after I wasn't able to fix it on my own even after selecting the interpreter multiple times. After putting more thought to it, I realized that the Mac comes with 3.7.4 Python by default and I had just updated it to 3.8.3 but well you might think what's the big deal about it, right?
Nothing. But as for
, it's quite a big deal. When I initially created my
using the command
, the system default was Python 3.7.4 but later, it updated to Python 3.8.3. However,
python3 -m venv django
doesn't know that yet. I had to update it using
but my installed third party packages were gone (they were in
python3 -mvenv --upgrade path/to/venv
, but Python 3.8 was looking in
), so I had to reinstall them.
It doesn't end here though, IF I had gone out of my way and made the
, I'd have no choice ( or a way more complicated one than it would've been worth it cause this is just sheer unproductivity ) to even upgrade my
so that sucks, quite a lot actually.
Well, after finally coming to the realization that I had to move on from
that ,by the way, has *no backward compatibility* to something that offers more and consumes less time involving me in fixing it routinely. That something turned out to be 'pipenv' which is, in my opinion, one of the best dependency management systems that also dismisses the need for a
file ( which I still prefer to have though ).
Pipenv offers you the best of pip ( or pip3 ) and virtualenv at once.
In essence, it is a tool for creating a virtual environment, a utility for installing packages, managing virtual environments (like virtualenvwrapper or pyenv), and has all the commands associated with the libraries used.
And, it has backward compatibility so it works even with Python2.x projects.
Now you might wonder how do you use it with your projects, it's actually fairly simple.
It will create a virtual environment for your project and a pipfile for dependency management.
Now how do you install packages with pipenv?
How do you see what packages are installed?
Go to your Pipfile or run
In conclusion, use pipenv, be smart! xD
For more of this content, look at my profile I guess.
Create your free account to unlock your custom reading experience.