Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set your subtitle preferences in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Working With Pipenv (Summary)

This course covered the ins-and-outs of pipenv, covering how to:

  • Create virtual environments
  • Install packages
  • Uninstall packages
  • Validate your dependencies

For more information on concepts covered in this course, you can check out:

Download

Sample Code (.zip)

33.0 KB

Download

Course Slides (.pdf)

967.4 KB

Santosh on Jan. 18, 2022

Great course as always!

Couple of questions:

  • In the ‘pipenv shell’ environment, when I use Vim/Neovim as my editor, none of the plugins or standard configurations light up. Any thoughts or best practices of ways to enable this as a default?

  • I wrote a simple script that just took a small dictionary and pushed it into a pandas dataframe. Literally, this was my code:import pandas as pd; sample_list = {‘name’:’Moi’,’age’:20}; df=pd.DataFrame(sample_list). I wanted to test this through a Makefile and Github Actions. I had installed ‘pandas’ and the script ran successfully when I ran it in the pipenv environment. However, when I tried to run this through a Makefile as part of Github Actions, it threw this error: “numpy: No module named ‘numpy’” though numpy was part of my dependencies, and my code (as above) did not reference anything numpy-related. I did a “pipenv install numpy” to explicitly add this package. It worked. But it was disappointing since I assumed that numpy was already installed as a dependency. Any thoughts on why that is?…

  • (Makefile contents below)

  • install: pip install pipenv &&\ pip install –upgrade pip &&\ pipenv install –ignore-pipfile
  • run_script: pipenv run python sample.py
  • all: install run_script

Christopher Trudeau RP Team on Jan. 18, 2022

Hi Santosh,

I’m not going to be much help with you questions unfortunately, but I’ll take a quick stab. Maybe someone else can chime in or you can reach out on the Slack channel?

On my machine, pipenv shell spawns a new bash shell and picks up my environment settings from the parent shell. I use vim myself and can verify that the plugins get picked up.

I’m on macOS. It is possible that a different OS or a different base shell behaves differently. From a quick read of the ‘net, it looks to me like it always spawns a bash shell, but that might not be right. If it is the case – and you aren’t using bash as your base, then your settings won’t get picked up.

As for the dependency problem on GitHub Actions, I don’t know. I can confirm that numpy is listed as a dependency of pandas and if the standard pip install pandas is used, the dependency will get picked up. I’ve never used GitHub Actions, so I don’t know why it would be different.

Sorry I couldn’t be more help.

Santosh on Jan. 22, 2022

Thanks Christopher. Appreciate the help and the response. I’ll keep researching… Great courses as always.

Christopher Trudeau RP Team on Jan. 22, 2022

Hope I was able to at least point you in the right direction. When you figure it out, post it here. Others may have similar questions.

Gattamaneni Kumar Raja on July 21, 2022

Good to run through this tutorial to be aware of this new tool for package management. It was brief and to the point. Thanks for taking your time and building such tutorials Christopher.

Become a Member to join the conversation.