Jupyter - Not sure if not working or broken link - python

I am trying to open a notebook with jupyter, by using the following command:
jupyter notebook notebook.ipynb
I use Linux and python2, I have installed jupyter inside a virtualenvironment with pip.
When I run the command above, what happens is that I get a new screen
REFRESH(1 sec): http://localhost:8889/notebooks/mylink
This page should redirect you to Jupyter Notebook. If it doesn't, click here to go to Jupyter.
However, there is no dashboard opening automatically. So, I clicked on the link, but I am unable to connect. The weird think is that I don't remember what I did yesterday, but I managed to get through very easily.
Am I doing something wrong? Or maybe there is a problem with the link?
EDIT: If I run
jupyter notebook.ipynb
I get
Error executing Jupyter command 'notebook.ipynb': [Errno 2] No such file or directory
which does not make sense, because the file notebook.ipynb is actually there.
If I type
jupyter notebook stop
I get
There are no running servers

Happened to me too. Also their troubleshooting could not resolve the issue. You may note the This Worked An Hour Ago section.
If you are using environments, try creating a new environment and install jupyter notebook from scratch there. For Anaconda it would look like this:
conda create --name jupyter_env
conda activate jupyter_env
conda install -c conda-forge jupyterlab
jupyter notebook
You may change jupyter_env to a differen name of your liking.

What I usually do is run
jupyter notebook
and it will automatically open up the browser with my current directory. I then search for my notebook that way.

I guess one of these could help you fix this one:
change url to http://127.0.0.1:8889/notebooks/mylink or http://0.0.0.0:8889/notebooks/mylink
in case proxy or any other network settings set on your browser, disable them and check twice
if none of them did work, try to enter the url this way: http://localhost:8888/tree?
And, provide logs from console might help as well.
And one more thing, just to make sure, why you're connecting via port 8889? did you tried to run jupyter by --port command option?

Related

Not able to setup vscode.dev to run Python or Jupyter in browser (without downloading or installing)

