IPython notebook connection failed issue - python-3.x

This is probably very simple; and I am embarrassed to ask; but I spent a long time trying to solve it already. I am trying to use an IPython notebook and on the click to get a Python 3 notebook, I often (but not always) get:
Connection failed
A connection to the notebook server could not be established. The notebook will continue trying to connect, but until it does, you will NOT be able to run code. Check your network connection or notebook server connection."
The obvious answer might appear that I have no internet connection; but I can access the internet and interact with external websites. It seems to be a problem of connecting with something local to my computer.
The really frustrating part is that sometimes in the past this has worked with no problem. That suggests to me that it is a simple setting issue. Does anyone have suggestions about how I can debug this?
My operating system is Windows (both 7, and 8.1). I am also using Anaconda 2.3 and Python 3.4

Downgrade Tornado to 5.1.1 from 6.0, that will solve it.
Apparently, Tornado 6.0 breaks notebook.

I anwser a similar question. And I agree with tchakravarty.
Maybe resulting from your proxy?I have been troubled for one afternoon for that,because I use nginx proxy_pass fo my jupyter to proxy to that port. But it always didn't connect, i look through the docs of jupyter notebook and found that Jupter Proxy Issue
And i change to use nginx rewrite rather than proxy, it works. So in my case, it can be caused by proxy.

I was also facing the same problem and as the few people suggested to update the tornado version , I did but it din't help.
What helped me was ---
I ran this two following commands -
python2 -m pip install --upgrade ipykernel
python2 -m ipykernel install
In Jupyter Notebooks, the kernel is responsible for executing Python code. When you install the Anaconda System for Python3, this version also becomes the default for the notebooks. In order to enable Python 2.7 in your notebooks, you need to install a new kernel.

Related

RHEL 7.6 - Built Python3.6 from Source Broke Network

I have a RHEL system which by default was running Python2.7 and Python3.4
I needed Python3.6 for a project I wanted to work on and so I downloaded it and built it from source. I ran make and make install which hindsight may have been the wrong decision.
Now I do not seem to have any internet connectivity. Does anyone know what I may have over written to cause this or at least where specifically I can look to track this issue down?
Note: I can Putty into the Linux machine but it doesn't seem to have any other connectivity, specifically HTTPS
It's a bit weird that this would break network connectivity. One possible explanation is that the system has networking scripts or a network manager that relies on Python, and it got broken after make install replaced your default Python installation. It may be possible to fix this by reinstalling your RHEL Python packages (sorry, cannot offer more detailed help there, as I don't have access to a RHEL box).
I guess the lesson is "be careful about running make install as superuser". To easily install and manage different Python versions (separate from the system Python), the Anaconda Python distribution would be a good solution.
I suggest to undo that 3.6 installation and use the Software Collections version of python 3.6. See here for python 3.6 installation. Software Collections install "along side" the original versions so as to not affect the OS - and they are included in the subscription.
So after a lot of time slamming my head against the wall I got it worked out. My best guess is that the system (RHEL 7) relied on something from its default Python2.7 installation to handle SSL negotiations. Installing 3.6 alongside must have overwritten some pointer. Had I done this correctly, with altinstall all would have likely been fine.
The most frustrating part of this is that there were no error messages, connections just timed out.
To fix this, I had to uninstall all Python versions and then reinstalled Python2.7 - Once Python2 was back in the system it all seemed to work well.

PyCharm will not perform a requests module update to the newest version

I am having difficulty running a piece of requests code in my IDE PyCharm. The code is very basic and will work on my system for every website except one. Here is the code I am running:
import requests
initialURL = 'http://www.acastipharma.com/'
r = requests.get(initialURL)
When I run this code I get an error message that terminates with
requests.exceptions.SSLError: HTTPSConnectionPool(host='www.acastipharma.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:645)'),))
I first thought this was an SSL problem, but if I run the requests command with the verify=False switch I still get the same error. This leads me to believe that the problem is not an SSL problem. I tried running the same code from a different IDE and the error did not occur which led me to believe the problem lies with my IDE PyCharm. I tried using a different project interpreter in PyCharm and the error also did not occur. I realized that the two different PyCharm project interpreters used different versions of requests and every PyCharm project interpreter I use that has the most recent version of requests the code will work but if the PyCharm project interpreter uses an older version of requests the error appears. Unfortunately PyCharm for some reason will not allow me to update the requests module in the PyCharm project interpreter I am using. Here is the error message I get from PyCharm when I attempt to update requests:
Could not find a version that satisfies the requirement requests==2.19.1 (from versions: )
No matching distribution found for requests==2.19.1
PyCharm then suggests that I run the upgrade command from terminal:
pip install -U requests==2.19.1
Here is what PyCharm suggests:
Try to run this command from the system terminal. Make sure that you use the correct version of 'pip' installed for your Python interpreter located at '/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5'.
When I run this from terminal I get this:
Requirement already up-to-date: requests==2.19.1 in ./anaconda/lib/python3.5/site-packages (2.19.1)
It seems likely that the upgrade from terminal is occurring to the wrong directory, it is trying to update
./anaconda/lib/python3.5/site-packages
when I need it to update
/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5
Does anybody know how to specify the correct directory for the update when I run the pip install -U requests==2.19.1 command at terminal. Any assistance on how to get requests properly upgraded, whether from within PyCharm or at terminal, would be appreciated.
It turns out the problem was two-fold. The first problem was the version of OpenSSL that the project interpreter I was using was deprecated. I also had two versions of Python 3.5 on my system and whenever I would attempt to update a package (ie. OpenSSL) the version of python that was not used by my project interpreter would update rather than the version of Python 3.5 I was using for the project interpreter. I ended up installing Python 3.7 and creating a project interpreter based on Python 3.7. By having only one version of 3.7 on my system I was able to update the OpenSSL package specifically associated with 3.7 and the problem went away.

