Installing wrong kernel_json
jlries61 opened this issue · comments
In my kernel, based on ProcessMetaKernel
, I define...
language_info = {'name': 'SPM',
'codemirror_mode': 'shell',
'mimetype': 'text/plain',
'file_extension': '.cmd'}
kernel_json = {"argv": ["python3", "-m", "spm_kernel",
"-f", "{connection_file}"],
"display_name": "SPM",
"language": "SPM"}
To install my kernel into Jupyter, I run:
python3 -m spm_kernel install --user
But instead of getting the expected kernelspec (SPM), I get:
Installed kernelspec python3 in /home/jries/.local/share/jupyter/kernels/python3
/home/jries/.local/share/jupyter/kernels/python3/kernel.json
reads as follows:
{
"argv": [
"/usr/bin/python3",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
],
"display_name": "Python 3",
"language": "python"
...which is not at all what we want. I assume that that kernel.json
is the default, but how do I override it?
For your diagnosing pleasure, I have put spm_kernel
on GitHub (https://github.com/jlries61/spm_kernel). The file in question is spm_kernel/kernel.py
.
Any assistance you could provide would be greatly appreciated.
Found it! Your __main__.py
should use your own kernel class.
I had to change things a little more than that, but...
My copy of __main__.py
now reads:
from .kernel import SPMKernel
if __name__ == "__main__":
SPMKernel.run_as_main()
...matching what I see for various other kernels.
And I also corrected the definition of kernel_json by adding the "name" attribute, as follows:
kernel_json = {"argv": ["python3", "-m", "spm_kernel",
"-f", "{connection_file}"],
"display_name": "SPM",
"language": "SPM",
"name": "SPM"}
Thanks to Steve for the clue.