Unable to launch Jupyter lab from cmd in windows 7

Viewed 2062

The command 'jupyter lab' usually works fine in cmd. But today it isn't. I uninstall and reinstalled all jupyter components but no gain. Jupyter notebook seems to be working though.

C:\Users\Sarth.choudhary>jupyter lab Cannot open D:\Programs\Miniconda3\Scripts\jupyter-lab-script.py

I looked into the miniconda directory, jupyter-lab-script.py is indeed missing. I don't have this file anywhere in the miniconda directory.

Any help much appreciated.

2 Answers

The missing my-env/Scripts/jupyter-lab-script.py is just a very simple launch script for the jupyterlab.labapp.main function.

So just create my-env/Scripts/jupyter-lab-script.py containing the following code and the problem is solved (no need to create a whole new environment to copy from):

# -*- coding: utf-8 -*-
import re
import sys

from jupyterlab.labapp import main

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(main())

(NOTE: I copy-pasted from my-env/Scripts/jupyter-notebook-script.py and replaced the imported module by the correct jupyterlab.labapp. Didn't check if that is exactly the same as the original, but it works the same.)

I created another environment and installed jupyter lab in it. Ensured everything worked fine. Copied the missing file and pasted it in the base env folder. After making sure that I can launch Jupiter lab from base environment I removed the new environment. I think antivirus must have deleted that file so I created an exception in antivirus.

Related