Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can’t launch Jupyter notebook (PermissionError: [Errno 13] Permission denied) #7421

Closed
gckoas opened this issue Jul 9, 2024 · 20 comments
Labels
bug status:Needs Info status:Needs Triage Applied to issues that need triage

Comments

@gckoas
Copy link

gckoas commented Jul 9, 2024

I am new and i cant launch Jupyter notebook. I am getting the following error>
[I 2024-07-09 10:12:43.731 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2024-07-09 10:12:43.739 ServerApp] jupyter_server_terminals | extension was successfully linked.
[I 2024-07-09 10:12:43.746 ServerApp] jupyterlab | extension was successfully linked.
[I 2024-07-09 10:12:43.753 ServerApp] notebook | extension was successfully linked.
[I 2024-07-09 10:12:44.134 ServerApp] notebook_shim | extension was successfully linked.
[I 2024-07-09 10:12:44.181 ServerApp] notebook_shim | extension was successfully loaded.
[I 2024-07-09 10:12:44.185 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2024-07-09 10:12:44.185 ServerApp] jupyter_server_terminals | extension was successfully loaded.
[I 2024-07-09 10:12:44.189 LabApp] JupyterLab extension loaded from C:\Users\gckoas\AppData\Local\Programs\Python\Python312\Lib\site-packages\jupyterlab
[I 2024-07-09 10:12:44.189 LabApp] JupyterLab application directory is C:\Users\gckoas\AppData\Local\Programs\Python\Python312\share\jupyter\lab
[I 2024-07-09 10:12:44.190 LabApp] Extension Manager is 'pypi'.
[I 2024-07-09 10:12:44.599 ServerApp] jupyterlab | extension was successfully loaded.
[I 2024-07-09 10:12:44.609 ServerApp] notebook | extension was successfully loaded.
[I 2024-07-09 10:12:44.610 ServerApp] The port 8888 is already in use, trying another port.
[I 2024-07-09 10:12:44.610 ServerApp] The port 8889 is already in use, trying another port.
[I 2024-07-09 10:12:44.611 ServerApp] Serving notebooks from local directory: C:\Users\gckoas
[I 2024-07-09 10:12:44.612 ServerApp] Jupyter Server 2.14.1 is running at:
[I 2024-07-09 10:12:44.612 ServerApp] http://localhost:8890/tree?token=8ef7c317aafd78768a2e3092c044bd65399d906a5a1c2704
[I 2024-07-09 10:12:44.612 ServerApp] http://127.0.0.1:8890/tree?token=8ef7c317aafd78768a2e3092c044bd65399d906a5a1c2704
[I 2024-07-09 10:12:44.612 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[E 2024-07-09 10:12:44.612 ServerApp] Failed to write server-info to C:\Users\gckoas\AppData\Roaming\jupyter\runtime\jpserver-14760.json: PermissionError(13, 'Permission denied')
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\Users\gckoas\AppData\Local\Programs\Python\Python312\Scripts\jupyter-notebook.EXE_main
.py", line 7, in
File "C:\Users\gckoas\AppData\Local\Programs\Python\Python312\Lib\site-packages\jupyter_server\extension\application.py", line 623, in launch_instance
serverapp.start()
File "C:\Users\gckoas\AppData\Local\Programs\Python\Python312\Lib\site-packages\jupyter_server\serverapp.py", line 3119, in start
self.start_app()
File "C:\Users\gckoas\AppData\Local\Programs\Python\Python312\Lib\site-packages\jupyter_server\serverapp.py", line 3023, in start_app
self.write_browser_open_files()
File "C:\Users\gckoas\AppData\Local\Programs\Python\Python312\Lib\site-packages\jupyter_server\serverapp.py", line 2890, in write_browser_open_files
self.write_browser_open_file()
File "C:\Users\gckoas\AppData\Local\Programs\Python\Python312\Lib\site-packages\jupyter_server\serverapp.py", line 2913, in write_browser_open_file
with open(self.browser_open_file, "w", encoding="utf-8") as f:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: 'C:\Users\gckoas\AppData\Roaming\jupyter\runtime\jpserver-14760-open.html'

@gckoas gckoas added bug status:Needs Triage Applied to issues that need triage labels Jul 9, 2024
@RRosio
Copy link
Collaborator

RRosio commented Jul 9, 2024

Thank you for opening this issue @gckoas! Would you be able to try updating the runtime directory to something outside of C:\Users\gckoas\AppData\Roaming\ following the instructions on https://docs.jupyter.org/en/latest/use/jupyter-directories.html#envvar-JUPYTER_RUNTIME_DIR, to see if you still have permissions errors?

@gckoas
Copy link
Author

gckoas commented Jul 10, 2024

Thank you so much @RRosio, it worked!

@gckoas gckoas closed this as completed Jul 10, 2024
@zhangruikong
Copy link

Thans for your reply!

@FernandoJGomez
Copy link

Hi, one of my students had a similar issue after changing the hard disk of her computer, problem pasted below:

PermissionError: [Errno 13] Permission denied: 'C:\Users\Asus\AppData\Roaming\jupyter\runtime\jpserver-4344-open.html'

I saw your post but not completely sure how to proceed to fix this, not really experienced with this. Any help is welcome,

@Ahmedabouraia
Copy link

It looks like you're encountering a PermissionError when trying to start JupyterLab. This error typically occurs when the server does not have the necessary permissions to write to a specific directory or file. Here's how you can address this issue:

Run as Administrator: Ensure you are running JupyterLab with administrative privileges. Right-click on your terminal or Anaconda Prompt and select "Run as administrator."

Check Permissions: Verify the permissions of the C:\Users\admin\AppData\Roaming\jupyter\runtime directory. Ensure that the current user has write permissions to this directory.

Change Runtime Directory: You can change the runtime directory to a location where you have write permissions by setting the JUPYTER_RUNTIME_DIR environment variable. Here's how you can do it:

Open your terminal or Anaconda Prompt.
Set the environment variable:
bash
Copy code
set JUPYTER_RUNTIME_DIR=C:\path\to\writable\directory
Replace C:\path\to\writable\directory with a directory path where you have write permissions.
Check Disk Space: Ensure that there is enough disk space available in the directory where JupyterLab is trying to write the file.

Update Jupyter: Ensure that you have the latest version of JupyterLab and Jupyter Server installed. You can update them using:

bash
Copy code
pip install --upgrade jupyterlab jupyter_server
Reinstall Jupyter: If the problem persists, consider uninstalling and reinstalling JupyterLab:

bash
Copy code
pip uninstall jupyterlab jupyter_server
pip install jupyterlab
After trying these steps, attempt to start JupyterLab again. If you continue to face issues, please let me know the exact steps you have tried, and we can further troubleshoot.

@yadavnikhil03
Copy link

Just open the Application Once with Administrator Privilege and after that it will work fine. This worked for me.

@FernandoJGomez
Copy link

FernandoJGomez commented Aug 9, 2024 via email

@Bikramjeet07
Copy link

It looks like you're encountering a PermissionError when trying to start JupyterLab. This error typically occurs when the server does not have the necessary permissions to write to a specific directory or file. Here's how you can address this issue:

Run as Administrator: Ensure you are running JupyterLab with administrative privileges. Right-click on your terminal or Anaconda Prompt and select "Run as administrator."

Check Permissions: Verify the permissions of the C:\Users\admin\AppData\Roaming\jupyter\runtime directory. Ensure that the current user has write permissions to this directory.

Change Runtime Directory: You can change the runtime directory to a location where you have write permissions by setting the JUPYTER_RUNTIME_DIR environment variable. Here's how you can do it:

Open your terminal or Anaconda Prompt. Set the environment variable: bash Copy code set JUPYTER_RUNTIME_DIR=C:\path\to\writable\directory Replace C:\path\to\writable\directory with a directory path where you have write permissions. Check Disk Space: Ensure that there is enough disk space available in the directory where JupyterLab is trying to write the file.

Update Jupyter: Ensure that you have the latest version of JupyterLab and Jupyter Server installed. You can update them using:

bash Copy code pip install --upgrade jupyterlab jupyter_server Reinstall Jupyter: If the problem persists, consider uninstalling and reinstalling JupyterLab:

bash Copy code pip uninstall jupyterlab jupyter_server pip install jupyterlab After trying these steps, attempt to start JupyterLab again. If you continue to face issues, please let me know the exact steps you have tried, and we can further troubleshoot.

Screenshot 2024-08-20 194129
it shows this error

@Usmannazirr
Copy link

I also faced similar issue on Windows 11 - My Jupyter notebook wasn't launching, so I fixed it by giving administrator permissions to the Jupyter runtime folder. Here's how I did it:

Search for 'Anaconda Navigator' in the taskbar and open its file location.

Click on the 'Roaming' folder in the search bar.

Open the 'jupyter' folder.

Find the 'runtime' folder inside it.

Right-click the 'runtime' folder, select 'Properties,' then go to the 'Security' tab.

Click 'Edit,' and grant the folder 'Administrator' permissions.

Click 'OK' to apply the changes.

@adesh220
Copy link

adesh220 commented Sep 1, 2024

I also faced similar issue on Windows 11 - My Jupyter notebook wasn't launching, so I fixed it by giving administrator permissions to the Jupyter runtime folder. Here's how I did it:

Search for 'Anaconda Navigator' in the taskbar and open its file location.

Click on the 'Roaming' folder in the search bar.

Open the 'jupyter' folder.

Find the 'runtime' folder inside it.

Right-click the 'runtime' folder, select 'Properties,' then go to the 'Security' tab.

Click 'Edit,' and grant the folder 'Administrator' permissions.

Click 'OK' to apply the changes.

Thanks Usman, it worked for me.

@PRANFS
Copy link

PRANFS commented Sep 3, 2024

I also faced similar issue on Windows 11 - My Jupyter notebook wasn't launching, so I fixed it by giving administrator permissions to the Jupyter runtime folder. Here's how I did it:

Search for 'Anaconda Navigator' in the taskbar and open its file location.

Click on the 'Roaming' folder in the search bar.

Open the 'jupyter' folder.

Find the 'runtime' folder inside it.

Right-click the 'runtime' folder, select 'Properties,' then go to the 'Security' tab.

Click 'Edit,' and grant the folder 'Administrator' permissions.

Click 'OK' to apply the changes.

Thanks!. Worked for me as well

@JohnnyZhu035
Copy link

Just for someone who is in the same situation after rearranging hard disk and find the prompt showing the same error,annnnd not able to find where the "runtime" folder is:
If your prompt automatically redirects to the browser and shows:file not found with the folder file:///C:/Users/username/AppData/Roaming/jupyter/runtime/jpserver-25412-open.html as the link.
Copy the front of the file link :file:///C:/Users/username/AppData/Roaming/jupyter/ and you'll find the "runtime" folder
Give it admin priviledge and hopefulliy the problem will be fixed!

@sidd-2203
Copy link

I also faced similar issue on Windows 11 - My Jupyter notebook wasn't launching, so I fixed it by giving administrator permissions to the Jupyter runtime folder. Here's how I did it:

Search for 'Anaconda Navigator' in the taskbar and open its file location.

Click on the 'Roaming' folder in the search bar.

Open the 'jupyter' folder.

Find the 'runtime' folder inside it.

Right-click the 'runtime' folder, select 'Properties,' then go to the 'Security' tab.

Click 'Edit,' and grant the folder 'Administrator' permissions.

Click 'OK' to apply the changes.

Thanks Usman, was facing the same issue from a long time, The above trick worked.

@3ae3ae
Copy link

3ae3ae commented Nov 5, 2024

I also faced similar issue on Windows 11 - My Jupyter notebook wasn't launching, so I fixed it by giving administrator permissions to the Jupyter runtime folder. Here's how I did it:

Search for 'Anaconda Navigator' in the taskbar and open its file location.

Click on the 'Roaming' folder in the search bar.

Open the 'jupyter' folder.

Find the 'runtime' folder inside it.

Right-click the 'runtime' folder, select 'Properties,' then go to the 'Security' tab.

Click 'Edit,' and grant the folder 'Administrator' permissions.

Click 'OK' to apply the changes.

Thanks Usman

@zkfazal
Copy link

zkfazal commented Nov 16, 2024

Putting it out there that the setting the environment variable JUPYTER_RUNTIME_DIR still worked for me.

@adityad1
Copy link

I had the same issue.
I deleted the existing runtime folder.
That fixed the problem for me.

@meschos
Copy link

meschos commented Dec 5, 2024

Thank you so much @RRosio, it worked!

Worked for me too. Just in case you are a beginner like me, Just type %Appdata% in the address bar of the file explorer and hit enter. Go to the Jupyter folder. Delete the runtime folder inside the jupyter folder and create a new folder with a different name

@murzabaevb
Copy link

Ups, sadenly discovered rather simpler solution to the problem. When you attempt to open that 'runtime' folder here C:\Users\YourName\AppData\Roaming\jupyter with windows file explorer, it provides an option to open that folder with permanent access. You agree to that option, and the problem is solved.

@AsadiOmid
Copy link

I am new and i cant launch Jupyter notebook. I am getting the following error> [I 2024-07-09 10:12:43.731 ServerApp] jupyter_lsp | extension was successfully linked. [I 2024-07-09 10:12:43.739 ServerApp] jupyter_server_terminals | extension was successfully linked. [I 2024-07-09 10:12:43.746 ServerApp] jupyterlab | extension was successfully linked. [I 2024-07-09 10:12:43.753 ServerApp] notebook | extension was successfully linked. [I 2024-07-09 10:12:44.134 ServerApp] notebook_shim | extension was successfully linked. [I 2024-07-09 10:12:44.181 ServerApp] notebook_shim | extension was successfully loaded. [I 2024-07-09 10:12:44.185 ServerApp] jupyter_lsp | extension was successfully loaded. [I 2024-07-09 10:12:44.185 ServerApp] jupyter_server_terminals | extension was successfully loaded. [I 2024-07-09 10:12:44.189 LabApp] JupyterLab extension loaded from C:\Users\gckoas\AppData\Local\Programs\Python\Python312\Lib\site-packages\jupyterlab [I 2024-07-09 10:12:44.189 LabApp] JupyterLab application directory is C:\Users\gckoas\AppData\Local\Programs\Python\Python312\share\jupyter\lab [I 2024-07-09 10:12:44.190 LabApp] Extension Manager is 'pypi'. [I 2024-07-09 10:12:44.599 ServerApp] jupyterlab | extension was successfully loaded. [I 2024-07-09 10:12:44.609 ServerApp] notebook | extension was successfully loaded. [I 2024-07-09 10:12:44.610 ServerApp] The port 8888 is already in use, trying another port. [I 2024-07-09 10:12:44.610 ServerApp] The port 8889 is already in use, trying another port. [I 2024-07-09 10:12:44.611 ServerApp] Serving notebooks from local directory: C:\Users\gckoas [I 2024-07-09 10:12:44.612 ServerApp] Jupyter Server 2.14.1 is running at: [I 2024-07-09 10:12:44.612 ServerApp] http://localhost:8890/tree?token=8ef7c317aafd78768a2e3092c044bd65399d906a5a1c2704 [I 2024-07-09 10:12:44.612 ServerApp] http://127.0.0.1:8890/tree?token=8ef7c317aafd78768a2e3092c044bd65399d906a5a1c2704 [I 2024-07-09 10:12:44.612 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [E 2024-07-09 10:12:44.612 ServerApp] Failed to write server-info to C:\Users\gckoas\AppData\Roaming\jupyter\runtime\jpserver-14760.json: PermissionError(13, 'Permission denied') Traceback (most recent call last): File "", line 198, in run_module_as_main File "", line 88, in run_code File "C:\Users\gckoas\AppData\Local\Programs\Python\Python312\Scripts\jupyter-notebook.EXE__main.py", line 7, in File "C:\Users\gckoas\AppData\Local\Programs\Python\Python312\Lib\site-packages\jupyter_server\extension\application.py", line 623, in launch_instance serverapp.start() File "C:\Users\gckoas\AppData\Local\Programs\Python\Python312\Lib\site-packages\jupyter_server\serverapp.py", line 3119, in start self.start_app() File "C:\Users\gckoas\AppData\Local\Programs\Python\Python312\Lib\site-packages\jupyter_server\serverapp.py", line 3023, in start_app self.write_browser_open_files() File "C:\Users\gckoas\AppData\Local\Programs\Python\Python312\Lib\site-packages\jupyter_server\serverapp.py", line 2890, in write_browser_open_files self.write_browser_open_file() File "C:\Users\gckoas\AppData\Local\Programs\Python\Python312\Lib\site-packages\jupyter_server\serverapp.py", line 2913, in write_browser_open_file with open(self.browser_open_file, "w", encoding="utf-8") as f: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PermissionError: [Errno 13] Permission denied: 'C:\Users\gckoas\AppData\Roaming\jupyter\runtime\jpserver-14760-open.html'

@AsadiOmid
Copy link

AsadiOmid commented Dec 25, 2024

In the directory C:\Users\gckoas\AppData\Roaming, right-click on the Jupyter folder and select Properties. In the Attributes section, uncheck the Read-only Box. Then, go to the Security tab and change the permissions to Full Control.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug status:Needs Info status:Needs Triage Applied to issues that need triage
Projects
None yet
Development

No branches or pull requests