jupyter / jupyter_client

Jupyter protocol client APIs
https://jupyter-client.readthedocs.io
BSD 3-Clause "New" or "Revised" License
383 stars 283 forks source link

Kernel Provisioning: The 'local-provisioner' is not found. #800

Closed utkonos closed 2 years ago

utkonos commented 2 years ago

I'm encountering a problem after the update to jupyter_client 7.3.2. The following error is appearing:

[W 2022-06-06 17:10:09.080 ServerApp] Kernel Provisioning: The 'local-provisioner' is not found.  This is likely due to the presence of multiple jupyter_client distributions and a previous distribution is being used as the source for entrypoints - which does not include 'local-provisioner'.  That distribution should be removed such that only the version-appropriate distribution remains (version >= 7).  Until then, a 'local-provisioner' entrypoint will be automatically constructed and used.
    The candidate distribution locations are: ['/home/jupyter/venv/lib/python3.10/site-packages/jupyter_client-7.3.2.dist-info']

I found a thread with a similar problem from last year: https://discourse.jupyter.org/t/kernel-python-3-is-referencing-a-kernel-provisioner-local-provisioner-that-is-not-available-ensure-the-appropriate-package-has-been-installed-and-retry/10436/9

pip install --force-reinstall jupyter_client didn't help. Also, I've looked in {sys.prefix}/lib/pythonX.Y/site-packaes as was recommended, but I don't see a second directory.

I will probably delete the virtual environment and reinstall the whole jupyter instance from pip install jupyter to see if that fixes it.

utkonos commented 2 years ago

This message appears after a clean install to a virtual environment.

kevin-bates commented 2 years ago

Hi @utkonos.

I'm encountering a problem after the update to jupyter_client 7.3.2.

When you updated jupyter_client, were you using jupyter_client 6.x prior to this particular update?

This message appears after a clean install to a virtual environment.

I'm not familiar with virtual environments, but I wonder if it's a similar thing where the entrypoints package sees the distribution from, in this case, another (base?) virtual environment or something.

kevin-bates commented 2 years ago

Actually, I see the issue and it's independent of how the python env is setup (venv or conda).

In 7.3.2 the entry_points.txt file that is in the referenced dist-info directory is missing the [jupyter_client.kernel_provisioners] group entry:

[console_scripts]
jupyter-kernel = jupyter_client.kernelapp:main
jupyter-kernelspec = jupyter_client.kernelspecapp:KernelSpecApp.launch_instance
jupyter-run = jupyter_client.runapp:RunApp.launch_instance

Whereas 7.3.1 has the following content:

[console_scripts]
jupyter-kernel = jupyter_client.kernelapp:main
jupyter-kernelspec = jupyter_client.kernelspecapp:KernelSpecApp.launch_instance
jupyter-run = jupyter_client.runapp:RunApp.launch_instance

[jupyter_client.kernel_provisioners]
local-provisioner = jupyter_client.provisioning:LocalProvisioner

I suspect this is due to the changes to use flit in #781 where this stanza of the entrypoints got dropped when setup.py was deleted: image cc: @blink1073

utkonos commented 2 years ago

Thanks! I see that. That looks like the root cause of the message.

I'm looking at https://flit.pypa.io/en/latest/pyproject_toml.html#entry-points-sections

I use entry points in my own projects, but I am still using setup.cfg at the moment. I have not moved these components to a pyproject.toml file yet. Let me know if I have this correct. This should be added to pyproject.toml?

[project.entry-points."jupyter_client.kernel_provisioners"]
local-provisioner = "jupyter_client.provisioning:LocalProvisioner"

Or is this missing for a specific reason and should not be added to the pyproject.toml?

kevin-bates commented 2 years ago

Yes, that is correct. I have confirmed it works, but if you'd like to make the contribution, I'd be happy to shepherd it through!

You'll have to uninstall the current jupyter_client to get the dev version to install.

utkonos commented 2 years ago

@kevin-bates PR coming right up. One sec.