spyder-ide / spyder-notebook

Jupyter notebook integration with Spyder
Other
525 stars 130 forks source link

Spyder Crashed when closing tab in notebook #314

Closed cardiganman closed 3 years ago

cardiganman commented 4 years ago

Description

What steps will reproduce the problem?

Launch Spyder, change to notebook from Editor, click 'x' on tab 'untitled0' to close, Spyder crashes

Traceback

  File "C:\Users\david\anaconda3\envs\bluebook\lib\site-packages\spyder_notebook\widgets\notebooktabwidget.py", line 214, in close_client
    client.shutdown_kernel()
  File "C:\Users\david\anaconda3\envs\bluebook\lib\site-packages\spyder_notebook\widgets\client.py", line 312, in shutdown_kernel
    kernel_id = self.get_kernel_id()
  File "C:\Users\david\anaconda3\envs\bluebook\lib\site-packages\spyder_notebook\widgets\client.py", line 281, in get_kernel_id
    sessions_url = self.get_session_url()
  File "C:\Users\david\anaconda3\envs\bluebook\lib\site-packages\spyder_notebook\widgets\client.py", line 272, in get_session_url
    return self.add_token(url_path_join(self.server_url, 'api/sessions'))
  File "C:\Users\david\anaconda3\envs\bluebook\lib\site-packages\notebook\utils.py", line 50, in url_path_join
    initial = pieces[0].startswith('/')
AttributeError: 'NoneType' object has no attribute 'startswith'

Versions

Dependencies


# Mandatory:
atomicwrites >=1.2.0           :  1.4.0 (OK)
chardet >=2.0.0                :  3.0.4 (OK)
cloudpickle >=0.5.0            :  1.6.0 (OK)
diff_match_patch >=20181111    :  20200713 (OK)
intervaltree                   :  None (OK)
IPython >=4.0                  :  7.18.1 (OK)
jedi =0.17.1                   :  0.17.1 (OK)
nbconvert >=4.0                :  6.0.6 (OK)
numpydoc >=0.6.0               :  1.1.0 (OK)
paramiko >=2.4.0               :  2.7.2 (OK)
parso =0.7.0                   :  0.7.0 (OK)
pexpect >=4.4.0                :  4.8.0 (OK)
pickleshare >=0.4              :  0.7.5 (OK)
psutil >=5.3                   :  5.7.2 (OK)
pygments >=2.0                 :  2.7.1 (OK)
pylint >=1.0                   :  2.3.1 (OK)
pyls >=0.34.0;<1.0.0           :  0.35.1 (OK)
qdarkstyle >=2.8               :  2.8.1 (OK)
qtawesome >=0.5.7              :  1.0.0 (OK)
qtconsole >=4.6.0              :  4.7.7 (OK)
qtpy >=1.5.0                   :  1.9.0 (OK)
rtree >=0.8.3                  :  0.9.4 (OK)
sphinx >=0.6.6                 :  3.2.1 (OK)
spyder_kernels >=1.9.4;<1.10.0 :  1.9.4 (OK)
watchdog                       :  None (OK)
zmq >=17                       :  19.0.2 (OK)

# Optional:
cython >=0.21                  :  None (OK)
matplotlib >=2.0.0             :  3.3.2 (OK)
numpy >=1.7                    :  1.19.1 (OK)
pandas >=0.13.1                :  1.1.1 (OK)
scipy >=0.17.0                 :  1.5.2 (OK)
sympy >=0.7.3                  :  None (OK)

# Spyder plugins:
spyder_notebook                :  0.3.0 (OK)
spyder_terminal                :  0.4.2 (OK)
jitseniesen commented 4 years ago

Hi @cardiganman , thanks for your report. I'm trying to understand how this happens. If you repeat the same steps (launch Spyder, change to notebook from Editor, click 'x' on tab 'untitled0' to close), do you again get the error?

cardiganman commented 4 years ago

Yes. I tried it several times, quitting spyder altogether and starting from scratch. I also updated all the packages but the result was always the same. This is the first time I've tried to use the notebook plugin so I may have some configuration issue or system specific issue.

On Mon, Sep 28, 2020, 12:51 AM Jitse Niesen notifications@github.com wrote:

Hi @cardiganman https://github.com/cardiganman , thanks for your report. I'm trying to understand how this happens. If you repeat the same steps (launch Spyder, change to notebook from Editor, click 'x' on tab 'untitled0' to close), do you again get the error?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/spyder-ide/spyder-notebook/issues/314#issuecomment-699843182, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF42NYE6OS37EXVNCWSVP4TSIA6BVANCNFSM4R35YE2Q .

ccordoba12 commented 4 years ago

I think this could be caused by the latest Jupyter notebook version (which is in charge of starting the notebook server).

apvd commented 3 years ago

