pythonkernelatom-editorpipenvhydrogen

Connect Atom Hydrogen to Kernel in Pipenv Shell


Here's a quick rundown of what I'm doing:

  1. Make a folder foo on desktop
  2. Open Atom
  3. Add foo as project folder
  4. Open foo in terminal (via Atom platformio-ide-terminal)
  5. cd ~/Desktop/foo
  6. Setup environment with pipenv install numpy
  7. Start environment pipenv shell
  8. Make a file inside foo called bar.py containing print("hi")
  9. Open bar.py in Atom and [shift + enter] to start Hydrogen automatically. Get promted with which kernel to connect to...

The problem: I want to connect the kernel to running in the pipenv shell. How do I achieve this?


Solution

  • This stackoverflow post has an answer, although the steps are a bit different.

    1. Install the ipykernel in your virtual environment:
      pipenv install ipykernel
    2. Start shell with:
      pipenv shell
    3. Set name so Atom Hydrogen can recognize:
      python -m ipykernel install --user --name=name-that-atom-hydrogen-will-list
    4. Start Atom (from within pipenv shell) and when you run code (control-enter), Atom should list python kernels to use (including name-that-atom-hydrogen-will-list)