jupyter / help

:sparkles: Need some help or have some questions? Please visit our Discourse page.
https://discourse.jupyter.org
291 stars 97 forks source link

'jupyter kernelspec list' fails with syntax error #464

Closed twirlywoo closed 5 years ago

twirlywoo commented 5 years ago

Hi all, wondering if someone has come across this issue before and might have a solution? I have two problems, which might be linked:

  1. after deleting a conda environment and creating a new one, I now get dead kernels when I try to run 'jupyter notebook' from the anaconda prompt. The browser opens fine, but the kernel won't connect.
  2. when I try to debug problem 1 by typing jupyter kernelspec list in my anaconda prompt, I get a syntax error as follows:

image

It looks like the problem is in line 4 of kernelspec-script.py: "from jupyter_client.kernelspecapp import KernelSpecApp.launch_instance". Am I doing something wrong?

I'm working in Windows 7 Professional Anaconda 5.0.1 python 3.7.0 jupyter-client 5.2.3 ipykernel 5.1.0

Really grateful if anyone has a fix for this. Thank you!

twirlywoo commented 5 years ago

I got the kernel working again by doing this: python -m ipykernel install --user --name myenv --display-name "Python (myenv)" As in jupyter issue #245.

"jupyter kernelspec list" is still giving the syntax error though. So issue 1 is solved but issue 2 still there :-)

minrk commented 5 years ago

What is conda list? I think this might be a problem with either conda or the conda package for jupyter_client.

twirlywoo commented 5 years ago

Hi @minrk, thank you for the comment. Here is the conda list from that environment:

(testenvpy3) C:\Users\XXXX>conda list packages in environment at C:\Users\XXXX\AppData\Local\conda\conda\envs\testenvpy3:

