No connection to kernel - Jupyter Notebook Windows 10 - python

I have Python3 pre-installed on my personal laptop and now i have installed Jupyter Notebook using PIP but when i create a new notebook using python 3 kernel, it always gives orange highlighted message "Connecting to Kernel" but never connects.
OS - Windows 10, Personal laptop
Network - Wifi and not connecting through any proxy
Anti-virus - Uninstalled
Can someone help what could be the issue ?

I found the answer on stack overflow only in another thread.
Uninstall tornado 6
pip uninstall tornado
and reinstall tornado 5
pip install tornado==5.1.1

I had the same issue,i tried uninstalling tornado and reinstalling it ,i tried running it on different port , none of those worked.but i tried this and worked!!!!!
open anaconda ===> Home ====> find jupyter notebook ====> go to the gear icon (settings) ===> first remove it then you see there is a install button under it,after installation it worked for me!!!!

After having issues with this myself, and looking at the Tornado version, I found this wasn't the problem for me, instead after running the following in the relevant environment after installing ipykernel, this resolved the issue:
conda install -n base nb_conda_kernels

jupyter kernelspec list
Should list all kernels running on your system, make sure that the Python kernel path is accurate.
I would also try to run it over another port, in case if any network restrictions

Related

BERT server does not start

I successfully installed BERT server and client.
I tried to start server by typing following code in a Anaconda Prompt
bert-serving-start -model_dir C:\bert\uncased_L-24_H-1024_A-16 -num_worker=4
It supposed to print some responses if the server started properly as shown in https://github.com/hanxiao/bert-as-service#install.
However, in my case, nothing shows in the prompt.
The following is how I fixed the problem.
uninstall bert-serving-server and bert-serving-client
create new virtual environment
downgrade python version to access lower version of tensorflow
download tensorflow1.15
5.install bert-serving-server and bert-serving-client
6.problem solved!!!

IPython console in spyder extremely slow in Anaconda

I'm trying Anaconda/Spyder after using the standard python installation/IDLE for several years. The console (and variable explorer) becomes progressively slower during each work session, with every script and interactive command that I run. Eventually it takes minutes to get a response to simple commands like print, and then it stops responding completely and I shut it down. It's pretty disruptive to my work.
Mac OSX 10.13.6
conda version : 4.5.11
conda-build version : 3.15.1
python version : 3.7.0.final.0
qt 5.9.6
spyder 3.3.1
ipython 7.1.1
I do use matplotlib frequently. Whenever possible I use plt.ioff() at the beginning of a script and/or plt.close('all') at the end. Turning off matplotlib support completely in preferences doesn't help and it's not a permanent fix anyway. Python is not using anywhere near all my CPU or RAM.
As far as I've found out, the problem seems to be with the latest major release of the ipython kernel. Pinning the version of ipykernel to 4.10.0 solved it for me. To do so, add a line containing ipykernel 4.* to the file ~/anaconda3/conda-meta/pinned. Create the file if it does not exist yet. Then conda update ipykernel which will actually downgrade to 4.10.0. Worked for me!
you don't need to downgrade the entire spyder.
For me it worked with downgrading these two:
conda install ipython=6.4.0
conda install ipykernel=4.10.0
So this is not a totally satisfying solution but it seems to be a reasonable temporary fix. If you downgrade your spyder version to 3.1.X you will be able to use the python console rather than the Ipython console, and this seems to work for me. To do this just run:
conda install spyder=3.1
in the terminal while your environment of choice is active. This is not ideal, because the developers removed the python console for a specific reason as mentioned in this question, How to add python console in spyder.
Additionally downgrading this much may have unforeseen effects on other packages your code uses and may cause other issues but so far this is the only solution I was able to come up with.
#Sjoerd Thanks for your answer, this is what worked for me. To be still clearer, here's what I did in terminal on Anaconda 3 on High Sierra:
echo "ipykernel 4.10.0" >> ~/anaconda3/conda-meta/pinned
conda update anaconda
When I tried to update only ipykernel, I would have dependencies errors. By updating anaconda, everything is now up to date but ipykernel which is effectively at version 4.10.0. I didn't experience any hang since then.
#JJR4's answer didn't work for me (seems to work for others). Another workaround is to type %connect_info magic command into the IPython Spyder console which will display the JSON info to connect another console to the kernel.
The output of the magic command explains how to connect, but basically there are three options.
Paste the above JSON into a file, and connect with:
$> jupyter <app> --existing <file>
or, if you are local, you can connect with just:
$> jupyter <app> --existing <kernel>.json
or even just:
$> jupyter <app> --existing
if this is the most recent Jupyter kernel you have started.
I typically use qtconsole as the app. Once you enter your chosen connection method into the command line, a new console will open that is connected to the same kernel as the console in Spyder. For some reason, the new console does not lag even if the Spyder console does.
Enter everything in the new console, even runfile()
Hope this helps!
UPDATE:
Downgrading to ipykernel version 4.10 seems to solve the issue for me. Thanks to Carlos Cordoba - see GitHub conversation in link below.

