anaconda / nb_conda_kernels

Package for managing conda environment-based kernels inside of Jupyter
BSD 3-Clause "New" or "Revised" License
599 stars 70 forks source link

json.decoder.JSONDecodeError #213

Closed nick-youngblut closed 2 years ago

nick-youngblut commented 2 years ago

As in the README, I created a jupyter_config.json file in the jupyter --config-dir, and as a test, I added:

{
  "CondaKernelSpecManager": {
    "env_filter": "regex"
}

... which produced the following error:

    Traceback (most recent call last):
      File "/ebio/abt3_projects/software/miniconda3/envs/jupyter-nb/lib/python3.6/site-packages/traitlets/config/application.py", line 563, in _load_config_files
        config = loader.load_config()
      File "/ebio/abt3_projects/software/miniconda3/envs/jupyter-nb/lib/python3.6/site-packages/traitlets/config/loader.py", line 406, in load_config
        dct = self._read_file_as_dict()
      File "/ebio/abt3_projects/software/miniconda3/envs/jupyter-nb/lib/python3.6/site-packages/traitlets/config/loader.py", line 412, in _read_file_as_dict
        return json.load(f)
      File "/ebio/abt3_projects/software/miniconda3/envs/jupyter-nb/lib/python3.6/json/__init__.py", line 299, in load
        parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
      File "/ebio/abt3_projects/software/miniconda3/envs/jupyter-nb/lib/python3.6/json/__init__.py", line 354, in loads
        return _default_decoder.decode(s)
      File "/ebio/abt3_projects/software/miniconda3/envs/jupyter-nb/lib/python3.6/json/decoder.py", line 339, in decode
        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
      File "/ebio/abt3_projects/software/miniconda3/envs/jupyter-nb/lib/python3.6/json/decoder.py", line 355, in raw_decode
        obj, end = self.scan_once(s, idx)
    json.decoder.JSONDecodeError: Expecting ',' delimiter: line 5 column 1 (char 59)

If the JSON file must include more than what is listed above, it would help to have that info in the README

Conda env running jupyter

# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       1_gnu    conda-forge
argon2-cffi               20.1.0           py36h8f6f2f9_2    conda-forge
async_generator           1.10                       py_0    conda-forge
attrs                     20.3.0             pyhd3deb0d_0    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                      py36_1    conda-forge
backports.functools_lru_cache 1.6.1                      py_0    conda-forge
bleach                    3.2.1              pyh9f0ad1d_0    conda-forge
ca-certificates           2020.12.8            h06a4308_0
certifi                   2020.12.5        py36h5fab9bb_1    conda-forge
cffi                      1.14.4           py36hc120d54_1    conda-forge
dbus                      1.13.18              hb2f20db_0
decorator                 4.4.2                      py_0    conda-forge
defusedxml                0.6.0                      py_0    conda-forge
entrypoints               0.3             py36h9f0ad1d_1002    conda-forge
expat                     2.2.10               he6710b0_2
fontconfig                2.13.1            h736d332_1003    conda-forge
freetype                  2.10.4               he06d7ca_0    conda-forge
gettext                   0.19.8.1          h0b5b191_1005    conda-forge
glib                      2.66.4               hcd2ae1e_1    conda-forge
gst-plugins-base          1.14.5               h0935bb2_2    conda-forge
gstreamer                 1.18.2               h3560a44_1    conda-forge
icu                       68.1                 h58526e2_0    conda-forge
importlib-metadata        3.4.0            py36h5fab9bb_0    conda-forge
importlib_metadata        3.4.0                hd8ed1ab_0    conda-forge
ipykernel                 5.4.2            py36he448a4c_0    conda-forge
ipython                   7.16.1           py36he448a4c_2    conda-forge
ipython_genutils          0.2.0                    py36_0    conda-forge
ipywidgets                7.6.3              pyhd3deb0d_0    conda-forge
jedi                      0.17.2           py36h9f0ad1d_1    conda-forge
jinja2                    2.11.2             pyh9f0ad1d_0    conda-forge
jpeg                      9d                   h516909a_0    conda-forge
jsonschema                3.2.0            py36h9f0ad1d_1    conda-forge
jupyter                   1.0.0                    py36_0    conda-forge
jupyter_client            6.1.11             pyhd8ed1ab_1    conda-forge
jupyter_console           6.2.0                      py_0    conda-forge
jupyter_contrib_core      0.3.3                    py36_1    conda-forge
jupyter_contrib_nbextensions 0.5.1            py36h9f0ad1d_1    conda-forge
jupyter_core              4.7.0            py36h5fab9bb_0    conda-forge
jupyter_highlight_selected_word 0.2.0           py36h9f0ad1d_1002    conda-forge
jupyter_latex_envs        1.4.6           py36h9f0ad1d_1001    conda-forge
jupyter_nbextensions_configurator 0.4.1            py36h9f0ad1d_2    conda-forge
jupyterlab_pygments       0.1.2              pyh9f0ad1d_0    conda-forge
jupyterlab_widgets        1.0.0              pyhd8ed1ab_1    conda-forge
krb5                      1.17.2               h926e7f8_0    conda-forge
ld_impl_linux-64          2.35.1               hed1e6ac_1    conda-forge
libclang                  11.0.0          default_ha5c780c_2    conda-forge
libedit                   3.1.20191231         he28a2e2_2    conda-forge
libevent                  2.1.10               hcdb4288_3    conda-forge
libffi                    3.3                  h58526e2_2    conda-forge
libgcc-ng                 9.3.0               h5dbcf3e_17    conda-forge
libglib                   2.66.4               h164308a_1    conda-forge
libgomp                   9.3.0               h5dbcf3e_17    conda-forge
libiconv                  1.16                 h516909a_0    conda-forge
libllvm11                 11.0.1               hf817b99_0    conda-forge
libpng                    1.6.37               hed695b0_2    conda-forge
libpq                     12.3                 hfd2b0eb_3    conda-forge
libsodium                 1.0.18               h516909a_1    conda-forge
libstdcxx-ng              9.3.0               h2ae2ef3_17    conda-forge
libuuid                   2.32.1            h14c3975_1000    conda-forge
libxcb                    1.14                 h7b6447c_0
libxkbcommon              1.0.3                he3ba5ed_0    conda-forge
libxml2                   2.9.10               h72842e0_3    conda-forge
libxslt                   1.1.33               h15afd5d_2    conda-forge
lxml                      4.6.2            py36h04a5ba7_1    conda-forge
lz4-c                     1.9.3                h9c3ff4c_0    conda-forge
markupsafe                1.1.1            py36h8f6f2f9_3    conda-forge
mistune                   0.8.4           py36h8f6f2f9_1003    conda-forge
mysql-common              8.0.22               ha770c72_1    conda-forge
mysql-libs                8.0.22               h1fd7589_1    conda-forge
nb_conda_kernels          2.3.1            py36h5fab9bb_0    conda-forge
nbclient                  0.5.1                      py_0    conda-forge
nbconvert                 6.0.7            py36h5fab9bb_3    conda-forge
nbformat                  5.0.8                      py_0    conda-forge
ncurses                   6.2                  h58526e2_4    conda-forge
nest-asyncio              1.4.3              pyhd8ed1ab_0    conda-forge
notebook                  6.1.6            py36h5fab9bb_0    conda-forge
nspr                      4.29                 he1b5a44_1    conda-forge
nss                       3.60                 hb5efdd6_0    conda-forge
openssl                   1.1.1i               h7f98852_0    conda-forge
packaging                 20.8               pyhd3deb0d_0    conda-forge
pandoc                    2.11.3.2             h7f98852_0    conda-forge
pandocfilters             1.4.3            py36h06a4308_1
parso                     0.7.1              pyh9f0ad1d_0    conda-forge
pcre                      8.44                 he1b5a44_0    conda-forge
pexpect                   4.8.0            py36h9f0ad1d_1    conda-forge
pickleshare               0.7.5           py36h9f0ad1d_1002    conda-forge
pip                       20.3.3             pyhd8ed1ab_0    conda-forge
prometheus_client         0.9.0              pyhd3deb0d_0    conda-forge
prompt-toolkit            3.0.10             pyha770c72_0    conda-forge
prompt_toolkit            3.0.10               hd8ed1ab_0    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
pycparser                 2.20               pyh9f0ad1d_2    conda-forge
pygments                  2.7.3              pyhd8ed1ab_0    conda-forge
pyparsing                 2.4.7              pyh9f0ad1d_0    conda-forge
pyqt                      5.12.3           py36h5fab9bb_7    conda-forge
pyqt-impl                 5.12.3           py36h7ec31b9_7    conda-forge
pyqt5-sip                 4.19.18          py36hc4f0c31_7    conda-forge
pyqtchart                 5.12             py36h7ec31b9_7    conda-forge
pyqtwebengine             5.12.1           py36h7ec31b9_7    conda-forge
pyrsistent                0.17.3           py36h8f6f2f9_2    conda-forge
python                    3.6.12          hffdb5ce_0_cpython    conda-forge
python-dateutil           2.8.1                      py_0    conda-forge
python_abi                3.6                     1_cp36m    conda-forge
pyyaml                    5.3.1            py36h8f6f2f9_2    conda-forge
pyzmq                     20.0.0           py36h81c33ee_1    conda-forge
qt                        5.12.9               h9d6b050_2    conda-forge
qtconsole                 5.0.1              pyhd8ed1ab_0    conda-forge
qtpy                      1.9.0                      py_0    conda-forge
readline                  8.0                  he28a2e2_2    conda-forge
send2trash                1.5.0                      py_0    conda-forge
setuptools                51.1.2           py36h06a4308_4
six                       1.15.0             pyh9f0ad1d_0    conda-forge
sqlite                    3.34.0               h74cdb3f_0    conda-forge
terminado                 0.9.2            py36h5fab9bb_0    conda-forge
testpath                  0.4.4                      py_0    conda-forge
tk                        8.6.10               hed695b0_1    conda-forge
tornado                   6.1              py36h8f6f2f9_1    conda-forge
traitlets                 4.3.3            py36h9f0ad1d_1    conda-forge
typing_extensions         3.7.4.3                    py_0    conda-forge
wcwidth                   0.2.5              pyh9f0ad1d_2    conda-forge
webencodings              0.5.1                      py_1    conda-forge
wheel                     0.36.2             pyhd3deb0d_0    conda-forge
widgetsnbextension        3.5.1            py36h9f0ad1d_4    conda-forge
xz                        5.2.5                h516909a_1    conda-forge
yaml                      0.2.5                h516909a_0    conda-forge
zeromq                    4.3.3                h58526e2_3    conda-forge
zipp                      3.4.0                      py_0    conda-forge
zlib                      1.2.11            h516909a_1010    conda-forge
zstd                      1.4.8                ha95c52a_1    conda-forge
fcollonval commented 2 years ago

Could you have a second look at your config file?

Your snippet is missing a }:

{
  "CondaKernelSpecManager": {
    "env_filter": "regex"
  // Missing closing curly brace here
}

You can check if your config file is correct JSON by running:

python -c "import json; import pathlib; print(json.loads(pathlib.Path('jupyter_config.json').read_text()))"
nick-youngblut commented 2 years ago

Yeah, that's it. I should have paid more attention to the syntax of the example in your README.