jupyter / notebook

Jupyter Interactive Notebook
https://jupyter-notebook.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
11.75k stars 4.99k forks source link

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

Closed gckoas closed 4 months ago

gckoas commented 4 months ago

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'

RRosio commented 4 months ago

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 commented 4 months ago

Thank you so much @RRosio, it worked!

zhangruikong commented 4 months ago

Thans for your reply!

FernandoJGomez commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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

FernandoJGomez commented 3 months ago

Thank you very much!!! Best wishes FER

On Wed, Jul 31, 2024 at 11:54 AM Ahmed Abouraia @.***> wrote:

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.

— Reply to this email directly, view it on GitHub https://github.com/jupyter/notebook/issues/7421#issuecomment-2260715315, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHZ472RANOYWMSIBCCBZWLDZPD3BFAVCNFSM6AAAAABKTDDBVKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENRQG4YTKMZRGU . You are receiving this because you commented.Message ID: @.***>

--


Dr. Fernando J. Gomez CICTERRA-Centro de Investigaciones en Ciencias de la Tierra Velez Sarsfield 1611, Piso 2, Of. 4, Ciudad Universitaria Zip Code X5016GCA - Córdoba - Argentina Phone 54-0351-5353800 (ext. 30232) Cell Phone 54-351-5164603 Personal teaching and research website: https://fernandojgomez.github.io/FernandoJGomez/ CICTERRA website: http://cicterra.conicet.unc.edu.ar/ http://cicterra.conicet.unc.edu.ar/ ; email: @.***


Bikramjeet07 commented 3 months ago

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 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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 commented 1 month ago

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 commented 1 week ago

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 commented 2 days ago

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

adityad1 commented 17 hours ago

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