I followed the instructions here.
I am on the Ubuntu VM via SSH.
I tried to access IP:8000 but Chrome says the Site can't be reached. Port 8000 is indeed open by default as mentioned in the docs.
Instructions don't mention if I have to start jupyterhub so I tried that and got this error -
username#fastai:~ $ jupyterhub
[I 2018-04-02 00:25:41.018 JupyterHub app:871] Writing cookie_secret to /home/username/jupyterhub_cookie_secret
[I 2018-04-02 00:25:41.036 alembic.runtime.migration migration:117] Context impl SQLiteImpl.
[I 2018-04-02 00:25:41.037 alembic.runtime.migration migration:122] Will assume non-transactional DDL.
[I 2018-04-02 00:25:41.067 alembic.runtime.migration migration:327] Running stamp_revision -> 3ec6993fe20c
[W 2018-04-02 00:25:41.388 JupyterHub app:955] No admin users, admin interface will be unavailable.
[W 2018-04-02 00:25:41.389 JupyterHub app:956] Add any administrative users to `c.Authenticator.admin_users` in config.
[I 2018-04-02 00:25:41.389 JupyterHub app:983] Not using whitelist. Any authenticated user will be allowed.
[E 2018-04-02 00:25:41.414 JupyterHub app:1525] Failed to bind hub to http://127.0.0.1:8081/hub/
[E 2018-04-02 00:25:41.414 JupyterHub app:1623]
Traceback (most recent call last):
File "/anaconda/envs/py35/lib/python3.5/site-packages/jupyterhub/app.py", line 1621, in launch_instance_async
yield self.start()
File "/anaconda/envs/py35/lib/python3.5/site-packages/jupyterhub/app.py", line 1523, in start
self.http_server.listen(self.hub_port, address=self.hub_ip)
File "/anaconda/envs/py35/lib/python3.5/site-packages/tornado/tcpserver.py", line 142, in listen
sockets = bind_sockets(port, address=address)
File "/anaconda/envs/py35/lib/python3.5/site-packages/tornado/netutil.py", line 197, in bind_sockets
sock.bind(sockaddr)
OSError: [Errno 98] Address already in use
Before I read about jupyterhub in the docs, I tried starting jupyter notebook which gave me this error.
[C 04:00:12.963 NotebookApp] Bad config encountered during initialization:
[C 04:00:12.963 NotebookApp] No such notebook dir: ''/dsvm/Notebooks''
It seemed to run fine after generating a config file using jupyter notebook --generate-config and editing it but I still couldn't reach it via Chrome despite opening up all ports.
UPDATE
Today I installed an X2Go client and found the jupyter notebook icon on the desktop but starting that threw this error -
Failed to run Jupyter.desktop
Failed to parse the desktop file: Key file contains line '/anaconda/pkgs/notebook-5.4.0-py27_0/info/icon.png' which is not a key-value pair, group, or comment
Looks like that file calls jupyter notebook which throws the same error as before.
JupyterHub should be running on port 8000 at startup. Can you double-check its status with systemctl status jupyterhub? And have you double-checked in the portal that port 8000 is open?
If JupyterHub reports that it's running and listening on port 8000, there may be a firewall blocking the connection. Some users have had success with forwarding port 8000 over SSH in this case, then connecting to localhost:8000.
This was caused by a bug which has since been fixed on the later versions of the Deep learning VM.
See this Github issue for more details.
Related
I have been launching Jupyter Notebook for years using the following command:
jupyter-notebook --port=7000 --no-browser --no-mathjax
When I try to open the jupyter on the browser it ask me for a password, even though I have never set any before.
It is important to note that If I do set the port to a value different than 7000 (eg., the default 8888) the interface will open with no problem
I am running jupyter locally, and on the following setup:
Python 3.5.2
With the following modules installed:
jupyter (1.0.0), jupyter-client (4.4.0), jupyter-console (5.0.0), jupyter-core (4.2.1), ipykernel (4.5.2), ipython (5.1.0), ipython-genutils (0.1.0), nbconvert (4.3.0), nbformat (4.2.0), notebook (4.3.0)
NOTE: I have no jupyter configurations file
Following are some of the output lines from the server:
[I 19:16:24.358 NotebookApp] Serving notebooks from local directory: /Users/my_user_name
[I 19:16:24.358 NotebookApp] 0 active kernels
[I 19:16:24.358 NotebookApp] The Jupyter Notebook is running at: http://localhost:7000/?token=aa0dab6e2d85766f3e2e4f0f6633e4473db56a56c94cac76
[I 19:16:24.358 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
And follwing are messages after I try to open it on the browser (using port 7000)
[I 19:21:56.848 NotebookApp] 302 GET /tree (::1) 8.46ms
[D 19:21:56.857 NotebookApp] Using contents: services/contents
[D 19:21:56.919 NotebookApp] Path base/images/favicon.ico served from /usr/local/lib/python3.5/site-packages/notebook/static/base/images/favicon.ico
[D 19:21:56.920 NotebookApp] Path components/jquery-ui/themes/smoothness/jquery-ui.min.css served from /usr/local/lib/python3.5/site-packages/notebook/static/components/jquery-ui/themes/smoothness/jquery-ui.min.css
[D 19:21:56.922 NotebookApp] Path components/jquery-typeahead/dist/jquery.typeahead.min.css served from /usr/local/lib/python3.5/site-packages/notebook/static/components/jquery-typeahead/dist/jquery.typeahead.min.css
[D 19:21:56.923 NotebookApp] Path style/style.min.css served from /usr/local/lib/python3.5/site-packages/notebook/static/style/style.min.css
[D 19:21:56.925 NotebookApp] Path auth/css/override.css served from /usr/local/lib/python3.5/site-packages/notebook/static/auth/css/override.css
[D 19:21:56.926 NotebookApp] Path components/es6-promise/promise.min.js served from /usr/local/lib/python3.5/site-packages/notebook/static/components/es6-promise/promise.min.js
[D 19:21:56.926 NotebookApp] Path components/requirejs/require.js served from /usr/local/lib/python3.5/site-packages/notebook/static/components/requirejs/require.js
[D 19:21:56.933 NotebookApp] Path base/images/logo.png served from /usr/local/lib/python3.5/site-packages/notebook/static/base/images/logo.png
[D 19:21:56.934 NotebookApp] 200 GET /login?next=%2Ftree (::1) 80.86ms
[D 19:21:57.001 NotebookApp] Path custom.css served from /usr/local/lib/python3.5/site-packages/notebook/static/custom/custom.css
[D 19:21:57.003 NotebookApp] 304 GET /custom/custom.css (::1) 3.11ms
[D 19:21:57.341 NotebookApp] Path auth/js/main.min.js served from /usr/local/lib/python3.5/site-packages/notebook/static/auth/js/main.min.js
[D 19:21:57.344 NotebookApp] 200 GET /static/auth/js/main.min.js?v=20161219191623 (::1) 3.57ms
At this point there is a page from jupyter asking me to insert a password I have never set before.
SOLVED!
With latest update of notebook module (4.3.1) the problem has been solved.
Once the jupyter notebook is launched the user is prompted to paste a URL into the browser at the first connection:
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:7000/?token=32be0f5ee74cfe521187bc479855ce8b9fbab9e8021701c9
This solved the problem!
The following is very unsafe, but you can remove the password completely with:
jupyter notebook --ip='*' --NotebookApp.token='' --NotebookApp.password=''
Without --NotebookApp.password='', when connecting from a remote computer to a local Jupyter launched simply with:
jupyter notebook --ip='*'
it still asks for a password for security reasons, since users with access can run arbitrary Python code on the server machine!
Note that on my machine, running just:
jupyter notebook
already opens a logged-in window on my browser, and stdout contains:
To access the notebook, open this file in a browser:
file:///home/ciro/.local/share/jupyter/runtime/nbserver-3286-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=7c9265bf9df5f57cf5da88f410a71b097e2548ae375826b7
or http://127.0.0.1:8888/?token=7c9265bf9df5f57cf5da88f410a71b097e2548ae375826b7
so if your browser is not opening automatically, you can try one of those links, which seem to have a login token on them, and then investigate why your browser is not opening automatically.
Tested on Jupyter 4.4.x, Ubuntu 18.04.
How to avoid "Invalid credentials" by disabling jupyter Notebook Password & Token
First open Anaconda Prompt
Enter the command jupyter notebook --generate-config
From jupyter directory ,edit the jupyter_notebook_config.py
made changes into the following command
c.NotebookApp.token = ''
c.NotebookApp.password = u''
c.NotebookApp.open_browser = True
c.NotebookApp.ip = 'localhost'
Now launch the jupyter notebook from anaconda navigator definitely the problem will be resolved as soon..
If you are trying to run from docker without password just use CMD like bellow:
CMD ["jupyter", "notebook", "--no-browser","--NotebookApp.token=''","--NotebookApp.password=''"]
Notebook 4.3.0 has enabled login security by default. The token to enter in the password field is printed in the output of the notebok server during startup (or can be included directly in the URL)
The Jupyter Notebook is running at: http://0.0.0.0:8888/?token=f3e7fa23fb7e347ad05914368b625416b7a95a674dc078f7
See http://jupyter-notebook.readthedocs.io/en/latest/security.html#server-security for more info, including disabling the feature.
However, this would not explain why you get the password prompt when running on one port but not on another
You can first create a jupyter config file with:
cd ~/.jupyter
jupyter notebook --generate-config
Then set the c.NotebookApp.token parameter to an empty string in the configuration file created
c.NotebookApp.token = ''
As mentioned in comment, Setting to an empty string disables authentication altogether, which is NOT RECOMMENDED.
The same issue occured on my machine since the last update of the jupyter-notebook package. After installing version
jupyter-notebook-4.3.0-1-any.pkg.tar.xz
it prompted me for a password I never set.
Downgrading to
jupyter-notebook-4.2.3-1-any.pkg.tar.xz
worked for me keeping the system a productive environment. Of course this is just a fast patch.
I also wondered where the password was set since I don't have an explicit config file in my .jupyter-folder. Setting up my own with
password_required=False
made no difference.
For me, the solutions described above was not applicable in Docker.
The following solution works like a charm on Linux:
Details:
used image: tensorflow/tensorflow:latest-py3-jupyter
password I configured: 'password'
run Jupyter as a user (not root)
Steps to start Jupyter in Docker with your pre-defined password:
export JUPYTER_TOKEN='password'
docker run -it --rm -p 8888:8888 -u $(id -u ${USER}):$(id -g ${USER}) -e JUPYTER_TOKEN=$JUPYTER_TOKEN -v /home/<user>/jupyter:/tf/ tensorflow/tensorflow:latest-py3-jupyter
open http://localhost:8888 and use 'password' as your password
save password in ypur browser
For me, that is the easiest way to get rid of the annoying token authentication.
I solved the token authentication by replacing the password inside jupyter_notebook_config.json by running jupyter notebook password on the command line:
(base) C:\WINDOWS\system32>jupyter notebook list
http://localhost:8888/ :: C:\Users\320089053
http://localhost:8889/ :: C:\Users\320089053
(base) C:\WINDOWS\system32>jupyter notebook list
Enter password:
Verify password:
[NotebookPasswordApp] Wrote hashed password to C:\Users\320089053\.jupyter\jupyter_notebook_config.json
If you are trying to run from docker, there are different ways how u can disable authentication
If it is a simple docker run , we can try like this
docker run -p 8888:8888 jupyter/minimal-notebook:57f8546c0386 start-notebook.sh --NotebookApp.token=''
If we are building an image with jupyter/minimal-notebook as base image,
Create a custom-start.sh file
jupyter notebook --allow-root --no-browser --ip=0.0.0.0 --port=8888 --NotebookApp.token='' --NotebookApp.password=''
Add the below lines in docker file
COPY custom-start.sh /usr/local/bin/ RUN chmod +x
/usr/local/bin/custom-start.sh CMD ["custom-start.sh"]
If it is a docker-compose file
version: '3.8'
services:
some_name:
ports: ['8888:8888'] # docker run -p option
image: jupyter/minimal-notebook:57f8546c0386
command: start-notebook.sh --NotebookApp.token=''
This answer is just to summarize what others said and give my two cents on the token thing discussed in the other answers.
What happened to the OP is a password for Jupyter instances is set -- somewhere -- in his environment. (He either set it directly or indirectly, it doesn't matter...in my case, I'm pretty sure I intentionally set it back in the days and then forgot about it.) The situation is a jupyter notebook instance that can not be used because password is unknown/lost/forgot.
There are two ways to do it permanently:
Change the password using Jupyter cli:
$ jupyter notebook password
I tried to set an empty password here but apparently Jupyter does not allow that, something is generated for you if you don't fill it.
Edit your Jupyter config1. In particular, I wanted Jupyter to stop asking for a passwork/token:
I substituted the NotebookApp-token value I had in my jupyter_notebook_config.json for an empty string:
$ cat ~/.jupyter/jupyter_notebook_config.json
{
"NotebookApp": {
"token": ""
}
}
That's it. Now, whenever a new instance of jupyter notebook comes up you should NOT be asked for a password or token.
First open Anaconda Prompt, then enter the command
jupyter notebook --generate-config
In my case the file was stored in the following directory (the Jupyter Notebook Server configuration directory)
C:\Users\<username>\.jupyter
In this directory, edit the jupyter_notebook_config.py file to change the following configuration settings:
c.NotebookApp.token = ''
c.NotebookApp.password = u''
c.NotebookApp.open_browser = True
c.NotebookApp.ip = 'localhost'
Save the file, and then restart Jupyter Notebook Server to pick up the configuration change.
Set a default password using below command
jupyter notebook password
Restart your notebook and enter the same password in the Browser
There is jupyter_notebook_config.json file that is more priority than jupyter_notebook_config.py file, so you need to edit this json file, to find this directory, use this command
jupyter notebook --generate-config
this will create jupyter_notebook_config.py and show the location of that file, which will be in the same directory as jupyter_notebook_config.json, open jupyter_notebook_config.json and set the password value to "", this works on my side
Use the command jupyter notebook password to open jupyter & it asks to enter a new password.
The hashed password is updated in the jupyter_notebook_config.json file.
I have the following containers when running docker-compose ps:
Name Command State Ports
---------------------------------------------------------------------------------
rainmaker_db_1 docker-entrypoint.sh mysqld Up 0.0.0.0:3306->3306/tcp
rainmaker_python_1 python -u /app/run.py Up 0.0.0.0:5000->5000/tcp
I want to run jupyther inside the container rainmaker_python_1, so I am running the following command:
docker-compose exec python jupyter notebook --allow-root
Then I get the following output:
[I 23:03:19.168 NotebookApp] Serving notebooks from local directory: /app
[I 23:03:19.168 NotebookApp] 0 active kernels
[I 23:03:19.168 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/?token=35ff0fa9ec171204dbd7542d9c493c760055de24e1b7af18
[I 23:03:19.168 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 23:03:19.169 NotebookApp] No web browser found: could not locate runnable browser.
[C 23:03:19.169 NotebookApp]
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?token=35ff0fa9ec171204dbd7542d9c493c760055de24e1b7af18
However, if I copy and paste the link http://localhost:8888/?token=35ff0fa9ec171204dbd7542d9c493c760055de24e1b7af18 I get that the site cannot be reached. Then I tried:
http://localhost:5000/?token=35ff0fa9ec171204dbd7542d9c493c760055de24e1b7af18
But I get the following:
I wanna be able to execute the jupyter notebook, so please I hope somebody could help me. I have almost no experience with Docker.
It seems like the default port number for Jupyter notebooks is 8888. You can see this in the console output when your Docker container is launching Jupyter.
Either change your port mappings in your Docker compose file, like I do below, or look to see if there's an environmental variable you can set in the Docker compose file to make a Docker / Jupyter to run on the port you do have open (5000).
Below, the Docker compose section sets up a Node server on port 8888 (thanks copypasta) , but should provide enough example to change yours) - really the only important line is the ports line.
version: '2'
services:
nodejs:
build:
context: .
dockerfile: DockerFile
ports:
- "8888:8888"
I have been launching Jupyter Notebook for years using the following command:
jupyter-notebook --port=7000 --no-browser --no-mathjax
When I try to open the jupyter on the browser it ask me for a password, even though I have never set any before.
It is important to note that If I do set the port to a value different than 7000 (eg., the default 8888) the interface will open with no problem
I am running jupyter locally, and on the following setup:
Python 3.5.2
With the following modules installed:
jupyter (1.0.0), jupyter-client (4.4.0), jupyter-console (5.0.0), jupyter-core (4.2.1), ipykernel (4.5.2), ipython (5.1.0), ipython-genutils (0.1.0), nbconvert (4.3.0), nbformat (4.2.0), notebook (4.3.0)
NOTE: I have no jupyter configurations file
Following are some of the output lines from the server:
[I 19:16:24.358 NotebookApp] Serving notebooks from local directory: /Users/my_user_name
[I 19:16:24.358 NotebookApp] 0 active kernels
[I 19:16:24.358 NotebookApp] The Jupyter Notebook is running at: http://localhost:7000/?token=aa0dab6e2d85766f3e2e4f0f6633e4473db56a56c94cac76
[I 19:16:24.358 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
And follwing are messages after I try to open it on the browser (using port 7000)
[I 19:21:56.848 NotebookApp] 302 GET /tree (::1) 8.46ms
[D 19:21:56.857 NotebookApp] Using contents: services/contents
[D 19:21:56.919 NotebookApp] Path base/images/favicon.ico served from /usr/local/lib/python3.5/site-packages/notebook/static/base/images/favicon.ico
[D 19:21:56.920 NotebookApp] Path components/jquery-ui/themes/smoothness/jquery-ui.min.css served from /usr/local/lib/python3.5/site-packages/notebook/static/components/jquery-ui/themes/smoothness/jquery-ui.min.css
[D 19:21:56.922 NotebookApp] Path components/jquery-typeahead/dist/jquery.typeahead.min.css served from /usr/local/lib/python3.5/site-packages/notebook/static/components/jquery-typeahead/dist/jquery.typeahead.min.css
[D 19:21:56.923 NotebookApp] Path style/style.min.css served from /usr/local/lib/python3.5/site-packages/notebook/static/style/style.min.css
[D 19:21:56.925 NotebookApp] Path auth/css/override.css served from /usr/local/lib/python3.5/site-packages/notebook/static/auth/css/override.css
[D 19:21:56.926 NotebookApp] Path components/es6-promise/promise.min.js served from /usr/local/lib/python3.5/site-packages/notebook/static/components/es6-promise/promise.min.js
[D 19:21:56.926 NotebookApp] Path components/requirejs/require.js served from /usr/local/lib/python3.5/site-packages/notebook/static/components/requirejs/require.js
[D 19:21:56.933 NotebookApp] Path base/images/logo.png served from /usr/local/lib/python3.5/site-packages/notebook/static/base/images/logo.png
[D 19:21:56.934 NotebookApp] 200 GET /login?next=%2Ftree (::1) 80.86ms
[D 19:21:57.001 NotebookApp] Path custom.css served from /usr/local/lib/python3.5/site-packages/notebook/static/custom/custom.css
[D 19:21:57.003 NotebookApp] 304 GET /custom/custom.css (::1) 3.11ms
[D 19:21:57.341 NotebookApp] Path auth/js/main.min.js served from /usr/local/lib/python3.5/site-packages/notebook/static/auth/js/main.min.js
[D 19:21:57.344 NotebookApp] 200 GET /static/auth/js/main.min.js?v=20161219191623 (::1) 3.57ms
At this point there is a page from jupyter asking me to insert a password I have never set before.
SOLVED!
With latest update of notebook module (4.3.1) the problem has been solved.
Once the jupyter notebook is launched the user is prompted to paste a URL into the browser at the first connection:
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:7000/?token=32be0f5ee74cfe521187bc479855ce8b9fbab9e8021701c9
This solved the problem!
The following is very unsafe, but you can remove the password completely with:
jupyter notebook --ip='*' --NotebookApp.token='' --NotebookApp.password=''
Without --NotebookApp.password='', when connecting from a remote computer to a local Jupyter launched simply with:
jupyter notebook --ip='*'
it still asks for a password for security reasons, since users with access can run arbitrary Python code on the server machine!
Note that on my machine, running just:
jupyter notebook
already opens a logged-in window on my browser, and stdout contains:
To access the notebook, open this file in a browser:
file:///home/ciro/.local/share/jupyter/runtime/nbserver-3286-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=7c9265bf9df5f57cf5da88f410a71b097e2548ae375826b7
or http://127.0.0.1:8888/?token=7c9265bf9df5f57cf5da88f410a71b097e2548ae375826b7
so if your browser is not opening automatically, you can try one of those links, which seem to have a login token on them, and then investigate why your browser is not opening automatically.
Tested on Jupyter 4.4.x, Ubuntu 18.04.
How to avoid "Invalid credentials" by disabling jupyter Notebook Password & Token
First open Anaconda Prompt
Enter the command jupyter notebook --generate-config
From jupyter directory ,edit the jupyter_notebook_config.py
made changes into the following command
c.NotebookApp.token = ''
c.NotebookApp.password = u''
c.NotebookApp.open_browser = True
c.NotebookApp.ip = 'localhost'
Now launch the jupyter notebook from anaconda navigator definitely the problem will be resolved as soon..
If you are trying to run from docker without password just use CMD like bellow:
CMD ["jupyter", "notebook", "--no-browser","--NotebookApp.token=''","--NotebookApp.password=''"]
Notebook 4.3.0 has enabled login security by default. The token to enter in the password field is printed in the output of the notebok server during startup (or can be included directly in the URL)
The Jupyter Notebook is running at: http://0.0.0.0:8888/?token=f3e7fa23fb7e347ad05914368b625416b7a95a674dc078f7
See http://jupyter-notebook.readthedocs.io/en/latest/security.html#server-security for more info, including disabling the feature.
However, this would not explain why you get the password prompt when running on one port but not on another
You can first create a jupyter config file with:
cd ~/.jupyter
jupyter notebook --generate-config
Then set the c.NotebookApp.token parameter to an empty string in the configuration file created
c.NotebookApp.token = ''
As mentioned in comment, Setting to an empty string disables authentication altogether, which is NOT RECOMMENDED.
The same issue occured on my machine since the last update of the jupyter-notebook package. After installing version
jupyter-notebook-4.3.0-1-any.pkg.tar.xz
it prompted me for a password I never set.
Downgrading to
jupyter-notebook-4.2.3-1-any.pkg.tar.xz
worked for me keeping the system a productive environment. Of course this is just a fast patch.
I also wondered where the password was set since I don't have an explicit config file in my .jupyter-folder. Setting up my own with
password_required=False
made no difference.
For me, the solutions described above was not applicable in Docker.
The following solution works like a charm on Linux:
Details:
used image: tensorflow/tensorflow:latest-py3-jupyter
password I configured: 'password'
run Jupyter as a user (not root)
Steps to start Jupyter in Docker with your pre-defined password:
export JUPYTER_TOKEN='password'
docker run -it --rm -p 8888:8888 -u $(id -u ${USER}):$(id -g ${USER}) -e JUPYTER_TOKEN=$JUPYTER_TOKEN -v /home/<user>/jupyter:/tf/ tensorflow/tensorflow:latest-py3-jupyter
open http://localhost:8888 and use 'password' as your password
save password in ypur browser
For me, that is the easiest way to get rid of the annoying token authentication.
I solved the token authentication by replacing the password inside jupyter_notebook_config.json by running jupyter notebook password on the command line:
(base) C:\WINDOWS\system32>jupyter notebook list
http://localhost:8888/ :: C:\Users\320089053
http://localhost:8889/ :: C:\Users\320089053
(base) C:\WINDOWS\system32>jupyter notebook list
Enter password:
Verify password:
[NotebookPasswordApp] Wrote hashed password to C:\Users\320089053\.jupyter\jupyter_notebook_config.json
If you are trying to run from docker, there are different ways how u can disable authentication
If it is a simple docker run , we can try like this
docker run -p 8888:8888 jupyter/minimal-notebook:57f8546c0386 start-notebook.sh --NotebookApp.token=''
If we are building an image with jupyter/minimal-notebook as base image,
Create a custom-start.sh file
jupyter notebook --allow-root --no-browser --ip=0.0.0.0 --port=8888 --NotebookApp.token='' --NotebookApp.password=''
Add the below lines in docker file
COPY custom-start.sh /usr/local/bin/ RUN chmod +x
/usr/local/bin/custom-start.sh CMD ["custom-start.sh"]
If it is a docker-compose file
version: '3.8'
services:
some_name:
ports: ['8888:8888'] # docker run -p option
image: jupyter/minimal-notebook:57f8546c0386
command: start-notebook.sh --NotebookApp.token=''
This answer is just to summarize what others said and give my two cents on the token thing discussed in the other answers.
What happened to the OP is a password for Jupyter instances is set -- somewhere -- in his environment. (He either set it directly or indirectly, it doesn't matter...in my case, I'm pretty sure I intentionally set it back in the days and then forgot about it.) The situation is a jupyter notebook instance that can not be used because password is unknown/lost/forgot.
There are two ways to do it permanently:
Change the password using Jupyter cli:
$ jupyter notebook password
I tried to set an empty password here but apparently Jupyter does not allow that, something is generated for you if you don't fill it.
Edit your Jupyter config1. In particular, I wanted Jupyter to stop asking for a passwork/token:
I substituted the NotebookApp-token value I had in my jupyter_notebook_config.json for an empty string:
$ cat ~/.jupyter/jupyter_notebook_config.json
{
"NotebookApp": {
"token": ""
}
}
That's it. Now, whenever a new instance of jupyter notebook comes up you should NOT be asked for a password or token.
First open Anaconda Prompt, then enter the command
jupyter notebook --generate-config
In my case the file was stored in the following directory (the Jupyter Notebook Server configuration directory)
C:\Users\<username>\.jupyter
In this directory, edit the jupyter_notebook_config.py file to change the following configuration settings:
c.NotebookApp.token = ''
c.NotebookApp.password = u''
c.NotebookApp.open_browser = True
c.NotebookApp.ip = 'localhost'
Save the file, and then restart Jupyter Notebook Server to pick up the configuration change.
Set a default password using below command
jupyter notebook password
Restart your notebook and enter the same password in the Browser
There is jupyter_notebook_config.json file that is more priority than jupyter_notebook_config.py file, so you need to edit this json file, to find this directory, use this command
jupyter notebook --generate-config
this will create jupyter_notebook_config.py and show the location of that file, which will be in the same directory as jupyter_notebook_config.json, open jupyter_notebook_config.json and set the password value to "", this works on my side
Use the command jupyter notebook password to open jupyter & it asks to enter a new password.
The hashed password is updated in the jupyter_notebook_config.json file.
I want to access notebook server remotely via a web browser, the following shows how did I setup my notebook server:
1.generate config file
$ jupyter-notebook --generate-config
$ cd ~/.jupyter
2.Use the following command to create the SSL certificate(Linux and Windows).
req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem
3.edit the profile's configuration file, which is the jupyter_notebook_config.py the password has been generated..
c = get_config()
# You must give the path to the certificate file.
c.NotebookApp.certfile = u'/home/azureuser/.jupyter/mycert.pem'
# Create your own password as indicated above
c.NotebookApp.password = u'sha1:b86e933199ad:a02e9592e5 etc... '
# Network and browser details. We use a fixed port (9999) so it matches
# our Azure setup, where we've allowed :wqtraffic on that port
c.NotebookApp.ip = '*'
c.NotebookApp.port = 9999
c.NotebookApp.open_browser = False
4.start $ jupyter-notebook server
You should now be able to access your Jupyter Notebook at the address https://[PUBLIC-IP-ADDRESS]:9999.
Start notebook:
$ ~ jupyter-notebook
[I 16:46:58.627 NotebookApp] Serving notebooks from local directory: /home/user
[I 16:46:58.627 NotebookApp] 0 active kernels
[I 16:46:58.627 NotebookApp] The Jupyter Notebook is running at: https://SERVER_IP:9999/
[I 16:46:58.627 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
But, when I open my browser(at my home, the notebook server is in my lab) at https://MY_SERVER_IP:9999, the page can not be open. And Chrome-browser returns:
ERR_ADDRESS_UNREACHABLE
What should I do?
Those instructions you followed are a bit dated specifically:
Anaconda is at version 4.
Jupyter comes pre-installed with new Anaconda
Jupyter defaults to port "8888"
You should mention how to get to the modifications you note for the configuration. I ended up going into nano to do it.
You can't use "sudo" with conda.
If you want to install Ipython notebook from scratch on a VPS, and access it via ssh I wrote an updated tutorial here:
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-jupyter-notebook-to-run-ipython-on-ubuntu-16-04
After installing and running Ipython Notebook using command line on the server, you can connect to the notebook using SSH tunnelling with Putty (on windows) or the ssh -L command on Unix-like systems (ie Mac and Linux)
The corresponding port 9999 is block on the server, and the server is Centos7 and iptables is not available to open ports, so use firewall-cmd to active the port:
$ firewall-cmd --zone=public --add-port=9999/tcp --permanent
$ firewall-cmd --reload
If firewallD is not running, just start the service.
I'm on Mac OS 10.10.4.
When I run ipython notebook from command line, it gives me an error Cannot bind to localhost, using 127.0.0.1 as default ip [Errno 49] Can't assign requested address:
Yans-MacBook-Pro:/ yanyang$ ipython notebook
[W 01:32:12.908 NotebookApp] Cannot bind to localhost, using 127.0.0.1 as default ip
[Errno 49] Can't assign requested address
[I 01:32:12.912 NotebookApp] Serving notebooks from local directory: /
[I 01:32:12.913 NotebookApp] 0 active kernels
[I 01:32:12.913 NotebookApp] The IPython Notebook is running at: http://127.0.0.1:8888/
[I 01:32:12.913 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
It will cause more error later. How can I fix it?
localhost:~ yanyang$ lsof | grep 8888
Google 358 yanyang txt REG 1,4 16621568 26888859 /Users/yanyang/Library/Caches/Google/Chrome/Profile 5/Cache/data_4
Google 358 yanyang 90u REG 1,4 16621568 26888859 /Users/yanyang/Library/Caches/Google/Chrome/Profile 5/Cache/data_4
Google 358 yanyang 205u REG 1,4 3072 35352297 /Users/yanyang/Library/Application Support/Google/Chrome/Profile 5/Local Storage/http_127.0.0.1_8888.localstorage
Content of the file in the last line of the above block:
?????z!11?tableItemTableItemTableCREATE TABLE ItemTable (key TEXT UNIQUE ON CONFLICT REPLACE, value BLOB NOT NULL ON CONFLICT FAIL)[!}1indexsqlite_aut?S???widgets:http://127.0.0.1:8888/notebooks/Downloads/PhillyCrime.ipynb{}?*?Qwidgets:http://127.0.0.1:8888/notebooks/Users/yanyang/Downloads/PhillyCrime.ipynb{}
??X?
?widgets:http://127.0.0.1:8888/notebooks/Downloads/PhillyCrime.ipynb?&?Q widgets:http://127.0.0.1:8888/notebooks/Users/yanyang/Downloads/PhillyCrime.ipynb
Thanks to #Petesh, I can use ipython notebook temperately now, using the command below:
ipython notebook --ip=127.0.0.1
And for further solution, I found that in my Mac's "/etc/hosts", 127.0.0.1 is not set to localhost. That's the final solution.