Closed azinsharaf closed 1 year ago
Hello,
The kernel_connection_file
parameter in euporie's config allows you to connect to an existing running kernel instance by providing a kernel connection file. A kernel connection file contains the IP, ports, and authentication key needed to connect to an existing running instance of the kernel. Typically this file gets created when a kernel is launched.
The file C:\Users\asharaf\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\share\jupyter\kernels\python3\kernel.json
is a kernelspec file. A kernel spec file tells Jupyter how to launch a particular kernel. So, as you have found, setting kernel_connection_file
to a kernelspec file will not work.
Normally you can switch the kernel from within euporie-notebook by selecting Kernel > Change kernel
from the menus - see here: https://euporie.readthedocs.io/en/latest/apps/notebook.html#changing-the-kernel
If your kernel does not show up on the list of available kernels in euporie, you need to register your kernel.
conda activate arcgispro-py3-clone
python -m ipykernel install --user --name python3-arcgispro --display-name "Python 3 (ArcGIS Pro)"
This should copy the python3
kernelspec folder to %APPDATA%\jupyter\kernels
, adding the correct python interpreter path. It should now show in the list of available kernels in euporie.
You can find more information about kernelspecs in the jupyter_client
documentation here:
https://jupyter-client.readthedocs.io/en/stable/kernels.html#kernelspecs
thanks @joouha . It works now. I removed the invalid config.json file and ran python -m ipykernel install --user --name python3-arcgispro --display-name "Python 3 (ArcGIS Pro)"
as you mentioned. Now euporie notebook can recognize my python interpreter. Sweet!
The only question now is when I run jupyter notebook
I see three kernels (the middle one is the one I just created). So why euporie couldn't use the existing one i already have. (maybe they are in a different location?)
Are you running Jupyter Notebook from within your arcgispro-py3-clone
conda environment?
yes
OK, so that explains why those kernels show up in Jupyter Notebook and not in euporie.
I think you said you installed euporie with pipx - so euporie will be in a different Python environment to Jupyter Notebook and your custom kernels.
Jupyter and euporie both search for kernelspecs in several folders, including the share
folder for the current Python environment (this is where kernelspecs for custom kernels usually get installed). Since Jupyter Notebook is running from the same environment in which the kernels are installed, it is able to find them.
Since Euporie is running in a different Python environment, it does not know anything about the environment with the custom kernels in, so does not find the kernelspecs.
By running python -m ipykernel install --user
, you install a copy of the kernelspec to your user profile, where euporie can find it.
Thanks for the great explanation.
I've tried
euporie
on WSL (with Ubuntu) and it works. Now I need to use it on Windows because my python package (arcpy
) is just running on Windows. I installed it via pipx on Windows but cannot configure it with a non-default kernel. Is it something you can help?my existing kernels:
euporie configuration file:
euporie log: