23

I have recently reset my laptop and installed Anaconda in it, and I tried to open JupyterLab but it gives me error

Error executing Jupyter command 'lab': [WinError 5] Access is denied

but it works fine when I try to open JUPYTER NOTEBOOK or try to open JUPYTER LAB with Anaconda as administrator.

I reinstalled Anaconda, and still it gives me the same error. Also it gives me the same error when I try to open JUPYTER LAB from Anaconda Navigator. Before resting my laptop it works fine for me, but now it's not. I tried to search my query on the web before asking here, but I did not get my answer.

I want to run JUPYTER LAB with normal Anaconda prompt

Additional details

  • My Anaconda is installed in C:\ProgramData (by default).
  • I didn't check the box “add to path” while installing Anaconda.
TylerH
  • 20,799
  • 66
  • 75
  • 101
Darkstar Dream
  • 1,649
  • 1
  • 12
  • 23

10 Answers10

37

You can just run it with Python:

python -m jupyterlab

This should work from an Anaconda Prompt or even the command prompt (if it uses the Python in Anaconda). It does not require admin rights.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Andrew
  • 596
  • 6
  • 6
25

Workaround:

  1. open anaconda navigator
  2. click on the jupyter lab settings option and then remove it
  3. Now open your anaconda prompt and type the following command: conda install -c conda-forge jupyterlab

now try to open it.

Proper solution:

If you have installed Anaconda for all users then you will face this issue (thanks to Alok Rajasukumaran, who pointed out this). The best way to solve this problem would be to reinstall this for only the current user.

But if you have a requirement to install for all users, then you can follow these steps:

  1. run the terminal as an administrator
  2. type jupyter lab

Optional (Automating launching jupyter lab with shortcut)

If you want to automate these steps, then you can create a batch file and assign a keyboard shortcut to it. Steps are as follows:

  1. open notepad and write "jupyter lab" and save it as a .bat file
  2. right-click on that file and click on create shortcut.
  3. now open the properties of created shortcut file and in the "shortcut-key" section type any combination of keys you want to set shortcut.
  4. click on "Advanced" and select "Run as administrator"

Now you can initiate jupyter lab directly by typing your shortcut key and giving "yes" permission to the prompt.

enter image description here

TylerH
  • 20,799
  • 66
  • 75
  • 101
Darkstar Dream
  • 1,649
  • 1
  • 12
  • 23
  • For me it was not necessary to uninstall jupyter for all users, I just had to install jupyter in the conda environment I wanted to use. I.e. I didn't realise I hadn't installed it in the current environment I was in, so when I tried to run `jupyter lab` it was actually trying to run the base `jupyter` which was presumably installed for all users and therefore had the access problem without admin rights. But after `pip install jupyter` in the current env, `jupyter lab` worked fine without admin rights because now it uses the env specific jupyter – Tim Child Apr 21 '22 at 23:50
  • It worked fine for me by changing from "tree" to "lab", thank you!! – Ravi kumar Apr 25 '23 at 16:13
8

Try to execute as an admin. Problem solved.

This solution is unsafe. When you execute a program with Admin this program has full permissions over the system.

The good solution is to create a new environment with your current system user (not root/admin). Activate this new environment and it would works

Kayzh3r
  • 3
  • 4
7

Usually, you don't have error in opening jupyter notebook command.

I usually type the jupyter notebook in the path bar in the explorer to open the notebook from that path directly — but as we are having an error in jupyter lab, I was only able to open jupyter notebook from there.

The solution for that is:

  1. Just type jupyter notebook as usual in the command prompt or the path bar in explorer.

  2. As soon as the browser opens automatically, change the URL from:

http://localhost:8888/tree to → http://localhost:8888/lab

  1. Yes, just a one word change. treelab and... Whoo! The jupyter lab is open right there you want it to be!
TylerH
  • 20,799
  • 66
  • 75
  • 101
Aayush Shah
  • 381
  • 2
  • 11
4

This is a problem that I see happening for Anaconda 3 installs for all users on Windows. Default (for single user) install seems fine. The permissions are somehow messed up during install. The solution I found is: explorer > right click anaconda3 folder > properties > security > advanced > change permissions > check "replace all child permission entries..." > OK.

This will take a while. After that uninstalling and reinstalling Jupyter Lab worked well.

Sajid
  • 4,381
  • 20
  • 14
3

The problem I had is that it installed the application in users/<your username>/anaconda3/. To solve this I simply manually moved the folder with its contents to c:/program files/.

Djiraga
  • 43
  • 5
3

Avoid running as Admin due to security concerns. The fastest way is to create a virtual environment and install it there. This is what I did and it did not require any reinstallation of Anaconda or running it as Admin.

in anaconda prompt:

conda create -n myenv python=3.9
conda activate myenv
conda install -c conda-forge jupyterlab
jupyter lab

the last line will launch the jupyter lab.

r1sh4bh
  • 61
  • 5
1

What I did is to create a new environment in Anaconda Navigator. I had the default environment which was root, so I could launch applications only as root.

In the Anaconda Navigator Home screen click on Environments -> Create. Here is the guide to create a new environment https://docs.anaconda.com/anaconda/navigator/tutorials/manage-environments/

TylerH
  • 20,799
  • 66
  • 75
  • 101
Daniel Srp
  • 373
  • 1
  • 2
  • 9
1

I want to emphasize what was written only as a comment, because it is easier to find it as an answer than to browse all comments:

If you are using Windows and installed it for all users, you will get this error.

  • The easiest way is to reinstall Anaconda only for you.

Note: You may uninstall your previous (unsuccessful) installation (for all users) before reinstalling it for only one user (you). But it is possible to do it later, too.

MarianD
  • 13,096
  • 12
  • 42
  • 54
1

The issue could probably be arising from this little bugger: enter image description here

delete this file and your permission error should go away, It took 3 uninstalls and an os change to realise that this file is not accessible for reading or writing