asn1crypto 0.24.0 py37_1003 conda-forge attrs 18.2.0 py_0 conda-forge backcall 0.1.0 py_0 conda-forge blas 1.0 mkl bleach 3.0.2 py_0 conda-forge blinker 1.4 py_1 conda-forge boto 2.49.0 py37_0 boto3 1.9.41 py_0 conda-forge botocore 1.12.41 py_0 conda-forge bz2file 0.98 py_0 conda-forge ca-certificates 2018.10.15 ha4d7672_0 conda-forge certifi 2018.10.15 py37_1000 conda-forge cffi 1.11.5 py37hfa6e2cd_1001 conda-forge chardet 3.0.4 py37_1003 conda-forge colorama 0.4.0 py_0 conda-forge cryptography 2.3 py37h74b6da3_0 conda-forge cryptography-vectors 2.3.1 py37_1000 conda-forge cycler 0.10.0 py_1 conda-forge cymem 2.0.2 py37h74a9793_0 cytoolz 0.9.0.1 py37hfa6e2cd_1001 conda-forge decorator 4.3.0 py_0 conda-forge dill 0.2.8.2 py37_1000 conda-forge docutils 0.14 py37_1001 conda-forge entrypoints 0.2.3 py37_1002 conda-forge freetype 2.9.1 he8b6a0d_1004 conda-forge gensim 3.4.0 py37hfa6e2cd_0 icc_rt 2017.0.4 h97af966_0 icu 58.2 ha66f8fd_1 idna 2.7 py37_1002 conda-forge intel-openmp 2019.0 118 ipykernel 5.1.0 pyh24bf2e0_0 conda-forge ipython 7.1.1 py37h39e3cac_1000 conda-forge ipython_genutils 0.2.0 py_1 conda-forge ipywidgets 7.4.2 py_0 conda-forge jedi 0.13.1 py37_1000 conda-forge jinja2 2.10 py_1 conda-forge jmespath 0.9.3 py_1 conda-forge jpeg 9b vc14_1 [vc14] conda-forge jsonschema 3.0.0a3 py37_1000 conda-forge jupyter 1.0.0 py_1 conda-forge jupyter_client 5.2.3 py_1 conda-forge jupyter_console 6.0.0 py_0 conda-forge jupyter_core 4.4.0 py_0 conda-forge kiwisolver 1.0.1 py37he980bc4_1002 conda-forge libpng 1.6.35 h7602738_1002 conda-forge libsodium 1.0.16 h2fa13f4_1001 conda-forge m2w64-gcc-libgfortran 5.3.0 6 m2w64-gcc-libs 5.3.0 7 m2w64-gcc-libs-core 5.3.0 7 m2w64-gmp 6.1.0 2 m2w64-libwinpthread-git 5.0.0.4634.697f757 2 markupsafe 1.1.0 py37hfa6e2cd_1000 conda-forge matplotlib 2.2.3 py37h31860fd_0 conda-forge mistune 0.8.4 py37hfa6e2cd_1000 conda-forge mkl 2019.0 118 mkl_fft 1.0.6 py37hdbbee80_0 mkl_random 1.0.1 py37h77b88f5_1 msgpack-numpy 0.4.3.2 py_0 conda-forge msgpack-python 0.5.6 py37he980bc4_1003 conda-forge msys2-conda-epoch 20160418 1 murmurhash 1.0.0 py37h6538335_0 conda-forge nb_conda_kernels 2.2.0 py37_1000 conda-forge nbconvert 5.3.1 py_1 conda-forge nbformat 4.4.0 py_1 conda-forge nltk 3.2.5 py_0 conda-forge notebook 5.7.0 py37_1000 conda-forge numpy 1.15.4 py37ha559c80_0 numpy-base 1.15.4 py37h8128ebf_0 oauthlib 2.1.0 py_0 conda-forge openssl 1.0.2o vc14_0 [vc14] conda-forge pandas 0.23.4 py37h830ac7b_1000 conda-forge pandoc 2.3.1 0 conda-forge pandocfilters 1.4.2 py_1 conda-forge parso 0.3.1 py_0 conda-forge pickleshare 0.7.5 py37_1000 conda-forge pip 18.1 py37_1000 conda-forge plac 0.9.6 py_1 conda-forge preshed 2.0.1 py37h33f27b4_0 prometheus_client 0.4.2 py_0 conda-forge prompt_toolkit 2.0.7 py_0 conda-forge pycparser 2.19 py_0 conda-forge pygments 2.2.0 py_1 conda-forge pyjwt 1.6.4 py_0 conda-forge pyopenssl 18.0.0 py37_1000 conda-forge pyparsing 2.3.0 py_0 conda-forge pyqt 5.6.0 py37h764d66f_7 conda-forge pyreadline 2.1 py37_1000 conda-forge pyrsistent 0.14.5 py37hfa6e2cd_1001 conda-forge pysocks 1.6.8 py37_1002 conda-forge python 3.7.0 hc182675_1005 conda-forge python-crfsuite 0.9.6 py37he980bc4_1000 conda-forge python-dateutil 2.7.5 py_0 conda-forge pytz 2018.7 py_0 conda-forge pywinpty 0.5.4 py37_1002 conda-forge pyzmq 17.1.2 py37hf576995_1001 conda-forge qt 5.6.2 vc14h6f8c307_12 qtconsole 4.4.2 py_1 conda-forge regex 2018.11.06 py37hfa6e2cd_1000 conda-forge requests 2.20.0 py37_1000 conda-forge requests-oauthlib 1.0.0 py_1 conda-forge s3transfer 0.1.13 py37_1001 conda-forge scikit-learn 0.20.0 py37heebcf9a_1 scipy 1.1.0 py37h4f6bf74_1 send2trash 1.5.0 py_0 conda-forge setuptools 40.5.0 py37_0 conda-forge sip 4.18.1 py37h6538335_0 conda-forge six 1.11.0 py37_1001 conda-forge smart_open 1.7.1 py_0 conda-forge spacy 2.0.16 py37hcce6980_0 sqlite 3.25.3 hfa6e2cd_1000 conda-forge terminado 0.8.1 py37_1001 conda-forge testpath 0.4.2 py37_1000 conda-forge thinc 6.12.0 py37hb854c30_0 toolz 0.9.0 py_1 conda-forge tornado 5.1.1 py37hfa6e2cd_1000 conda-forge tqdm 4.28.1 py_0 conda-forge traitlets 4.3.2 py37_1000 conda-forge twython 3.7.0 py_0 conda-forge ujson 1.35 py37hfa6e2cd_1001 conda-forge urllib3 1.23 py37_1001 conda-forge vc 14.1 h0510ff6_4 vs2015_runtime 14.15.26706 h3a45250_0 wcwidth 0.1.7 py_1 conda-forge webencodings 0.5.1 py_1 conda-forge wheel 0.32.2 py37_0 conda-forge widgetsnbextension 3.4.2 py37_1000 conda-forge win_inet_pton 1.0.1 py37_1002 conda-forge wincertstore 0.2 py37_1002 conda-forge winpty 0.4.3 4 conda-forge wrapt 1.10.11 py37hfa6e2cd_1001 conda-forge zeromq 4.2.5 he025d50_1006 conda-forge zlib 1.2.11 vc14_0 [vc14] conda-forge