The following upgrade breaks spyder notebooks. (And downgrading back to anaconda=2020.07 fixes spyder notebook)

(testing) C:\Users\sig>conda update anaconda Collecting package metadata (current_repodata.json): done Solving environment: done

Package Plan

environment location: C:\Users\sig\anaconda3\envs\testing

added / updated specs:

The following packages will be downloaded:

package                    |            build
---------------------------|-----------------
_anaconda_depends-2020.07  |           py38_0           6 KB
anaconda-custom            |           py38_1          36 KB
asn1crypto-1.4.0           |             py_0          80 KB
astropy-4.0.2              |   py38he774522_0         5.9 MB
beautifulsoup4-4.9.3       |     pyhb0f4dca_0          91 KB
bitarray-1.5.3             |   py38he774522_0          93 KB
blosc-1.20.1               |       h7bd577a_0         142 KB
bokeh-2.2.2                |           py38_0         5.4 MB
cytoolz-0.11.0             |   py38he774522_0         289 KB
dask-2.30.0                |             py_0           5 KB
dask-core-2.30.0           |             py_0         605 KB
distributed-2.30.0         |           py38_0         1.0 MB
freetype-2.10.3            |       hd328e21_0         467 KB
fsspec-0.8.3               |             py_0          72 KB
gevent-20.9.0              |   py38he774522_0         1.3 MB
greenlet-0.4.17            |   py38he774522_0          23 KB
iniconfig-1.1.1            |             py_0           9 KB
intel-openmp-2020.2        |              254         1.6 MB
joblib-0.17.0              |             py_0         206 KB
llvmlite-0.34.0            |   py38h1a82afc_4        12.4 MB
lz4-c-1.9.2                |       hf4a77e7_3         106 KB
matplotlib-3.3.1           |                0          25 KB
matplotlib-base-3.3.1      |   py38hba9282a_0         5.1 MB
mkl-2020.2                 |              256       109.3 MB
mkl_fft-1.2.0              |   py38h45dec08_0         122 KB
more-itertools-8.5.0       |             py_0          43 KB
networkx-2.5               |             py_0         1.1 MB
numba-0.51.2               |   py38hf9181ef_1         3.1 MB
numpy-1.19.1               |   py38h5510c5b_0          22 KB
numpy-base-1.19.1          |   py38ha3acd2a_0         3.8 MB
openpyxl-3.0.5             |             py_0         158 KB
pandas-1.1.3               |   py38ha925a31_0         7.5 MB
path-15.0.0                |           py38_0          40 KB
path.py-12.5.0             |                0           4 KB
pillow-8.0.0               |   py38hca74424_0         669 KB
pycurl-7.43.0.6            |   py38h7a1dbc1_0          65 KB
pytest-6.1.1               |           py38_0         428 KB
pywavelets-1.1.1           |   py38he774522_2         3.4 MB
regex-2020.10.15           |   py38he774522_0         298 KB
scikit-learn-0.23.2        |   py38h47e9c7a_0         4.7 MB
seaborn-0.11.0             |             py_0         210 KB
singledispatch-3.4.0.3     |          py_1001          12 KB
sphinxcontrib-websupport-1.2.4|             py_0          34 KB
sqlalchemy-1.3.19          |   py38he774522_0         1.5 MB
statsmodels-0.12.0         |   py38he774522_0         8.2 MB
sympy-1.6.2                |           py38_0         8.6 MB
tbb-2020.3                 |       h74a9793_0         156 KB
tblib-1.7.0                |             py_0          16 KB
toolz-0.11.1               |             py_0          48 KB
tqdm-4.50.2                |             py_0          56 KB
typing_extensions-3.7.4.3  |             py_0          28 KB
xlsxwriter-1.3.7           |             py_0         108 KB
xlwings-0.20.7             |           py38_0         738 KB
zope.event-4.5.0           |           py38_0         210 KB
zope.interface-5.1.2       |   py38he774522_0         280 KB
zstd-1.4.5                 |       h04227a9_0         456 KB
------------------------------------------------------------
                                       Total:       190.1 MB

The following NEW packages will be INSTALLED:

_anaconda_depends pkgs/main/win-64::_anaconda_depends-2020.07-py38_0 iniconfig pkgs/main/noarch::iniconfig-1.1.1-py_0

The following packages will be UPDATED:

