I am using Jupyter with Anaconda3.
My Anaconda3\
and Anaconda3\Scripts\
folders have been added to the %PATH%
variable.
Eventhough the jupyter.exe
is in the Scripts
folder above, Jupyter related commands don't work without a dash.
For example:
jupyter kernelspec --version
Error executing Jupyter command 'kernelspec': [Errno 'jupyter-kernelspec' not found] 2
The same command with a dash works:
jupyter-kernelspec --version
5.2.2
And the same goes for jupyter-notebook
, etc.
Do I have to add anything else to my %PATH%
? Am I missing something?
I have opened an issue for this point on Github as well, but it didn't get any attention unfortunately: https://github.com/jupyter/jupyter/issues/381
Well, I figured out what's wrong. Using the shutil
module, in some Windows versions which('jupyter-kernelspec')
returns None
, because of the missing .exe
, although the PATHEXT
environment variable contains both .exe
and .EXE
.
(This seems to be linked to this: shutil.which() not finding programs without appending file extension although I am not convinced because which(jupyter-kernelespec.EXE)
using shutil
works fine for me...)
So, one has to add the .exe
to the argument of jupyter
like this:
jupyter kernelspec.exe list
Because this kind of command is used by most Jupyter kernel installers, you won't always be able to go debug and check where you need to add it. The fix consists in adding this:
if cmd[-4:] != '.exe':
cmd = cmd + '.exe'
right before this line: https://github.com/jupyter/jupyter_core/blob/f1e18b8a52cd526c0cd1402b6041778dd60f20dc/jupyter_core/command.py#L102
I'll try to raise this point with shutil
module people.
I've updated also the github issue and closed it. https://github.com/jupyter/jupyter/issues/381
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With