I am trying to use online browser based version of visual studio code (https://vscode.dev). I installed the extension Python and Jupyter. But when I try to run any code, I get following error.
"Error loading webview: Error: Could not register service workers: NotSupportedError: Failed to register a ServiceWorker for scope".
Looking for your kind help please.
Thanks.
Fast soluton: Open the terminal and type killall code. Easy & lazy solution: Reboot your computer.
If this does not work, try reinstalling or updating vscode
In my case, this was related to a CORS configuration issue. What fixed it for me was launching the notebook from the terminal with the origin specified:
jupyter notebook --no-browser --NotebookApp.allow_origin_pat=https://.*vscode-cdn\.net
If for some reason that doesn't work, you could try the following as a last resort (bearing in mind this will allow ANY origin):
jupyter notebook --no-browser --NotebookApp.allow_origin='*'
Source:
https://github.com/microsoft/vscode-jupyter/wiki/Connecting-to-a-remote-Jupyter-server-from-vscode.dev

Run Jupyter Notebook with Admin Priveleges in Linux

I am trying to webscrape a javascript website. In order to do this I am reviewing a chapter in this text:
https://yanfei.site/docs/dpsa/references/PyWebScrapingBook.pdf
and trying to reproduce an example which uses this script:
from selenium import webdriver
import time
driver=webdriver.Firefox(executable_path='')
driver.get("http://pythonscraping.com/pages/javascript/ajaxDemo.html")
time.sleep(3)
print(driver.find_element_by_id("content").text)
driver.close()
When I run this I get a permission denied error in the third line. I am not completely sure(correct me if I am wrong), but I think the reason is because I am on a Linux machine and I am not running Jupyter notebook as an administrator. However, I cannot figure out how to do that. If I go to the terminal and write:
sudo jupyter notebook
it says that the command is not found, even though just writing jupyter notebook is how I open the application from the command terminal. I have tried running anaconda navigator and the same thing happens. My question is whether or not the administrator issue seems like the correct answer to the above problem, and, more generally, how do I run the application as an administrator.
You maybe haven't got the geckodriver installed? I install pygeckodriver via pip and firefox-geckodriver viz apt and it now works without the "executable_path" parameter

Jupyterlab: Directory keeps redirecting to where jupyter_notebook_config.py is

I am using Windows Subsystem-Linux (WSL-Ubuntu) on Windows.
I have installed jupyterlab on WSL using Miniconda under a separate virtual environment for my own development.
I am using VSCode to access WSL through the built-in terminal.
However, it is a known issue that the current redirect URL does not work when being redirected from WSL.
To resolve the issue of the inability to redirect to nbserver html, I changed c.NotebookApp.notebook_dir = False.
However, it caused my jupyter notebook to always start my current directory (despite being in a different directory) to where jupyter_notebook_config.py is, even when I deleted it.
There is no way to somehow change this error until I reinstall it (including jupyter notebook and core) completely.
The second time it happened was also when I generated the config file to change the Browser value on the config to use the Chrome installed on my original system.
Using jupyter notebook or reinstalling in a different virtual environment also does not work..
Please help and Thanks in advance!!
So I have discovered the underlying problem.. Sometimes when you close your code or terminal on VScode (WSL Extension), your jupyter lab/notebook might not always stop running on the localhost port and thus, is causing you to be redirected to the default location where your config.
This can happen even when you Crtl-C on terminal to stop the server from running...
Thus, just run:
jupyter notebook stop 8888
to make sure that 8888 port is available from all rogue servers and then rerun
jupyter lab / notebook
There is no need to reinstall jupyter etc.!

Error occurred while creating new notebook in Jupyter Notebook [Permission Denied]

I'm trying to open new notebook in Jupyter Notebook. But it's denies my permission.
Along this problem when I try to open one of directories it's throws an Server Error ,It's occurs in every directory
I'm using conda version 4.4.10 , Windows 7 Professional (if it helps)
Launch anaconda as administrator .
It is not a very good idea to run as admin because you may mess up the whole system by putting commands unless you really know what you are doing(professionally). We generally work with computers under "Admin privilege".
What you need to do is, to make sure you are at "c:\users\your username". If you are not there: type "c: cd\Users\your username".
You are probably at "C:\> " when you try to open "jupyter notebook". Hope that helps!
This error occurred due to window defender .
add jupyter app to allowed app in firewall & protection .
i hope the problem is solved.
if you are going through anaconda prompt. just click on Anaconda navigator and lanch jupyter notebook from here, if your page opened in internet explorer just copy URL and paste in chrome and now re-try to create a new notebook. I hope it will work

Why my code does'nt execute on ipython notebook?

I am totally new to jupyter notebook and I was trying to run a simple code and its not working.
I typed print (1) and hit ctrl + enter, and then that asterisk mark appeared and thats pretty much it. there is a blinking "connected" in the console as well.
Command window looks like this:
Any tip regarding this would be highly appreciated. Thank you
yes, as Teemo pointed out all I had to do was use this,
C:\Python27\Scripts>jupyter notebook --port=8889
instead of,
C:\Python27\Scripts>jupyter notebook.
port 8889 , worked like a charm :)
using Jupyter on a VM, this was also for me the solution. Additionally, you can create a config file with:
jupyter notebook --generate-config
and search In your jupyter_notebook_config.py file for c.NotebookApp.port = 8888 (and change the port to 8889)
so you don't have to manually add the port every time jupyter is called.
I had the same issue and changing the host port didn't solve anything. I finally had to uninstalled the jupyter network package. I installed it has well through "pip install", I'd suggest to uninstall it as well using and only reinstalling it with the following through conda:
conda uninstall jupyter notebook
pip uninstall jupyter
pip3 uninstall jupyter
conda install jupyter notebook

Categories

Resources