asn1crypto pkgs/main/win-64::asn1crypto-1.3.0-py~ --> pkgs/main/noarch::asn1crypto-1.4.0-py_0 astropy 4.0.1.post1-py38he774522_1 --> 4.0.2-py38he774522_0 attrs 19.3.0-py_0 --> 20.2.0-py_0 autopep8 1.5.3-py_0 --> 1.5.4-py_0 bcrypt 3.1.7-py38he774522_1 --> 3.2.0-py38he774522_0 beautifulsoup4 pkgs/main/win-64::beautifulsoup4-4.9.~ --> pkgs/main/noarch::beautifulsoup4-4.9.3-pyhb0f4dca_0 bitarray 1.4.0-py38he774522_0 --> 1.5.3-py38he774522_0 bleach 3.1.5-py_0 --> 3.2.1-py_0 blosc 1.19.0-h7bd577a_0 --> 1.20.1-h7bd577a_0 bokeh 2.1.1-py38_0 --> 2.2.2-py38_0 ca-certificates 2020.6.24-0 --> 2020.10.14-0 cffi 1.14.0-py38h7a1dbc1_0 --> 1.14.3-py38h7a1dbc1_0 cloudpickle 1.5.0-py_0 --> 1.6.0-py_0 cryptography 2.9.2-py38h7a1dbc1_0 --> 3.1.1-py38h7a1dbc1_0 cytoolz 0.10.1-py38he774522_0 --> 0.11.0-py38he774522_0 dask 2.20.0-py_0 --> 2.30.0-py_0 dask-core 2.20.0-py_0 --> 2.30.0-py_0 distributed 2.20.0-py38_0 --> 2.30.0-py38_0 flake8 3.8.3-py_0 --> 3.8.4-py_0 freetype 2.10.2-hd328e21_0 --> 2.10.3-hd328e21_0 fsspec 0.7.4-py_0 --> 0.8.3-py_0 gevent 20.6.2-py38he774522_0 --> 20.9.0-py38he774522_0 greenlet 0.4.16-py38he774522_0 --> 0.4.17-py38he774522_0 importlib-metadata pkgs/main/win-64::importlib-metadata-~ --> pkgs/main/noarch::importlib-metadata-2.0.0-py_1 importlib_metadata 1.7.0-0 --> 2.0.0-1 intel-openmp 2020.1-216 --> 2020.2-254 intervaltree 3.0.2-py_1 --> 3.1.0-py_0 ipykernel 5.3.2-py38h5ca1d4c_0 --> 5.3.4-py38h5ca1d4c_0 ipython 7.16.1-py38h5ca1d4c_0 --> 7.18.1-py38h5ca1d4c_0 ipywidgets 7.5.1-py_0 --> 7.5.1-py_1 isort pkgs/main/win-64::isort-4.3.21-py38_0 --> pkgs/main/noarch::isort-5.6.4-py_0 joblib 0.16.0-py_0 --> 0.17.0-py_0 jsonschema pkgs/main/win-64::jsonschema-3.2.0-py~ --> pkgs/main/noarch::jsonschema-3.2.0-py_2 jupyter_client 6.1.6-py_0 --> 6.1.7-py_0 keyring 21.2.1-py38_0 --> 21.4.0-py38_1 llvmlite 0.33.0-py38ha925a31_0 --> 0.34.0-py38h1a82afc_4 lz4-c 1.9.2-h62dcd97_0 --> 1.9.2-hf4a77e7_3 matplotlib 3.2.2-0 --> 3.3.1-0 matplotlib-base 3.2.2-py38h64f37c6_0 --> 3.3.1-py38hba9282a_0 mkl 2020.1-216 --> 2020.2-256 mkl_fft 1.1.0-py38h45dec08_0 --> 1.2.0-py38h45dec08_0 more-itertools 8.4.0-py_0 --> 8.5.0-py_0 nbconvert 5.6.1-py38_0 --> 6.0.7-py38_0 nbformat 5.0.7-py_0 --> 5.0.8-py_0 networkx 2.4-py_1 --> 2.5-py_0 notebook 6.0.3-py38_0 --> 6.1.4-py38_0 numba 0.50.1-py38h47e9c7a_0 --> 0.51.2-py38hf9181ef_1 numpy 1.18.5-py38h6530119_0 --> 1.19.1-py38h5510c5b_0 numpy-base 1.18.5-py38hc3f5095_0 --> 1.19.1-py38ha3acd2a_0 openpyxl 3.0.4-py_0 --> 3.0.5-py_0 openssl 1.1.1g-he774522_0 --> 1.1.1h-he774522_0 pandas 1.0.5-py38h47e9c7a_0 --> 1.1.3-py38ha925a31_0 pandoc 2.10-0 --> 2.11-h9490d1a_0 paramiko 2.7.1-py_0 --> 2.7.2-py_0 path 13.1.0-py38_0 --> 15.0.0-py38_0 path.py 12.4.0-0 --> 12.5.0-0 pillow 7.2.0-py38hcc1f983_0 --> 8.0.0-py38hca74424_0 pip 20.1.1-py38_1 --> 20.2.3-py38_0 prompt-toolkit 3.0.5-py_0 --> 3.0.8-py_0 prompt_toolkit 3.0.5-0 --> 3.0.8-0 psutil 5.7.0-py38he774522_0 --> 5.7.2-py38he774522_0 pycurl 7.43.0.5-py38h7a1dbc1_0 --> 7.43.0.6-py38h7a1dbc1_0 pydocstyle 5.0.2-py_0 --> 5.1.1-py_0 pygments 2.6.1-py_0 --> 2.7.1-py_0 pylint 2.5.3-py38_0 --> 2.6.0-py38_0 pyrsistent 0.16.0-py38he774522_0 --> 0.17.3-py38he774522_0 pytest 5.4.3-py38_0 --> 6.1.1-py38_0 python 3.8.3-he1778fa_2 --> 3.8.5-h5fd99cc_1 python-jsonrpc-se~ 0.3.4-py_1 --> 0.4.0-py_0 python-language-s~ pkgs/main/win-64::python-language-ser~ --> pkgs/main/noarch::python-language-server-0.35.1-py_0 pywavelets 1.1.1-py38he774522_0 --> 1.1.1-py38he774522_2 pyzmq 19.0.1-py38ha925a31_1 --> 19.0.2-py38ha925a31_1 qtawesome 0.7.2-py_0 --> 1.0.1-py_0 qtconsole 4.7.5-py_0 --> 4.7.7-py_0 regex 2020.6.8-py38he774522_0 --> 2020.10.15-py38he774522_0 rope 0.17.0-py_0 --> 0.18.0-py_0 scikit-learn 0.23.1-py38h25d0782_0 --> 0.23.2-py38h47e9c7a_0 seaborn 0.10.1-py_0 --> 0.11.0-py_0 setuptools 49.2.0-py38_0 --> 50.3.0-py38h9490d1a_1 singledispatch pkgs/main/win-64::singledispatch-3.4.~ --> pkgs/main/noarch::singledispatch-3.4.0.3-py_1001 sphinx 3.1.2-py_0 --> 3.2.1-py_0 sphinxcontrib-web~ 1.2.3-py_0 --> 1.2.4-py_0 sqlalchemy 1.3.18-py38he774522_0 --> 1.3.19-py38he774522_0 sqlite 3.32.3-h2a8f88b_0 --> 3.33.0-h2a8f88b_0 statsmodels 0.11.1-py38he774522_0 --> 0.12.0-py38he774522_0 sympy 1.6.1-py38_0 --> 1.6.2-py38_0 tbb 2020.0-h74a9793_0 --> 2020.3-h74a9793_0 tblib 1.6.0-py_0 --> 1.7.0-py_0 terminado 0.8.3-py38_0 --> 0.9.1-py38_0 toolz 0.10.0-py_0 --> 0.11.1-py_0 tqdm 4.47.0-py_0 --> 4.50.2-py_0 traitlets pkgs/main/win-64::traitlets-4.3.3-py3~ --> pkgs/main/noarch::traitlets-5.0.5-py_0 typing_extensions 3.7.4.2-py_0 --> 3.7.4.3-py_0 ujson 1.35-py38he774522_0 --> 4.0.1-py38ha925a31_0 urllib3 1.25.9-py_0 --> 1.25.10-py_0 wheel pkgs/main/win-64::wheel-0.34.2-py38_0 --> pkgs/main/noarch::wheel-0.35.1-py_0 xlsxwriter 1.2.9-py_0 --> 1.3.7-py_0 xlwings 0.19.5-py38_0 --> 0.20.7-py38_0 zeromq 4.3.2-ha925a31_2 --> 4.3.2-ha925a31_3 zipp 3.1.0-py_0 --> 3.3.0-py_0 zope.event 4.4-py38_0 --> 4.5.0-py38_0 zope.interface 4.7.1-py38he774522_0 --> 5.1.2-py38he774522_0

The following packages will be DOWNGRADED:

anaconda 2020.07-py38_0 --> custom-py38_1 zstd 1.4.5-ha9fde0e_0 --> 1.4.5-h04227a9_0

ccordoba12 commented 3 years ago

notebook 6.0.3-py38_0 --> 6.1.4-py38_0

I think this is the main problem. @jitseniesen, could you check this?

jitseniesen commented 3 years ago

Sorry for taking so long to react; I've been busy.

I had a look and I am fairly certain that the cause of this issue is an API change between traitlets 4 and traitlets 5. For me, the plugin works with notebook 6.1.4 and traitlets 4.3.3, so try downgrading traitlets with conda install traitlets=4.

It's quite easy to fix the plugin and I'll prepare a PR soon (hopefully today).

apvd commented 3 years ago

Tested and confirmed. Forcing traitlets=4 fixes the notebook plugin. Thank you!

mmagnuski commented 3 years ago

I can also confirm: installing traitlets 4 helped me and one of my students. Notebooks were blank in spyder before and now they render correctly.