ModuleNotFoundError: No module named 'plotly.io.json'

Hello,

I have written a DASH app (with debug = False), and when I run it I get an “Internal Server Error”. In my console I get the more verbose error below (“Verbose error”). It seems to be an issue with DASH rather than my code (seems like dash/plotly is trying to import plotly.io.json and it’s not there?), so I am not posting my app here (unless someone thinks it will be useful, in which case I am more than happy to!).

None of my callbacks have state and my import is as described here (from dash import Dash, callback, html, dcc, dash_table, Input, Output, State, MATCH, ALL), so I don’t see any issues arising from DASH v2. I am running in a conda environment (packages listed below via conda list from within my activated conda env, “Packages”). I will try re-installing DASH/plotly, but thought I would check if there were any known issues of this nature whilst I do that.

Thanks!
Tim

Verbose error

* Serving Flask app 'tui_dynamic_score_app'
 * Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:8050
Press CTRL+C to quit
[2023-08-19 18:50:49,489] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
  File "C:\Users\u03132tk\AppData\Local\anaconda3\envs\pip_env\lib\site-packages\flask\app.py", line 2525, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Users\u03132tk\AppData\Local\anaconda3\envs\pip_env\lib\site-packages\flask\app.py", line 1822, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Users\u03132tk\AppData\Local\anaconda3\envs\pip_env\lib\site-packages\flask\app.py", line 1820, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Users\u03132tk\AppData\Local\anaconda3\envs\pip_env\lib\site-packages\flask\app.py", line 1796, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "C:\Users\u03132tk\AppData\Local\anaconda3\envs\pip_env\lib\site-packages\dash\dash.py", line 923, in index
    config = self._generate_config_html()
  File "C:\Users\u03132tk\AppData\Local\anaconda3\envs\pip_env\lib\site-packages\dash\dash.py", line 857, in _generate_config_html
    return f'<script id="_dash-config" type="application/json">{to_json(self._config())}</script>'
  File "C:\Users\u03132tk\AppData\Local\anaconda3\envs\pip_env\lib\site-packages\dash\_utils.py", line 21, in to_json
    from plotly.io.json import to_json_plotly
ModuleNotFoundError: No module named 'plotly.io.json'
127.0.0.1 - - [19/Aug/2023 18:50:49] "GET / HTTP/1.1" 500 -
[2023-08-19 18:50:49,736] ERROR in app: Exception on /favicon.ico [GET]
Traceback (most recent call last):
  File "C:\Users\u03132tk\AppData\Local\anaconda3\envs\pip_env\lib\site-packages\flask\app.py", line 2525, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Users\u03132tk\AppData\Local\anaconda3\envs\pip_env\lib\site-packages\flask\app.py", line 1822, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Users\u03132tk\AppData\Local\anaconda3\envs\pip_env\lib\site-packages\flask\app.py", line 1820, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Users\u03132tk\AppData\Local\anaconda3\envs\pip_env\lib\site-packages\flask\app.py", line 1796, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "C:\Users\u03132tk\AppData\Local\anaconda3\envs\pip_env\lib\site-packages\dash\dash.py", line 923, in index
    config = self._generate_config_html()
  File "C:\Users\u03132tk\AppData\Local\anaconda3\envs\pip_env\lib\site-packages\dash\dash.py", line 857, in _generate_config_html
    return f'<script id="_dash-config" type="application/json">{to_json(self._config())}</script>'
  File "C:\Users\u03132tk\AppData\Local\anaconda3\envs\pip_env\lib\site-packages\dash\_utils.py", line 21, in to_json
    from plotly.io.json import to_json_plotly
ModuleNotFoundError: No module named 'plotly.io.json'
127.0.0.1 - - [19/Aug/2023 18:50:49] "GET /favicon.ico HTTP/1.1" 500 -

Packages