Python kernel dies when importing tensorflow 1.7

I want to use tensorflow insinde a Jupyter notebook. However, running
import tensorflow as tf
in a Jupyter notebook immediately triggers a pop-up:
The kernel appears to have died. It will restart automatically.
This issue only began after updating to tensorflow 1.7. I had not used tensorflow for a few weeks so it might also be due to an update to anaconda 5.1 with Python 3.6.
I use a Mid-2010 MacBookPro with "High Sierra 10.13.4". Removing and reinstalling anaconda 5.1 with Python 3.6, followed by installation of tensorflow (and not a single other library) via
pip3 install --upgrade tensorflow
did not resolve the issue. I do not use an isolated environment. The "anaconda3" folder is not in my home folder but directly in "Macintosh HD".
Before reinstalling anaconda, I removed it via these instructions
https://docs.anaconda.com/anaconda/install/uninstall. I also did not try to run tensorflow outside Jupyter, simply because I do not know how. But even if I did, I would still like to use Jupyter.
I'm also running a Mid-2010 MacbookPro and have been facing the same issue. It seems the only solution is to downgrade to Tensorflow 1.5. You can do so by running the following:
pip3 uninstall tensorflow
pip3 install tensorflow==1.5
Credit given to the solution to this post.
I was facing the same issue with Tensorflow 2 '2.0.0-beta1'. I found out that when you have multiple notebooks with Tensorflow running, this problem occurs. Also, simply closing the unused notebook windows wont work, they're still running in the background, you'll have to 'Shutdown' the notebooks
Here are the steps to shutdown a notebooks:
> Go to Home (of Jupyter notebook)
> Select 'Running' tab
> Select the unused notebooks
> Click 'Shutdown' button
You will notice in the Jupyter Home that the active notebook icon is green while inactive ones are gray
I have also faced a similar issue.
I was using python 3.7 and Tensorflow version 1.5
For we moving to Python 3.5 solve the issue.

How to install packages on networked computer

I'm using an Ipython2.7 notebook to run some code. Recently discovered that all my data was corrupted and I need to do it all again (meaning I am very very behind schedule) I figured I could half the time required if I could run it on a second computer. So I've gone into a uni computer cluster where the computers have python 2.7 installed. I can open the notebook, but it won't run as the first line is
import mlpy.wavelet
And it gives me an import error. I've tried downloading and installing it from sourceforge, but it seems to install it to the a Q drive, which I don't have access to. I am completely lost on what to do here, I can't even remember how I first installed it on my laptop. I have a feeling I pip installed it but I have no clue how to do this on a uni comp.
Any rapid responses would be greatly appreciated
You can use pip to install packages in your user's home directory.
Run pip install --user mply to install mply and your other dependencies.
See this answer for reference.

Downgrade to previous version of Spyder

I'm currently using the Anaconda package with Python 2.7.9-1
Yesterday I upgraded the Spyder-app via the Anaconda Launcher and all of my scripts now crash. (Some bugs are already reported in the issues page https://github.com/spyder-ide/spyder/issues).
How can I downgrade to the previous Spyder version meanwhile those bugs are fixed?
You can install a specific version of spyder with conda. For instance, to install 2.3.5.2, run
conda install spyder-app=2.3.5.2
in the terminal.
In Anaconda Navigator, on Spyder tab, you have a settings symbol on top right corner. Press that and select 'Install specific version' option
Thanks for the answers.
What worked in the end was the following (I have windows 7 and the Anaconda Package):
1) In the anaconda prompt, type:
conda list -r
this is going to give you a list of all the packages updates you've done in the past.
2) Check the number of the update where you had the previous version of spyder (for example in my case was 2015-06-25 10:43:34 rev 4) and type:
conda install --revision=4
It would ask you if you want to downgrade, etc and thats it!
Now all scripts run again.
The previous answers didn't work for me, but going here: (https://docs.spyder-ide.org/installation.html). I found the following command works.
conda install -c conda-forge/label/beta spyder=4.1.3
or
conda install spyder=4.1.3*
Note: I had to do this today (7/17/20) where the most recent version is spyder=4.1.4 and I'm getting the following error in the console: "QSocketNotifier: Multiple socket notifiers for same socket 2068 and type Read"
As it is hosted on GitHub, you can find the desired version from the commit history and download that version easily.
First browse the commits:
https://github.com/spyder-ide/spyder/commits/master
After you find the version that doesn't break things. Then you can easily download and install it.
As mentioned before there is an option in the GUI now to select the preferred version.
But before that make sure to run conda update conda. At least in my case that helped.

Categories