Can open jupyter notebook in browser but cannot open in vscode? - python

I always use jupyter notebook in my chrome notebook, and I find I can use vscode to achieve open jupyter and want to try it.
So I use the anaconda in my WIN10 system to create a jupyter notebook, and I check it's okay to open in my browser.
Then I use this command in my vscode
ctrl+shift+P
and then click the line "jupyter: specify the jupyter server for connection". Then put the jupyter link with token into the "Existing" and enter, but nothing happens even without a error.
More information:
I install the jupyter extensions in my vscode, like the "Jupyter","Jupyter keymap" and "Jupyter notebook renderers"
I can use SSH link to my remote linux server and open the remote .ipynb files in my vscode then I can edit and run code.
I am using: anaconda 3 vs code 1.66.2 windows 10. Please help, and let me know if any more information is required.
Sorry for no pictures as I have not enough reputation. I upload a video in Youtube (https://youtu.be/p_TYceK9dkI).
I guess Jupyter in vscode can not used as Jupyter in browser? (for the variables vanished when I close my vscode)

You should install jupyter notebook extension so that you can run jupyter on vscode.

Related

Jupyter notebook won't launch after writing "jupyter notebook" in terminal

I have been searching this problem since a while, but can't find a solution. I am working in Windows 10.
After I activate any virtual environment and I write "jupyter notebook", the terminal gets stucked and nothing happens, like in the picture:
No errors appear, I can't Ctrl+C to kill terminal and no browser page appears.
The "jupyter --help" command works, but any other subcommand (like jupyter lab, jupyter nbclassic or jupyter run) doesn't
I tried to do the following, with no results:
Uninstall and install jupyter again
I tried to lunch jupyter notebook with Anaconda Navigator
I tried to open a browser and go to "http://localhost:8889/tree", using different port values
I tried to restart my laptop
Does anyone have any idea what is going on?
Well,
If you've re-installed Anaconda with the default settings, it should set up PATH correctly. So I hope the error is not with PATH environment variable
Try the following:
If Jupyter gives an error that it can’t find notebook, check with pip or conda that the notebook package is installed.
Try running jupyter-notebook (with a hyphen). This should normally be the same as jupyter notebook (with a space), but if there’s any difference, the version with the hyphen is the ‘real’ launcher, and the other one wraps that.
It turned out that jupyter notebook was not starting because I could not ping my localhost (127.0.0.1) because of some bad network settings.
After running netsh winsock reset in a cmd terminal to reset the network settings, I could ping the localhost and jupyter notebook started to work again.

I'm trying to start Jupyter with Anaconda and the notebook doesn't launch. It doesn't display any error either

I'm using Windows OS. I've just installed anaconda and i can see the notebook space. when i click on the jupyter notebook, nothing happens. There is a cmd running in the task manager but nothing else. I've tried a couple of methods out here but nothing makes a difference. My default browser is Chrome too.
There will be a link starting with http://localhost/ in the terminal that you used to launch jupyter lab. Just copy that from the terminal and paste it in the browser.

Just installed Jupyter using Anaconda but can't run it using terminal. Says command not found

I just bought my very first Mac after using Windows my entire life and have been trying to install things. I am also still kind of a beginner at programming.
I installed Anaconda for Python 2.7 version, and then I installed the 3.7 version right after.
I tried going to terminal and typing jupyter notebook but it says:
zsh: command not found: jupyter
I am able to launch a jupyter notebook (I think) when I search for jupyter notebook in spotlight and executing the top hit.
I've been reading a lot on forums about this issue and see a lot of people talking about PATH which I am not really sure about.
I've seen people also post their which python information and theirs seem very different from mine:
which python3
usr/bin/python3
which python
usr/bin/python
Any help would be appreciated! Still learning how to set up this Mac. Thank you.
You might want to refer to this link https://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/execute.html
3.1.2. Change Jupyter Notebook startup folder (Mac OS)
To launch Jupyter Notebook App:
Click on spotlight, type terminal to open a terminal window.
Enter the startup folder by typing cd /some_folder_name.
Type jupyter notebook to launch the Jupyter Notebook App The notebook interface will appear in a new browser window or tab.
From what I can understand you are not changing to the startup directory of Jupyter.
You need to add jupyter to your path.
In your terminal, type in the following command:
export PATH="/PUT JUPYTER PATH HERE:$PATH"
Then try jupyter notebook
Reasoning: If installing using pip install --user, you must add the user-level bin directory to your PATH environment variable in order to launch jupyter lab

Open Jupyter Notebook from a Drive Other than C Drive

I have a machine learning project in drive D. It contains python notebook files. But when I launch jupyter notebook through command prompt, it only shows directories inside drive C. How can I navigate to a drive other than C drive without changing jupyter notebook startup path?. I'm using windows 10 operating system. All the solutions I found, trying to change notebook startup path.
You can launch it from any drive/location you want with the --notebook-dir option.
For example:
jupyter notebook --notebook-dir=D:/
Follow these steps:
Open Anaconda Prompt
Insert this command,
jupyter notebook --notebook-dir=NameOfTheDrive:.
As Example for Drive D, jupyter notebook --notebook-dir=D:
To permanently change the default directory of Jupyter do the following:
Look for the Shortcut to open Jupyter notebook.
Right Click on the Shortcut
Go to Properties.
Look for ....jupyter-notebook-script.py "%USERPROFILE%/"
Change %USERPROFILE%/ to the folder you wish.
Restart Jupyter notebook.
Open the Anaconda Prompt
type the following:
jupyter notebook --notebook-dir=D:\
This is what worked for me in windows.
Okay, this question seems to have already been addresses, but I'd like to add quick step launch solution for this case. I created a batch file (windows .bat file) with the following script and saved it on my desktop. I just double click it to launch the files in the respective drive.
#echo ON
title Launch Jupyter notebooks from Drive D
jupyter notebook --notebook-dir=D:
#echo OFF
Copy paste this code in a text file and save it as a *.bat file on your Desktop. Just fire it up every time you want to launch Jupyter.
You can create various versions of this file for each drive as required and keep them handy.
Another good option is from your terminal go to the disk you want to start jupyter by example :
cd D:
And then launch jupyter notebook
jupyter notebook
If you are using JupyterLab, just type in your desired terminal;
jupyter lab --notebook-dir=D:/
It will create a new port to access D: drive in JupyterLab
Open Jupyter notebook as usual
Click on New\Terminal
Type the code below in terminal, where you want to point to F drive
jupyter notebook --notebook-dir=F:/
Jupter notebook new session url will open in your default internet explorer
you can directly access by following command:
jupyter notebook --notebook-dir=D:/
Alternate method is go to Anaconda Prompt or Anaconda Termial
then Access D drive and launch the jupyter notebook
D:
jupyter notebook
*To change just one time :
user following code in your Anaconda prompt .
jupyter notebook --notebook-dir=E:
*To permanently change the default directory of Jupyter do the following:
Right click on Jupyter notebook icon.
Go to Properties.
In shortcut tab->target you will find something like this -> jupyter-notebook-script.py "%USERPROFILE%/"
Change %USERPROFILE%/ to the folder you want to start from eg : jupyter-notebook-script.py "E:\folder_path".
Restart Jupyter notebook.
My solution is to create a batch file which allows me to execute jupyter at the current directory.
Create a batch file jupy.bat with the following content:
jupyter notebook --notebook-dir=%1
Save the jupy.bat in some folder, let say in d:\scripts
Append d:\scripts in PATH environment variable. So that i can call jupy just everywhere.
From now on, i can go to the folder where i store my notebooks, and execute the command:
jupy .
This is to open Jupiter lab from E Drive
Open Anaconda Prompt
Type the code below in terminal, where you want to point to E drive
jupyter lab --notebook-dir=E:/
My repositories are in the drive R.
I am running Jupyter on Windows 10 in the Ubuntu 18.04, so the drive R is at /mnt/r.
$ nano ~/.bashrc
alias notebook="jupyter notebook --notebook-dir=/mnt/r"
$ source ~/.bashrc
$ notebook
It does not open the browser automatically, so I have to copy the URL manually.
It may ask you to enter the token which you can get by executing:
$ jupyter notebook list
The most easiest solution in my opinion
Open Notepad
Paste the command "jupyter notebook --NotebookApp.iopub_data_rate_limit=1.0e10"
Save the notepad file with an extension of ".bat" instead of ".txt"
Paste the file in which directory you want to initialize your jupyter
Double click and open the ".bat" file
Jupyter opens with desired directory as base
This way you control the jupyter root directory as and when required and don't
really have to perform any manual settings
Hope this helps
".bat" file created on Desktop
".bat" file double clicked and executed
jupyter opens with Desktop as the intended base directory

Can't launch Jupyter Notebook at all

I recently installed the Anaconda Navigator (Anaconda 2) on a Windows 8.1 machine.
If I launch Jupyter Notebook from the Anaconda window, I am met with a 'Page cannot be displayed' error in my browser (Chrome).
I have tried launching Jupyter Notebook from the Anaconda Prompt (no notable error message output). I have also tried opening the Notebook in a different browser (Firefox), and I have tried running the Prompt in Administrator mode. No luck.
I have Jupyter Notebook version 5.6.0 according to the Navigator, but if I type jupyter --version at the prompt it says 4.4.0 (wondering if this is a problem?)
I kind of expected to be able to launch a Notebook right off the bat after installing Anaconda. Is there some set-up I have missed?
(Edit) Tried a few more things, after reading the Jupyter Notebook docs. Tried replacing 'localhost' in the URL with 127.0.0.1, and tried opening the link Chrome with --disable-web-security. Didn't help.
Steps which i will advice:
1) Open your command prompt in the directory which contains your notebook or where you want to create new notebook.
2) Write jupyter notebook in cmd and press enter.
If jupyter notebook is properly installed then it will certainly open, else try reinstalling it.
Note: You can always update your jupyter notebook via conda or pip. At time if you update or install package/IDE via pip, Anaconda terms it as "broken link" and give issue.

Categories