macosjupyter-notebookvirtualenvjupyterjupyter-lab

No module named ipykernel_launcher


I'm trying to register a pyenv-virtual env as a jupiter lab kernel on MacOs. I have this working on ubuntu but I'm running into issues on my MacBook.

I followed the instructions here which creates the following kernel spec file.

{
"argv": [
"/Users/david/.pyenv/versions/python36-tf2/bin/python",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
],
"display_name": "Python (3.6.8 TF2.0)",
"language": "python"
}

I tested by running Users/david/.pyenv/versions/python36-tf2/bin/python -m ipykernel_launcher and it works fine.

But when I run jupiter lab (system python) then try and use the new kernel it aborts with log messages

/Users/david/.pyenv/versions/python36-tf20/bin/python: No module named ipykernel_launcher

Any ideas how to fix, the pyenv definitely can run ipykernel_launcher?


Solution

  • Installing pip correctly is the answer

    https://opensource.com/article/19/5/python-3-default-mac#what-to-do

    install pip in the new directory, and from there- download jupyter-lab again.