Is there a way to use pipenv with Jupyter notebook?

PythonJupyterPipenv

Python Problem Overview


Is there a way to use pipenv with Jupyter notebook?

Or more specifically, with an atom nteract/hydrogen python 3 kernel?

Python Solutions


Solution 1 - Python

Just tried the following with success.

In your project folder:

pipenv install ipykernel
pipenv shell

This will bring up a terminal in your virtualenv like this:

(my-virtualenv-name) bash-4.4$

In that shell do:

python -m ipykernel install --user --name=my-virtualenv-name

Launch jupyter notebook:

jupyter notebook

In your notebook, Kernel -> Change Kernel. Your kernel should now be an option.

Change Kernel Screenshot

Source: IPythonNotebookVirtualenvs

Solution 2 - Python

Install and start jupyter inside pipenv:

pipenv install jupyter
pipenv run jupyter notebook

Any other packages that are installed via pipenv (e.g. pipenv install numpy) will also be available to your jupyter notebook session.

Solution 3 - Python

Luis' answer works perfectly for jupyter notebooks.

But for hydrogen/atom specifically the recipe is:

pipenv install ipykernel
pipenv shell

launch atom from within the pipenv shell

> atom

Should be good to go!

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionemehexView Question on Stackoverflow
Solution 1 - PythonLuis MerazView Answer on Stackoverflow
Solution 2 - PythondaheView Answer on Stackoverflow
Solution 3 - PythonemehexView Answer on Stackoverflow