How can I see the current version of packages installed by pipenv?
Question:
I’m managing my Python dependencies with pipenv. How can see the currently installed versions of packages?
I could examine Pipfile.lock
, but is there a simpler way from the command line?
Answers:
To see installed packages with Pipenv, you can use the pipenv graph
command.
The output from this is perhaps more verbose than you’d like, but it does contain everything you need.
Sample truncated output:
appdirs==1.4.3
decorator==4.0.11
flake8==3.3.0
- configparser [required: Any, installed: 3.5.0]
- enum34 [required: Any, installed: 1.1.6]
- mccabe [required: >=0.6.0,<0.7.0, installed: 0.6.1]
- pycodestyle [required: >=2.0.0,<2.4.0, installed: 2.3.1]
- pyflakes [required: >=1.5.0,<1.6.0, installed: 1.5.0]
Flask-Admin==1.5.3
- Flask [required: >=0.7, installed: 0.12.4]
- click [required: >=2.0, installed: 6.7]
- itsdangerous [required: >=0.21, installed: 0.24]
- Jinja2 [required: >=2.4, installed: 2.10]
- MarkupSafe [required: >=0.23, installed: 1.0]
- Werkzeug [required: >=0.7, installed: 0.14.1]
- wtforms [required: Any, installed: 2.1]
As it’s a graph, you’ll sometimes need to look in “deeper” levels of the output for the package you’re interested in. You can also use grep
:
$ pipenv graph | grep Flask-Admin
Flask-Admin==1.5.3
1.go in project folder.
2.first activate pipenv type pipenv shell
.
3.type pip freeze
Just use command pipenv lock -r
This will list locally installed packages.
-r, –requirements Generate output in requirements.txt format
Seems pip list
works too
1.go in project folder.
2.activate pipenv $ pipenv shell
.
3.$ pip list
In the shell, activate your virtual environment and execute pipenv graph
. This outputs all installed packages with their version, requirements and dependencies.
Every pipenv
has its own pipfile in which all the packages installed are listed. It also lets you manually enter a package name in the Pipfile for installation.
Hence, I do use Pipfile to check what packages are installed in the current environment.
-
For VS Code run within the environment directory:
code Pipfile
-
For VIM:
vim Pipfile
Pipenv has the answer
I do believe the author of pipenv
suggests using in production the command:
pipenv lock --requirements
# or simply use : pipenv lock -r
but since this will work only if you start from scratch a new project, and after that you use pipenv lock
then you copy the pipfile.lock
to the new directory (either a deployed dir or a new project).
I attach a diagram on how I understand pipenv
I hope it is useful. I highly suggest using method A. that will allow you to see the full list of all installed libraries.
I’m managing my Python dependencies with pipenv. How can see the currently installed versions of packages?
I could examine Pipfile.lock
, but is there a simpler way from the command line?
To see installed packages with Pipenv, you can use the pipenv graph
command.
The output from this is perhaps more verbose than you’d like, but it does contain everything you need.
Sample truncated output:
appdirs==1.4.3
decorator==4.0.11
flake8==3.3.0
- configparser [required: Any, installed: 3.5.0]
- enum34 [required: Any, installed: 1.1.6]
- mccabe [required: >=0.6.0,<0.7.0, installed: 0.6.1]
- pycodestyle [required: >=2.0.0,<2.4.0, installed: 2.3.1]
- pyflakes [required: >=1.5.0,<1.6.0, installed: 1.5.0]
Flask-Admin==1.5.3
- Flask [required: >=0.7, installed: 0.12.4]
- click [required: >=2.0, installed: 6.7]
- itsdangerous [required: >=0.21, installed: 0.24]
- Jinja2 [required: >=2.4, installed: 2.10]
- MarkupSafe [required: >=0.23, installed: 1.0]
- Werkzeug [required: >=0.7, installed: 0.14.1]
- wtforms [required: Any, installed: 2.1]
As it’s a graph, you’ll sometimes need to look in “deeper” levels of the output for the package you’re interested in. You can also use grep
:
$ pipenv graph | grep Flask-Admin
Flask-Admin==1.5.3
1.go in project folder.
2.first activate pipenv type pipenv shell
.
3.type pip freeze
Just use command pipenv lock -r
This will list locally installed packages.
-r, –requirements Generate output in requirements.txt format
Seems pip list
works too
1.go in project folder.
2.activate pipenv $ pipenv shell
.
3.$ pip list
In the shell, activate your virtual environment and execute pipenv graph
. This outputs all installed packages with their version, requirements and dependencies.
Every pipenv
has its own pipfile in which all the packages installed are listed. It also lets you manually enter a package name in the Pipfile for installation.
Hence, I do use Pipfile to check what packages are installed in the current environment.
-
For VS Code run within the environment directory:
code Pipfile
-
For VIM:
vim Pipfile
Pipenv has the answer
I do believe the author of pipenv
suggests using in production the command:
pipenv lock --requirements
# or simply use : pipenv lock -r
but since this will work only if you start from scratch a new project, and after that you use pipenv lock
then you copy the pipfile.lock
to the new directory (either a deployed dir or a new project).
I attach a diagram on how I understand pipenv
I hope it is useful. I highly suggest using method A. that will allow you to see the full list of all installed libraries.