Jupyter Notebook's RISE Missing Slideshow Button

I followed the instructions on installing RISE for Jupyter notebook with Anaconda (conda) but the "Enter/Exit RISE Slideshow" button never showed in the toolbar.
I followed the recommendations on solving the problem in the two closed RISE issues (#137, #275), but with no luck. I updated Jupyter to the latest version, started a new notebook, hard refreshed the browser page, reinstalled Rise and still no button.
I also saw this SO question, which is different from my case since I never saw the button, and I do not have nbextensions to begin with. Still, their recommendation did not work.
For practical reasons, I cannot have a separate environment just for RISE and presentation making.
I'm having the same problem on two machines, with different operating systems and different Conda packages, so it may be a RISE package problem. On one of the machines, I have:
Google Chrome 66.0.3359.117 (64-bit)
conda 4.5.1 with python 3.6.4
jupyter 1.0.0
jupyter_core 4.3.0
notebook 5.0.0
rise 5.2.0 py36_0 damianavila82
MacOS High Sierra (10.13.4)
My conda packages seem to be in good shape and without missing dependencies too.
$ jupyter nbextension list
Known nbextensions:
config dir: /Users/welshamy/Applications/anaconda3/etc/jupyter/nbconfig
notebook section
jupyter-js-widgets/extension enabled
- Validating: OK
rise/main enabled
- Validating: OK
This is a package compatibility issue. I solved the problem by doing the following:
Upgrade conda packages from the command line:
$ conda update --all
Restart jupyter-notebook session.
Restart web browser.
Open a new notebook.
Done.
Just restart the browser
if not create a new notebook

IPython Permission Denied

I'm encountering a problem starting an ipython notebook or an ipython console in spyder that results in the error message "Assertion failed: Permission denied (......\src\err.cpp:247) and (in ipython notebook) the kernel endlessly restarts.
I'm using Anaconda installation of python on Windows 7, and have the same problems with both ipython 1.1 and ipython 1.0. I did not have this problem when I ran ipython versions before 1.0, before I switched to Anaconda.
A google search finds another instance of this problem, which suggests that its due to interactions with PyZMQ and a firewall. I've tried adding specific exceptions for python and ipython to my firewall, and turning the firewall off completely, with no change. I can run ipython in command line, but neither the notebook or the console in spyder work (giving the error above.)
Any information about this would be helpful. I couldn't find any file err.cpp in any folder \src\ in my python installation, so I can't confirm what triggers the error has any relation to PyZMQ or firewalls. No change is made when turning off the firewall or elevating the command prompt. What else can I try?
I realise this is two years old, but I've just been able to sort out a similar problem, so it would have been good to see more answers to this.
In my case it wasn't the Windows Firewall or virus scanner, but that my employer's IT services group runs VNC over the same port that is hardcoded into 0MQ, as used by iPython in Anaconda.
Enough people complained that IT provided a script to move the VNC port for affected people, while also logging the change in their own records, so everybody is happy.
Try doing a "netstat -ab" from the command line, and check if anything is listening on port 5905, which iPython needs (at least as it is in early 2016, with Anaconda). You'll need to use "Run As Administrator" with cmd. If you can't do that just use "netstat -a". The difference is the b option will also list the process that has taken the port, and in our case we see vncserve.exe there. But -a is enough to see listening ports.

iPython 3 Notebook raising ImportError: No module named 'IPython.frontend.html'

The iPython 2 console and notebook as well as the iPython 3 console work fine on my system.
But running ipython3 notebook gives an ImportError saying No module named 'IPython.frontend.html' and this traceback.
I think it may have something to do with Ubuntu RR package problems, but I'm not sure.
10x.
Ubuntu split the notebook functionality away form the main ipython3 package into ipython3-notebook in Raring.
Now installing ipython3 should install ipython3-notebook for you automatically as it recommends it; but when I had this problem, Raring critically depended on a package of python3 too high for python3-zmq which was depended on by ipython3-notebook causing ipython3-notebook' to not be installed (which I did not notice). Whew...
This might be due to the fact that the package layout has been change and IPython.frontend.html is now IPython.html do you have dev version installed by any chance ?
I had this problem and fixed it by upgrading ipython (using --upgrade)

Resources