I recently bought a new M1 Pro Macbook with macOS Monterey. Migrated all my stuff from my previous Macbook Air over to it.
I opened my Jupyter Notebook via Anaconda but now, it cannot detect my Desktop files and folders (the Desktop folders are on the extreme right of the screenshot):
I have also went to System Preferences -> Security & Privacy -> Privacy -> Files and Folders to check on the access and permissions, but nothing seems amiss:
Attaching the Jupyter terminal boot-up here as well just for reference:
Can anyone assist? Thank you!
Jupyter can't cd outside of your Users/user path. However, you can change that folder in the jupyter_notebook_config.py. Look for the c.NotebookApp.notebook_dir entry to point to the desired working directory. You can create this config file from your shell via
jupyter notebook --generate-config
Small configuration is required to view these files on jupyter notebook.
Get the path of jupyter_notebook_config.py file.
Below mentioned command can be used to find it -
jupyter notebook --generate-config
open the file and search for c.NotebookApp.notebook_dir
this might be configured to default value i.e. ''
Reconfigure it and update path of directory contain code files,
like -
c.NotebookApp.notebook_dir = /Volumes/Technical/Python
Related
Under Windows, JupyterLab does not allow navigation in the UI to any drive other than the drive that JupyterLab was started in. By default this is the C: drive.
How can you access notebooks on another drive?
Anaconda does not allow switching between drives but you can start Jupyter Lab or a Jupyter notebook on another drive, for example the D: drive.
First shutdown any running JupyterLab, then
Open a terminal window from within Anaconda Navigator. To do this, select environments in the Navigator window and then click the green "play" arrow next to base(root) -- or which ever environment you are using.
then in the terminal window type
jupyter notebook --generate-config
this will generate a file in your user directory under .jupyter\jupyter_notebook_config.py
edit the file.
Set the variable c.NotebookApp.notebook_dir to whatever directory you want to start in, for example
c.NotebookApp.notebook_dir = "D:\mydir"
NOTE do not put a trailing backslash. Also if the directory pathname contains spaces ensure you are using double quotes.
save the file and test that all is working. In the command line type
jupyter lab
this should start JupyterLab correctly, check for any errors in the terminal window. JupyterLab should start in the directory you set in the file.
If all is well, shutdown JupyterLab and run it from the Anaconda Navigator window as usual. All should work now.
As mentioned by GreyMS in this github issue, you can use an mklink:
mklink /D D_Drive D:\sources
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.
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.
Workaround:
open anaconda navigator
click on the jupyter lab settings option and then remove it
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:
run the terminal as an administrator
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:
open notepad and write "jupyter lab" and save it as a .bat file
right-click on that file and click on create shortcut.
now open the properties of created shortcut file and in the "shortcut-key" section type any combination of keys you want to set
shortcut.
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.
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
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:
Just type jupyter notebook as usual in the command prompt or the path bar in explorer.
As soon as the browser opens automatically, change the URL from:
http://localhost:8888/tree to → http://localhost:8888/lab
Yes, just a one word change. tree → lab and...
Whoo! The jupyter lab is open right there you want it to be!
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.
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/.
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.
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.
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/
I was trying to change the default starting directory of Anaconda Jupyter notebook on Windows 10
Conda version 4.3.31
Jupyter notebook version 5.2.2
From this link, I learned that I need to change c.NotebookApp.notebook_dir attribute to change the default directory.
I executed jupyter --config-dir to find the location of the configuration file and executed jupyter notebook --generate-config to generate the configuration file and changed c.NotebookApp.notebook_dir value to the directory I want.
Now if I run jupyter notebook command in cmd, it will start in the directory I mentioned. But if I run from the start menu, it is starting in the default folder.
Does anyone know why this is happening? I tried to change the path in the Start in field in shortcut properties of Jupyter Notebook. After doing that, I am not able to open from the start menu. When I click the Icon, it just opens and closes immediately.
I have (had) the same problem.
My workaround:
Anaconda (version 2018.12) installed in
C:\Anaconda3
When running from Start Menu right click on Jupyter Notebook. In my case there follow two more submenus. The first is More and the second is something like Open folder (I have a German Windows version, so I just can guess the English Menu texts.).
When opening that folder you will see a file (shortcut) with the name Jupyter Notebook. The folder in my case looks like this:
C:\Users\Andreas\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Anaconda3 (64- bit)
Right click this file (shortcut) and edit its properties. There you find the Target of the shortcut, which in my case is (rather longish):
C:\Anaconda3\python.exe C:\Anaconda3\cwp.py C:\Anaconda3 C:\Anaconda3\python.exe C:\Anaconda3\Scripts\jupyter-notebook-script.py "D:\Dropbox\ipython_notebooks"
where I edited the last entry, which is the folder where I store my notebooks.
On my Windows PC, i have anaconda installed and when I open a jupyter notebook, it opens up in internet explorer, but I would like to use Chrome instead. Does anyone know how to achieve this?
If you haven't already, create a notebook config file by running
jupyter notebook --generate-config
Then, edit the file jupyter_notebook_config.py found in the .jupyter folder of your home directory.
You need to change the line # c.NotebookApp.browser = '' to c.NotebookApp.browser = 'C:/path/to/your/chrome.exe %s'
On windows 10, Chrome should be located C:/Program Files (x86)/Google/Chrome/Application/chrome.exe but check on your system to be sure.
Just make chrome as a default browser and launch the jupyter . It will work
To Make Google chrome a default browser , follow steps
Click on Customize and Control Google chrome (The vertical three dots on the Upper right corner of your google chrome browser)
Click on Settings and scroll down to Default browser.
Change the value of the default browser to Google Chrome by clicking on whatever your default browser is there and selecting Google Chrome.
Note: In windows 10, you will be redirected to Default apps under your computer's Settings. Please scroll down to Web browser and Select Google Chrome. If promted, Click on OK else just close the settings tab and return to your command or anaconda prompt and type jupyter notebook as usual. A new jupyter notebook tab should open in Google Chrome now.
For those who still have trouble launching Chrome automatically from cmd, try replacing
# c.NotebookApp.browser =''
in the file jupyter_notebook_config.py with
import webbrowser
webbrowser.register('chrome', None, webbrowser.GenericBrowser('C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'))
c.NotebookApp.browser = 'chrome'
or the appropriate location, there shouldn't be need to install anything via pip.
Ref: https://support.anaconda.com/customer/en/portal/articles/2925919-change-default-browser-in-jupyter-notebook
Create and edit the jupyter notebook config file with the following steps:
Launch Anaconda Prompt
Type jupyter notebook --generate-config
Type notepad path_to_file/jupyter_notebook_config.py to open it (change path_to_file)
Modify #c.NotebookApp.browser = '' to c.NotebookApp.browser = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'
Save the file and close it
Jupyter notebook will now use Chrome.
EDIT
In Windows 10 I had to type
notepad .jupyter/jupyter_notebook_config.py
And substitute the line with
c.NotebookApp.browser = 'C:/Program Files/Google/Chrome/Application/chrome.exe %s'
step1: Go to search menu of windows and type default app.
step 2: go to WEB BROWSER title and change it to Google Chrome.
step3: Go to search menu of windows and type jupyter notebook
This will open the jupyter notebook in Google Chrome
Run the jupyter notebook --generate-config command on the anaconda prompt.
Then edit the jupyter_notebook_config.py file.
Find the c.NotebookApp.Browser like this:
c.NotebookApp.browser = 'c:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'
Works on mine.
Take any html file on your computer and set the default browser to open html files to chrome. This will automatically open jupyter notebook with chrome. Worked for me.
For windows set the default browser to open html files to Chrome. Configuration > Default Apps > Default Apps by File Type. Worked for me.
I found an easier solution that may help beginners to coding.
go to
C:\Users\'-your user-'\AppData\Roaming\jupyter\runtime
and find a file named
nbserver-6176-open.html
then
Right-click > open with > Choose default program...
Here, what ever you choose would be saved on your Windows to open all HTML files; therefore when you run Jupyter notebook, it would open in the program you want.
You don't have to change anything in the jupyter config code, you just have to make Chrome as your default browser in the setting. Jupyter opens whichever is the default.
For some reason Louise's answer didn't work for me I had to:
-Open anaconda prompt and generate the config file for Jupyter: jupyter notebook --generate-config
-Open the newly created config file at: C:\Users\builder\.juptyer\jupyter_notebook_config.py
-Add the following to the file:
import webbrowser
webbrowser.register('chrome', None, webbrowser.GenericBrowser(r'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'))
c.NotebookApp.browser = 'chrome'
I just followed 2 steps and everythings working as expected
step-1
set chrome executable path environment varibale, in my case it is(you can test it in cmd by typing chrome and enter, it will open your chrome browser if path set properly):-
C:\Program Files\Google\Chrome\Application\chrome.exe
step-2 just run below command and you are good to go
jupyter notebook --browser chrome
See response on this thread that has worked for me:
https://stackoverflow.com/a/62275293/11141700
NOTE - Additional STEP 3 that has made the difference for me compared to similar approaches suggested here
In short:
Step 1 - Generate config for Jupyter Notebook:
jupyter notebook --generate-config
Step 2 - Edit the config file using "nano" or other editor
The config fileshould be under your home directory under ".jupyter" folder:
~/.jupyter/jupyter_notebook_config.py
Step 3 - Disable launching browser by redirecting file
First comment out the line, then change True to False:
c.NotebookApp.use_redirect_file = False
Step 4 - add a line to your .bashrc file to set the BROWSER path
export BROWSER='/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe'
For me it was Chrome under my Windows Program File. Otherwise any linux installation under WSL doesn't have a native browser to launch, so need to set it to the Windows executable.
Step 5 - restart .bashrc
source .bashrc
In the windows when we open jupyter notebook in command prompt we can see the instructions in first 10 lines in that there is one instruction- "to open notebook, open this file in browser file://C:/Users/{username}/appdata/roaming/jupyetr/runtime/nbserver-xywz-open.html " , open this html with browser of your choice.
If you tried all these "solutions" and still doesn't work, try to open the url over HTTP (not HTTPS <-- the real problem with chrome) and using an Incognito window (press Ctrl + Shift + N on Chrome)
This worked for me. Hope it helps
I just set chrome as my default browser and jupyter launches in Chrome now.
However, we have also the following approach, but it did not work for me:
"CONDA version 4.7.5 and jupyter 6.0.0. - Windows 10"
1) Open Anaconda and launch your environment in terminal
2) Create config file and open file in notepad
3) Modify line of NotebookApp with chrome and save modification
4) Launch Jupyter
:( ... but it still launches in Mozilla.
I'm trying to access an ipython notebook that was saved to an external HD. Is this possible?
Specifically, I saved an ipython notebook to a dropbox folder (locally synced) on one computer. I am now trying to open that ipython notebook on another computer that syncs to the same dropbox account -- only computer b's dropbox folder is on an external HD.
This seems so basic, but I've looked everywhere for an answer on this and am afraid I'm missing something more fundamental here.
Create a symbolic link to your external drive; store this link somewhere on the main drive.
For example, my Dropbox folder is on an external flash card, so I used a terminal session to do the following:
$ ln -s /Volumes/SDCARD/Dropbox ~/Documents/DB
(Screenshots here)
From terminal, if you have Anaconda installed, type:
jupyter notebook --notebook-dir=/Volumes/NameofExternalDrive