I am creating a local development environtment using Pycharm Professional Edition, Vagrant and Jupyter notebook.
I am able to connect to Jupyter notebook with the browser from the host to the vagrant machine using http://localhost:8888.
I tried to connect to the Jupyter notebook from PyCharm with token but it did not work, so I changed the login option to password, setting it as vagrant.
Also I have change a remote interpreter, which is python3 on the vagrant machine
Despite I have already changed the Jupyter Notebook settings on Pycharm to password login, I receive on the vagrant the following response:
[W 16:47:03.263 NotebookApp] Forbidden
[W 16:47:03.264 NotebookApp] 403 POST /api/kernels (10.0.2.2) 1.35ms referer=None
Is it possible to run remote Notebook with Pycharm and Vagrant?
Related
I can connect to a remote Jupyter Notebook server with a token from VSCode through the "Python: Specify Jupyter server URI" command from the Command Palette.
However, I didn't find a way to do 2 things:
Open an existing Notebook on the remote Jupyter Notebook server.
Specify a folder to connect to, where my existing notebook resides in the remote server.
Is there a way of doing it?
Currently, VSCode doesn't support this functionality. See this issue: https://github.com/microsoft/vscode-python/issues/8161
D:\Python\python.exe "D:\PyCharm 2018.2.1\helpers\pycharm\pycharm_load_entry_point.py" notebook --no-browser --ip 127.0.0.1 --port 8886 --port-retries=0
[TerminalIPythonApp] WARNING | Subcommand `ipython notebook` is deprecated and will be removed in future versions.
[TerminalIPythonApp] WARNING | You likely want to use `jupyter notebook` in the future
[W 17:58:52.576 NotebookApp] Terminals not available (error was No module named 'winpty.cywinpty')
[I 17:58:52.579 NotebookApp] Serving notebooks from local directory: D:\Python projects\Projects
[I 17:58:52.579 NotebookApp] The Jupyter Notebook is running at:
Whenever I run a x.ipynb file it returns the error msg above, i can only access jupyter in browser.
How can I run it within pycharm??
You can use PyCharm as an IDE alternative for editing Jupyter notebooks in a browser, but it won't run a notebook server for you automatically. You can simply open *.ipynb file in PyCharm and it opens with a dedicated notebook editor. When you run a cell for the first time, it is going to ask you about the url of a running notebook, like http://localhost:8888/?token=<token>
You can get this url by running the following in a console:
jupyter notebook list
Running a notebook server is a separate thing. You can do it externally or use a built in 'Jupyer Notebook' run template (via 'Run...' menu'). When you start a server from inside PyCharm this way, you will get your notebook url in a run console.
I'm using python3.5 and jupyter 4.0.6. I launched the jupyter notebook, and get the following output:
[I 21:47:27.021 NotebookApp] Serving notebooks from local directory: /home/nitrous
[I 21:47:27.021 NotebookApp] 0 active kernels
[I 21:47:27.021 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/
[I 21:47:27.022 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 21:47:27.023 NotebookApp] No web browser found: could not locate runnable browser.
on my firefox browser, I typed the specified localhost url: http://localhost:8888/ but I get unable to connect error message. What am I missing? is the hint of the problem on this line:
[W 21:47:27.023 NotebookApp] No web browser found: could not locate runnable browser.
it is my first time using the notebook. I tried to put the below code in the jupyter_notebook_config.py file but to no avail:
c.NotebookApp.open_browser = True
c.NotebookApp.browser = 'firefox'
it also says 0 active kernels. is that a problem?
If you are running your jupyter notebook in a VM (mostly on a linux vm on a windows guest) and trying to access from guest, you will need to launch Jupyter Notebook with right options. Please try to run it like below and it should work.
jupyter notebook --ip=0.0.0.0 --no-browser
Please check the ip of the VM before you enter the URL in firefox. you can use
ifconfig
command for this.
While running Jupyter on my ec2 instance I had faced the same issue.
I resolved it by executing the following command :
jupyter notebook --no-browser
Initially it will show 0 active kernels, once we start creating notebooks on different environments like Python,R etc it will show us the number of active kernels.
I had a similar problem but with Chrome. I dont know in firefox but in chrome, Settings-> Enable guest browsing.
I have a similar problem at first. I solve it by changing the following line in jupyter_notebook_config.py:
c.NotebookApp.browser = r"C:/Program Files (x86)/Google/Chrome/Application/chrome.exe --app=%s"
I guess adding prefix "r" prefix to convert the string to raw string has actually solved this problem.
I have launched an AWS EMR cluster following the steps on the EMR page. After connecting through SSH (putty in Windows 7) and enabling foxyproxy (Chrome), it launched fine and can be accessed in my laptop browser.
Pyspark and sparkR come with the EMR Spark 1.6.0 installation and work perfectly in the terminal.
The ports for Hue etc. work fine in the following format:
ec2-xx-xxx-xxx-xxx.us-west-2.compute.amazonaws.com:/
I installed Jupyter by following the steps on http://jupyter.readthedocs.org/en/latest/install.html#using-pip
sudo pip install jupyter
I opened a new notebook with
jupyter notebook
It opened a browser in the terminal that I shut down. It gave the following output:
[I 14:32:12.001 NotebookApp] Writing notebook server cookie secret to /home/hadoop/.local/share/jupyter/runtime/notebook_cookie_secret
[I 14:32:12.033 NotebookApp] The port 8888 is already in use, trying another random port.
[I 14:32:12.037 NotebookApp] Serving notebooks from local directory: /home/hadoop
[I 14:32:12.037 NotebookApp] 0 active kernels
[I 14:32:12.038 NotebookApp] The Jupyter Notebook is running at: http://localhost:8889/
[I 14:32:12.038 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
I tried accessing it in my browser by:
localhost:8889/
(didn't work of course)
then by:
ec2-xx-xxx-xxx-xxx.us-west-2.compute.amazonaws.com:8889/
(replacing the x's), but this gave an error as well.
This webpage is not available
ERR_CONNECTION_RESET
So how can I access Jupyter in my local browser when it has been installed on the head node of an EMR cluster?
I haven't actually used Jupyter yet, but I tried installing and running it like you did, and I noticed that Jupyter is configured by default to listen only on localhost, which is why you can't access it from your browser.
I then found that running "jupyter notebook --generate-config" would generate a config file ~/.jupyter/jupyter_notebook_config.py, which you can edit in order to make it listen on 0.0.0.0 instead of localhost. Just change c.NotebookApp.ip to '0.0.0.0' and uncomment the line.
After doing this, I was able to access Jupyter from my browser using a URL like http://ip-10-168-157-117.ec2.internal:8888/. (Mine is listening on port 8888 by default, but I'm assuming yours started on port 8889 due to having Hue installed and listening on port 8888 already.)
I've been trying to get ipython/jupyter notebook running as a notebook server on Google Compute Engine (Ubuntu 14.04 VM), but can't connect to the Python kernel.
I started with the latest Anaconda distribution. I can connect to the notebook server from my local machine via the web, browse the directory tree of the VM, and create new notebook, but never connects to the kernel (orange message in the upper right of Jupyter). The notebook port (8888) is open in the firewall settings. iPython notebook returns the following:
[I 19:21:10.152 NotebookApp] Using MathJax from CDN: https://cdn.mathjax.org/mathjax/latest/MathJax.js
[I 19:21:10.169 NotebookApp] Serving notebooks from local directory: /home/rattlerray
[I 19:21:10.170 NotebookApp] 0 active kernels
[I 19:21:10.170 NotebookApp] The IPython Notebook is running at: https://[all ip addresses on your system]:8888/
[I 19:21:10.170 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[I 19:22:13.835 NotebookApp] 302 GET / (98.169.96.157) 0.85ms
[I 19:22:31.902 NotebookApp] Creating new notebook in
[I 19:22:33.634 NotebookApp] Kernel started: 011d8a15-0e4a-448a-b02a-4121780e4bb6
If anyone has run into this before and can offer some things to check, I'd appreciate it. Googling around hasn't helped and I'd really like to get this working on the cloud. Thanks!
I am using EC2 but encounter same problem.
I uses SSL told in the tutorial, after login and open a notebook in Safari always showing "Connecting to kernel". Then I try Chrome, which gives warning about certificate but works fine.
Then I comment the certificate in config file, then open in Safari it works fine.
If you are using Firefox, may be this issue Unable to contact kernel in Firefox after updating to ipython 3.0
Hope this will help.
Update:
The issue is reported on Github: https://github.com/ipython/ipython/issues/8621. As said in the post, this is the limitation of Safari. If you still want to use SSL to visit Notebook, you have to add the certificate into your keychain and trust it. Check the help posted by Apple: https://support.apple.com/kb/PH18677?locale=en_US
Another way you can connect to your IPython (Jupyter) Notebook server is by opening an SSH tunnel with port forwarding. I wrote a how-to post describing my own workflow. I'm using Google Compute Engine from within Chrome but many of the steps are analogous to other setup variations:
https://stharrold.github.io/20151208-ipynb-on-gce-from-chrome.html
Excerpt:
"""
Brief setup routine:
* Start [your] virtual machine instance.
* Start a Jupyter Notebook server on the instance:
$ jupyter notebook --ip=0.0.0.0 --port=8888 --no-browser &
$ disown 1234 (where 1234 is the process ID)
* Create an SSH tunnel to forward a local port to the server's port on the instance:
$ ssh -f -N -L localhost:8888:0.0.0.0:8888 samuel_harrold#123.123.123.123
For [the] Chrome [app] Secure Shell, omit -f to keep the tunnel open (see screenshot [in post]).
* View the server at http://localhost:8888
"""
Additional details are in the post.