Jupyter on Azure can not be reached - azure

I can not access Jupyter notebook on Data science VM in Azure clould.
What I did:
create a Data Science VM for Linux. Resource group, NSG, etc are newly created.
follow the instruction of the command dsvm-more-info. That is
set c.NotebookApp.password (u'sha1:89this89is89a89fake89')
restart jupyter
access https://12.34.56.78:9999/ (The IP address is of course a fake.)
But I can not establish any connection to the server.
SSH works without any problem.
NSG looks OK: TCP/9999 is allowed from all (This is the default setting.)
I tried to https://localhost:9999/ on the VM, but no connection is established.
http://12.34.56.78:9999/ is not working. (Just in case.)
c.NotebookApp.allow_origin = '*' changes nothing.
My subscription is a test version. Is this relevant?
Following Jupyter Documentation, I created mykey.key and mycert.pem and
added absolute paths to the files in jupyter_notebook_config.py. But
this does not help.

You can connect to Jupyter Notebook if you are running it on Ubuntu.
Assuming your jupyter notebook will be running on port:8888 on Azure VM.
First you have to create a SSH tunneling:
On your local computer type:
ssh -L 8080:localhost:8888 username#server_address
Then on Azure start a notebook
jupyter notebook --no-browser
Finally, open http://localhost:8080 in a web browser on your local machine.

The Jupyter notebook is accessed through JupyterHub. You sign in using
your local Linux user name and password.
So, you should connect Jupyter notebook from port 8000, not 9999.
You can access the Jupyter notebook server from any host. Just type https://<VM DNS name or IP Address>:8000/
You also could use netstat -ant to check port listening on your VM. Port 9999 is not listening. So, you could not get it from port 9999.
More information about Jupyter on Azure Data science VM please refer to this link. You could check Jupyter notebook.

Related

Connection Failed to remote jupyter notebook

I'm trying to connect to jupyter notebook running on my remote server. The code below has been working fine for days to forward the jupyter notebook running on the port on my ubuntu server to my mac. It stopped today. Does anyone know what the issue might be? Also does anyone know how I can just open the port on my ubuntu server so I wouldn't need the code below?
code:
ssh -L 8000:localhost:8888 username#111.111.11.122
Update:
code:
jupyter notebook --no-browser --port=8889
Message:
WARNING: The conda.compat module is deprecated and will be removed in a future release.
[I 14:11:23.334 NotebookApp] [nb_conda_kernels] enabled, 2 kernels found
[I 14:11:23.343 NotebookApp] Writing notebook server cookie secret to /run/user/1000/jupyter/notebook_cookie_secret
[I 14:11:24.175 NotebookApp] Serving notebooks from local directory: /home/username
[I 14:11:24.175 NotebookApp] The Jupyter Notebook is running at:
[I 14:11:24.175 NotebookApp] http://localhost:8889/?token=d111b8540568567c80796a3be5cf53229fe38360b411a4dd
[I 14:11:24.175 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 14:11:24.178 NotebookApp]
To access the notebook, open this file in a browser:
file:///run/user/1000/jupyter/nbserver-77790-open.html
Or copy and paste one of these URLs:
http://localhost:8889/?token=d111b8540568567c80796a3be5cf53229fe38360b411a4dd
Update:
code:
ssh -L 8888:localhost:8889 username#111.111.11.122
message:
bind: Address already in use
channel_setup_fwd_listener_tcpip: cannot listen to port: 8888
Could not request local forwarding.
I encounter the same problem time to time. You can try restarting your remote jupyter server (the link contains information to kill existing server and start a new one). Or try a different port number. BTW please share the exact error you face with.
[https://coderwall.com/p/ohk6cg/remote-access-to-ipython-notebooks-via-ssh][1]
Change "ipython" with "jupyter" and make sure jupyter is installed both on remote machine and your machine.
ipython notebook --no-browser --port=8889
jupyter notebook --no-browser --port=8889
This is because you have already opened another Jupyter notebook using port 8888 on your local machine. So solution is simply choosing a different port number, e.g. 8890 or else except 8888 in your case.
The issue seems to be that I needed to type localhost:8888 in to the browser on my local machine. I had been typing in the port I opened the jupyter notebook server on, on my remote machine so localhost:8889. Example
jupyter notebook --no-browser --port=8889
followed by
ssh -N -f -L localhost:8888:localhost:8889 username#111.111.11.122
bang head here.

Unable to start jupyter notebook on the Deep Learning Virtual Machine (DLVM) in MS Azure

I'm trying to train keras models on the Deep Learning Virtual Machine (DLVM)from MS Azure. I've setup a Ubuntu VM and connected to it via ssh from my mac but when I try to run jupyter notebook, I get this error : No such notebook dir: ''/dsvm/Notebooks'', for which I tried the solutions specified in Deep Learning Virtual Machine can't run jupyter "No such notebook dir: ''/dsvm/Notebooks''", but that gives me The Jupyter Notebook is running at:https://[all ip addresses on your system]:9999/
But chrome says my vm's ip : 9999 is not working.
According to the docs jupyter hub should be available at 8000 as soon as the vm starts but I can't access http://my-vm-ip:8000 either.
when I tried systemctl status jupyterhub as recommended here Can't reach Jupyter Notebooks on Azure Deep Learning Virtual Machine, I can see that jupyter hub is indeed listening at 8000 and there is a firewall rule defined at the vm allowing tcp connections to 8000 over the internet.
How do I access jupyter from the DLVM?
JupyterHub should be working and accessible on your VM. Are you connecting via https? Your post says you're using http, but we only support https.
Also, have you have confirmed that port 8000 is open on the Azure portal? Some VMs are created without this port open for various reasons. You might also try restarting the JupyterHub service to confirm it's working properly.
If you want to run Jupyter instead, you will need to fix an issue with the latest Ubuntu DSVM with the Jupyter config file. At a terminal:
sudo -s
source /anaconda/bin/activate py35
jupyter notebook --generate-config --config=/usr/local/etc/jupyter/jupyter_notebook_config.py
You should then open port 8888 in the firewall. Jupyter will then be accessible.
Slight issue with the 3rd command above. It should be "--config=" instead of "config=".
sudo -s
source /anaconda/bin/activate py35
jupyter notebook --generate-config --config=/usr/local/etc/jupyter/jupyter_notebook_config.py
Also please note that the above commands is needed to fix the Jupyterhub issue ("No such notebook dir: ''/dsvm/Notebooks''") also.

Can't connect to "Jenkins-On-Azure"

I created a Jenkins linux vm on Azure on a new resource group.
I followed the steps described here:
Create a Jenkins server on an Azure Linux VM from the Azure portal.
So I ran the command ssh -L 127.0.0.1:8080:localhost:8080 jenkinsadmin#jenkins2517454.eastus.cloudapp.azure.com
(changed the username and dns name to my own) on my linux vm and it seems fine (no errors).
Now whenever I try to connect from my own computer (not on azure) on port 8080 I get on the linux vm the following message: channel 2: open failed: administratively prohibited: open failed and It doesn't let me log in into Jenkins.
How can it be solved?
Thank you
This is not a NSG issue. You don't need add port 8080 on Azure NSG rules.
If you want to connect from your computer with http://localhost:8080/, you should need create a SSH tunnel on your local computer. You could do it with putty.
Configure the Tunnel
Also, you could install Linux on Windows. Please refer to the following steps:
1.Install Linux on Windows.
2.Open Power shell on execute bash
3.Execute sudo -i and ssh -L 127.0.0.1:8080:localhost:8080 jenkinsadmin#jenkins2517454.eastus.cloudapp.azure.com
Now, I could access http://localhost:8080/ on my local computer.(The default user name is admin).
In order to access from external network, you need to "add inbound port rule" as follows:
For more details, refer "Create Jenkins server on an Azure Linux VM from the Azure Portal".

Connecting to Azure Container Services from Windows 8.1 Docker

I've been following this tutorial to set up an Azure container service. I can successfully connect to the master load balancer via putty. However, I'm having trouble connecting to the Azure container via docker.
~ docker -H 192.168.33.400:2375 ps -a
error during connect: Get https://192.168.33.400:2375/v1.30/containers/json?all=1: dial tcp 192.168.33.400:2375: connectex: No connection could be made because the target machine actively refused it.
I've also tried
~ docker -H 127.0.0.1:2375 ps -a
This causes the docker terminal to hang forever.
192.168.33.400 is my docker machine ip.
My guess is I haven't setup the tunneling correctly and this has something to do with how docker runs on Windows 8.1 (via VM).
I've created an environment variable called DOCKER_HOST with a value of 2375. I've also tried changing the value to 192.168.33.400:2375.
I've tried the following tunnels in putty,
1. L2375 192.168.33.400:2375
2. L2375 127.0.0.1:2375
3. L22375 192.168.33.400:2375
4. L22375 127.0.0.1:2375 (as shown in the video)
Does anyone have any ideas/suggestions?
Here are some screenshots of the commands I ran:
We can follow this steps to setup tunnel:
1.Add Azure container service FQDN to Putty:
2.Add private key(PPK) to Putty:
3.Add tunnel information to Putty:
Then we can use cmd to test it:

cygwin/sshd and Virtualbox

I'm using vagrant/VirtualBox on my Window (8.1) Laptop to start up a linux-test-vm from a Cygwin terminal... vagrant up, vagrant ssh, everything is working fine.
Now I want to work on that environment remotely from my main Linux-Workstation, so I've set up sshd in Cygwin and I can successfully ssh into my Windows-Box (same user as logged in locally in windows).
But when I cd'ed (via my remote ssh connection to windows-laptop) in my working directory and ran vagrant ssh, it tells me:
VM must be created before running this command. Run 'vagrant up' first
But I see the VM is running in VirtualBox GUI on Windows.
From this point on even locally on the Windows machine I can no longer interact with the running vagrant vm and the .vagrant (sub)directory has not files inside.
Same happens vice versa:
I stopped/deleted the VM in VirtualBox GUI
ran vagrant up via my ssh connection ... worked
ran vagrant ssh via my ssh connection ... works
but I do not see the VM in VirtualBox GUI on Windows
trying vagrant ssh locally on Windows ... same error again and .vagrant directory gets cleared
So I assume the Cygwin/sshd connection creates some sort of different Sessions that do not share the same "instance" of VirtualBox.
Is there any chance to share VirtualBox/vagrant environment between the local Windows and remote ssh session ???
WORKAROUND:
export ssh-config on the windows host: vagrant ssh-config > ssh_config
from the cygwin/ssh jump into the VM: ssh -F ssh_config default
never run any vagrant command from the cygwin/ssh connection
Vagrant has a built-in solution since the 1.7.x versions called vagrant share which also allows you to remote into a box directly (bypassing the Windows host abstraction). It is generally used for the HTTP feature (eg. to show clients or others on a project the current state of work) but there is the ability to connect to any service running on any port. From the docs:
Just call vagrant share. This will automatically share as many ports
as possible for remote connections. If the Vagrant environment has a
static IP or DNS address, then every port will be available.
Otherwise, Vagrant will only expose forwarded ports on the machine.
Note the share name at the end of calling vagrant share, and give this
to the person who wants to connect to your machine. They simply have
to call vagrant connect NAME. This will give them a static IP they can
use to access your Vagrant environment.
Note to use vagrant share you need a (free) account with hashicorp.

Resources