minrk commented 5 years ago

Thanks! and conda info as well?

twirlywoo commented 5 years ago

Here it is. Thanks so much @minrk for taking a look:

(testenvpy3) C:\Users\XXXX>conda info Current conda install:

           platform : win-64
      conda version : 4.3.30
   conda is private : False
  conda-env version : 4.3.30
conda-build version : 3.0.27
     python version : 3.6.3.final.0
   requests version : 2.18.4
   root environment : C:\ProgramData\Anaconda3  (read only)
default environment : C:\Users\XXXX\AppData\Local\conda\conda\envs\testenvpy3
   envs directories : C:\Users\XXXX\AppData\Local\conda\conda\envs
                      C:\ProgramData\Anaconda3\envs
                      C:\Users\XXXX\.conda\envs
      package cache : C:\ProgramData\Anaconda3\pkgs
                      C:\Users\XXXX\AppData\Local\conda\conda\pkgs
       channel URLs : https://conda.anaconda.org/conda-forge/win-64
                      https://conda.anaconda.org/conda-forge/noarch
                      https://repo.continuum.io/pkgs/main/win-64
                      https://repo.continuum.io/pkgs/main/noarch
                      https://repo.continuum.io/pkgs/free/win-64
                      https://repo.continuum.io/pkgs/free/noarch
                      https://repo.continuum.io/pkgs/r/win-64
                      https://repo.continuum.io/pkgs/r/noarch
                      https://repo.continuum.io/pkgs/pro/win-64
                      https://repo.continuum.io/pkgs/pro/noarch
                      https://repo.continuum.io/pkgs/msys2/win-64
                      https://repo.continuum.io/pkgs/msys2/noarch
        config file : C:\Users\XXXX\.condarc
         netrc file : None
       offline mode : False
         user-agent : conda/4.3.30 requests/2.18.4 CPython/3.6.3 Windows/7 Windows/6.1.7601
      administrator : False
minrk commented 5 years ago

I suspect this might be a problem in the conda client that may be fixed in a recent version. Can you try:

conda update conda

and then remove and reinstall the jupyter_client package?

twirlywoo commented 5 years ago

I tried conda update conda at the Anaconda prompt, but got this error:

image

Erm. I'm not sure what that error means! Should I try conda update --all ?

twirlywoo commented 5 years ago

@minrk thanks for your help. I remembered that I don't have admin rights on my machine to update my version of Anaconda. Could that be part of the issue?

minrk commented 5 years ago

That's possible. I'm guessing that this is a bug in older versions of conda not properly supporting entrypoints in noarch: python packages. Updating conda itself to 4.5.x would likely solve the problem.

twirlywoo commented 5 years ago

Closing issue as I think I have the answer. I just won't be able to implement it yet :-) Thank you @minrk.