notebook icon indicating copy to clipboard operation
notebook copied to clipboard

Jupyter stuck on one environment's executable

Open jakobbrown opened this issue 3 years ago • 1 comments
trafficstars

So i went back to an old environment in anaconda i hadn't used in a couple months, and i get #4079 kernel error when starting up jupyter lab or notebook. I try the solution posted on that issue (pictured below and linked here: https://github.com/jupyter/notebook/issues/4079#issuecomment-429651480)

image

This worked perfectly in getting that environment to work again. The issue i have now is that i am unable to use any other environment, as they all appear to have been assigned the executable that belongs to that one environment i fixed.

image

The python version stated above is the environment that i fixed with python -m ipykernel install --user in, but not the environment that i had launched jupyter from. This is the case for all my other environments.

both sys.executable and sys.path show everything heading to the path of the environment that i ran python -m ipykernel install --user in. i have checked the kernel.json for all my other environments and they are as they should be, referencing the correct python path for that environment, so it's not that.

In the anaconda prompt, all of the executables seem normal and the environments work fine. It is just in jupyter that this is happening.

Any ideas as to how i can fix this? Many thanks

jakobbrown avatar Jun 30 '22 21:06 jakobbrown

Further info:

I can run python -m ipykernel install --user on any of the environments i have and the problem will switch over to that environment. This appears to be changing the kernel.json at this path:

image

rather than changing the kernel.jsons i was checking under each of my environments here:

image

I tried running the command on my base environment to see if that would return things to normal, which changes the appData\Roaming... kernel.json to this:

image

Although the problem persists with the executable in jupyter not switching over when i change environment.

TL:DR - I don't want to have to keep running python -m ipykernel install --user every time i want to switch environment. Does anyone know how i can reverse this? Many thanks

jakobbrown avatar Jul 01 '22 09:07 jakobbrown