JupyterLab on Windows does not properly activate conda environment
See original GitHub issueThis might be related to #381 and #386.
After installation on Windows, I got the “Server Initialization Error” reported in #381 with same log message. I was able to work around the problem by starting jlab from the command line after explicit activation of the Python environment:
C:\Users\ukoethe> C:\JupyterLab\resources\jlab_server\condabin\activate
(base) C:\Users\ukoethe> jlab .
The same was necessary in order to use a custom Python environment. Merely adding the path to the Python environment as described here is not sufficient! Once again, the environment must first be activated, e.g.:
C:\Users\ukoethe> activate my_env # assuming conda is in the PATH
(my_env) C:\Users\ukoethe> jlab .
On Windows, the activate
command adds about 7 directories to the PATH
variable, and jupyter will not work properly without these settings. The workaround suggested in https://github.com/jupyterlab/jupyterlab-desktop/issues/381#issuecomment-1006790158 (copy some DLLs to other directories) is not the correct solution.
I suggest to add the appropriate activate
call at the beginning of JupyterLab.exe
.
On a related note, in some cases the JupyterLab GUI opened, but was unable to start the kernel. After some time-out period, the status bar displayed Python 3 | Disconnected
. Then, running a cell had no effect except for advancing to the next cell, as described in #386. Once again, activating the environment properly before running JupyterLab fixed this problem.
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (5 by maintainers)
Top GitHub Comments
Indeed, and that’s also what I do right now. But including the activation into
JupyterLab.exe
itself would be preferable.thanks @MichaDit. I was also able to reproduce randomly and have been debugging this issue for days. The server appears to be crashing when making websocket connections, but I couldn’t trace the source of the crash (checked available logs and call stacks). It happens only at initial launch time and only when server is launched from the electron app. I couldn’t find the source of the crash but as a remedy I am restarting the server if it crashes. Once you get the error as in https://github.com/jupyterlab/jupyterlab-desktop/issues/388#issuecomment-1047526190, you can restart the kernel now.