# packages in environment at C:\Users\u03132tk\AppData\Local\anaconda3\envs\pip_env:
#
# Name                    Version                   Build  Channel
alabaster                 0.7.12             pyhd3eb1b0_0
appdirs                   1.4.4              pyhd3eb1b0_0
argcomplete               3.1.1                    pypi_0    pypi
argh                      0.28.1                   pypi_0    pypi
arrow                     1.2.3           py310haa95532_1
astroid                   2.14.2          py310haa95532_0
asttokens                 2.0.5              pyhd3eb1b0_0
atomicwrites              1.4.0                      py_0
attrs                     22.1.0          py310haa95532_0
autopep8                  1.6.0              pyhd3eb1b0_1
babel                     2.11.0          py310haa95532_0
backcall                  0.2.0              pyhd3eb1b0_0
bcrypt                    3.2.0           py310h2bbff1b_1
beautifulsoup4            4.12.2          py310haa95532_0
binaryornot               0.4.4              pyhd3eb1b0_1
biopython                 1.80            py310h8d17308_0    conda-forge
black                     23.3.0          py310haa95532_0
blas                      1.0                         mkl
bleach                    4.1.0              pyhd3eb1b0_0
bottleneck                1.3.5           py310h9128911_0
brain-isotopic-distribution 1.5.14                   pypi_0    pypi
brotli                    1.0.9                h2bbff1b_7
brotli-bin                1.0.9                h2bbff1b_7
brotlipy                  0.7.0           py310h2bbff1b_1002
bzip2                     1.0.8                he774522_0
ca-certificates           2023.05.30           haa95532_0
cblaster                  1.3.18                   pypi_0    pypi
certifi                   2023.7.22       py310haa95532_0
cffi                      1.15.1          py310h2bbff1b_3
chardet                   4.0.0           py310haa95532_1003
charset-normalizer        2.0.4              pyhd3eb1b0_0
click                     8.0.4           py310haa95532_0
clinker                   0.0.28                   pypi_0    pypi
cloudpickle               2.2.1           py310haa95532_0
colorama                  0.4.6           py310haa95532_0
comm                      0.1.2           py310haa95532_0
contourpy                 1.0.5           py310h59b6b97_0
cookiecutter              1.7.3              pyhd3eb1b0_0
cryptography              41.0.2          py310h31511bf_0
cycler                    0.11.0             pyhd3eb1b0_0
dash                      2.10.2             pyhd8ed1ab_0    conda-forge
dash_cytoscape            0.2.0              pyhd8ed1ab_1    conda-forge
debugpy                   1.6.7           py310hd77b12b_0
decorator                 5.1.1              pyhd3eb1b0_0
defusedxml                0.7.1              pyhd3eb1b0_0
diff-match-patch          20200713           pyhd3eb1b0_0
dill                      0.3.6           py310haa95532_0
disjoint-set              0.7.4                    pypi_0    pypi
docstring-to-markdown     0.11            py310haa95532_0
docutils                  0.18.1          py310haa95532_3
entrypoints               0.4             py310haa95532_0
executing                 0.8.3              pyhd3eb1b0_0
flake8                    6.0.0           py310haa95532_0
flask                     2.2.2           py310haa95532_0
fonttools                 4.25.0             pyhd3eb1b0_0
freetype                  2.12.1               ha860e81_0
genomicsqlite             0.9.4                    pypi_0    pypi
gffutils                  0.12                     pypi_0    pypi
giflib                    5.2.1                h8cc25b3_3
glib                      2.69.1               h5dc1a3c_2
greenlet                  2.0.2                    pypi_0    pypi
gst-plugins-base          1.18.5               h9e645db_0
gstreamer                 1.18.5               hd78058f_0
html2text                 2020.1.16                pypi_0    pypi
icc_rt                    2022.1.0             h6049295_2
icu                       58.2                 ha925a31_3
idna                      3.4             py310haa95532_0
imagesize                 1.4.1           py310haa95532_0
importlib-metadata        6.0.0           py310haa95532_0
importlib_metadata        6.0.0                hd3eb1b0_0
inflection                0.5.1           py310haa95532_0
intel-openmp              2021.4.0          haa95532_3556
intervaltree              3.1.0              pyhd3eb1b0_0
ipykernel                 6.25.0          py310h9909e9c_0
ipython                   8.12.0          py310haa95532_0
ipython_genutils          0.2.0              pyhd3eb1b0_1
isort                     5.9.3              pyhd3eb1b0_0
itsdangerous              2.0.1              pyhd3eb1b0_0
jaraco.classes            3.2.1              pyhd3eb1b0_0
jedi                      0.18.1          py310haa95532_1
jellyfish                 0.9.0           py310h2bbff1b_0
jinja2                    3.1.2           py310haa95532_0
jinja2-time               0.2.0              pyhd3eb1b0_3
joblib                    1.2.0           py310haa95532_0
jpeg                      9e                   h2bbff1b_1
jsonschema                4.17.3          py310haa95532_0
jupyter_client            7.4.9           py310haa95532_0
jupyter_core              5.3.0           py310haa95532_0
jupyterlab_pygments       0.1.2                      py_0
keyring                   23.13.1         py310haa95532_0
kiwisolver                1.4.4           py310hd77b12b_0
krb5                      1.19.4               h5b6d351_0
lazy-object-proxy         1.6.0           py310h2bbff1b_0
lerc                      3.0                  hd77b12b_0
libbrotlicommon           1.0.9                h2bbff1b_7
libbrotlidec              1.0.9                h2bbff1b_7
libbrotlienc              1.0.9                h2bbff1b_7
libclang                  14.0.6          default_hb5a9fac_1
libclang13                14.0.6          default_h8e68704_1
libdeflate                1.17                 h2bbff1b_0
libffi                    3.4.4                hd77b12b_0
libiconv                  1.16                 h2bbff1b_2
libogg                    1.3.5                h2bbff1b_1
libpng                    1.6.39               h8cc25b3_0
libsodium                 1.0.18               h62dcd97_0
libspatialindex           1.9.3                h6c2663c_0
libtiff                   4.5.0                h6c2663c_2
libvorbis                 1.3.7                he774522_0
libwebp                   1.2.4                hbc33d0d_1
libwebp-base              1.2.4                h2bbff1b_1
libxml2                   2.10.3               h0ad7f3c_0
libxslt                   1.1.37               h2bbff1b_0
lxml                      4.9.2           py310h2bbff1b_0
lz4-c                     1.9.4                h2bbff1b_0
markupsafe                2.1.1           py310h2bbff1b_0
matplotlib-base           3.7.1           py310h4ed8f06_1
matplotlib-inline         0.1.6           py310haa95532_0
mccabe                    0.7.0              pyhd3eb1b0_0
mistune                   0.8.4           py310h2bbff1b_1000
mkl                       2021.4.0           haa95532_640
mkl-service               2.4.0           py310h2bbff1b_0
mkl_fft                   1.3.1           py310ha0764ea_0
mkl_random                1.2.2           py310h4ed8f06_0
mlxtend                   0.22.0          py310haa95532_0
more-itertools            8.12.0             pyhd3eb1b0_0
ms-deisotope              0.0.50                   pypi_0    pypi
ms-peak-picker            0.1.42                   pypi_0    pypi
munkres                   1.1.4                      py_0
mypy_extensions           0.4.3           py310haa95532_1
nbclient                  0.5.13          py310haa95532_0
nbconvert                 6.5.4           py310haa95532_0
nbformat                  5.7.0           py310haa95532_0
nest-asyncio              1.5.6           py310haa95532_0
networkx                  3.1                pyhd8ed1ab_0    conda-forge
numexpr                   2.8.4           py310hd213c9f_0
numpy                     1.23.5          py310h60c9a35_0
numpy-base                1.23.5          py310h04254f7_0
numpydoc                  1.5.0           py310haa95532_0
openssl                   1.1.1v               h2bbff1b_0
packaging                 23.0            py310haa95532_0
pandas                    1.5.3           py310h4ed8f06_0
pandocfilters             1.5.0              pyhd3eb1b0_0
paramiko                  2.8.1              pyhd3eb1b0_0
parso                     0.8.3              pyhd3eb1b0_0
pathspec                  0.10.3          py310haa95532_0
pcre                      8.45                 hd77b12b_0
pexpect                   4.8.0              pyhd3eb1b0_3
pickleshare               0.7.5           pyhd3eb1b0_1003
pillow                    9.4.0           py310hd77b12b_0
pip                       22.3.1          py310haa95532_0
platformdirs              2.5.2           py310haa95532_0
plotly                    4.14.3                   pypi_0    pypi
pluggy                    1.0.0           py310haa95532_1
ply                       3.11            py310haa95532_0
pooch                     1.4.0              pyhd3eb1b0_0
poyo                      0.5.0              pyhd3eb1b0_0
primer3-py                2.0.0                    pypi_0    pypi
prompt-toolkit            3.0.36          py310haa95532_0
psims                     1.2.6                    pypi_0    pypi
psutil                    5.9.0           py310h2bbff1b_0
ptyprocess                0.7.0              pyhd3eb1b0_2
pure_eval                 0.2.2              pyhd3eb1b0_0
pycodestyle               2.10.0          py310haa95532_0
pycparser                 2.21               pyhd3eb1b0_0
pydocstyle                6.3.0           py310haa95532_0
pyfaidx                   0.7.2.1                  pypi_0    pypi
pyflakes                  3.0.1           py310haa95532_0
pygments                  2.15.1          py310haa95532_1
pylint                    2.16.2          py310haa95532_0
pylint-venv               2.3.0                    pypi_0    pypi
pyls-spyder               0.4.0              pyhd3eb1b0_0
pymzml                    2.5.2                    pypi_0    pypi
pynacl                    1.5.0           py310h8cc25b3_0
pynumpress                0.0.8                    pypi_0    pypi
pyopenssl                 23.2.0          py310haa95532_0
pyparsing                 3.0.9           py310haa95532_0
pyqt                      5.15.7          py310hd77b12b_0
pyqt5-sip                 12.11.0         py310hd77b12b_0
pyqtwebengine             5.15.7          py310hd77b12b_0
pyrsistent                0.18.0          py310h2bbff1b_0
pysimplegui               4.60.5                   pypi_0    pypi
pysocks                   1.7.1           py310haa95532_0
pyteomics                 4.6                      pypi_0    pypi
python                    3.10.9               h966fe2a_2
python-dateutil           2.8.2              pyhd3eb1b0_0
python-fastjsonschema     2.16.2          py310haa95532_0
python-idzip              0.3.9                    pypi_0    pypi
python-lsp-black          1.2.1           py310haa95532_0
python-lsp-jsonrpc        1.0.0              pyhd3eb1b0_0
python-lsp-server         1.7.2           py310haa95532_0
python-slugify            5.0.2              pyhd3eb1b0_0
python_abi                3.10                    2_cp310    conda-forge
pytoolconfig              1.2.5           py310haa95532_1
pytz                      2022.7          py310haa95532_0
pywin32                   305             py310h2bbff1b_0
pywin32-ctypes            0.2.0           py310haa95532_1000
pyyaml                    6.0             py310h2bbff1b_1
pyzmq                     25.1.0          py310hd77b12b_0
pyzstd                    0.15.9                   pypi_0    pypi
qdarkstyle                3.0.2              pyhd3eb1b0_0
qstylizer                 0.2.2                    pypi_0    pypi
qt-main                   5.15.2               he8e5bd7_8
qt-webengine              5.15.9               hb9a9bb5_5
qtawesome                 1.2.2                    pypi_0    pypi
qtconsole                 5.4.2           py310haa95532_0
qtpy                      2.2.0           py310haa95532_0
qtwebkit                  5.212                h2bbfb41_5
regex                     2023.6.3                 pypi_0    pypi
requests                  2.31.0          py310haa95532_0
retrying                  1.3.4                    pypi_0    pypi
rope                      1.7.0           py310haa95532_0
rtree                     1.0.1           py310h2eaa2aa_0
scikit-learn              1.2.2           py310hd266714_2    conda-forge
scipy                     1.10.0          py310hb9afe5d_1
seaborn                   0.12.2          py310haa95532_0
setuptools                68.0.0          py310haa95532_0
simplejson                3.19.1                   pypi_0    pypi
sip                       6.6.2           py310hd77b12b_0
six                       1.16.0             pyhd3eb1b0_1
snapgene-reader           0.1.20                   pypi_0    pypi
snowballstemmer           2.2.0              pyhd3eb1b0_0
sortedcontainers          2.4.0              pyhd3eb1b0_0
soupsieve                 2.4             py310haa95532_0
sphinx                    5.0.2           py310haa95532_0
sphinxcontrib-applehelp   1.0.2              pyhd3eb1b0_0
sphinxcontrib-devhelp     1.0.2              pyhd3eb1b0_0
sphinxcontrib-htmlhelp    2.0.0              pyhd3eb1b0_0
sphinxcontrib-jsmath      1.0.1              pyhd3eb1b0_0
sphinxcontrib-qthelp      1.0.3              pyhd3eb1b0_0
sphinxcontrib-serializinghtml 1.1.5              pyhd3eb1b0_0
spyder                    5.4.1           py310haa95532_0
spyder-kernels            2.4.1           py310haa95532_0
sqlalchemy                2.0.19                   pypi_0    pypi
sqlite                    3.41.2               h2bbff1b_0
stack_data                0.2.0              pyhd3eb1b0_0
tenacity                  8.2.2           py310haa95532_0
text-unidecode            1.3                pyhd3eb1b0_0
textdistance              4.2.1              pyhd3eb1b0_0
threadpoolctl             2.2.0              pyh0d69192_0
three-merge               0.1.1              pyhd3eb1b0_0
tinycss2                  1.2.1           py310haa95532_0
tk                        8.6.12               h2bbff1b_0
toml                      0.10.2             pyhd3eb1b0_0
tomli                     2.0.1           py310haa95532_0
tomlkit                   0.11.1          py310haa95532_0
tornado                   6.3.2           py310h2bbff1b_0
traitlets                 5.7.1           py310haa95532_0
typing-extensions         4.7.1           py310haa95532_0
typing_extensions         4.7.1           py310haa95532_0
tzdata                    2023c                h04d1e81_0
ucrt                      10.0.20348.0         haa95532_0
ujson                     5.4.0           py310hd77b12b_0
unidecode                 1.2.0              pyhd3eb1b0_0
urllib3                   1.26.16         py310haa95532_0
vc                        14.2                 h21ff451_1
vc14_runtime              14.36.32532         hfdfe4a8_17    conda-forge
vs2015_runtime            14.36.32532         h05e6639_17    conda-forge
watchdog                  2.1.6           py310haa95532_0
wcwidth                   0.2.5              pyhd3eb1b0_0
webencodings              0.5.1           py310haa95532_1
werkzeug                  2.2.3           py310haa95532_0
whatthepatch              1.0.2           py310haa95532_0
wheel                     0.38.4          py310haa95532_0
win_inet_pton             1.1.0           py310haa95532_0
wrapt                     1.14.1          py310h2bbff1b_0
xmltodict                 0.13.0                   pypi_0    pypi
xz                        5.4.2                h8cc25b3_0
yaml                      0.2.5                he774522_0
yapf                      0.31.0             pyhd3eb1b0_0
zeromq                    4.3.4                hd77b12b_0
zipp                      3.11.0          py310haa95532_0
zlib                      1.2.13               h8cc25b3_0
zstd                      1.5.5                hd43e919_0