lisphilar / covid19-sir

CovsirPhy: Python library for COVID-19 analysis with phase-dependent SIR-derived ODE models.
https://lisphilar.github.io/covid19-sir/
Apache License 2.0
109 stars 44 forks source link

[Fix] python kernel stops working when instantiating a scenario after upgrading to 2.16.0 version with Ananconda&pip #596

Closed andrybicio closed 3 years ago

andrybicio commented 3 years ago

Summary

I have upgraded the covsirphy to 2.16.0 through

pip install --upgrade covsirphy

and now it Python raises an error.

Codes

from covid19dh import covid19
import covsirphy as cs
import numpy as np
import pandas as pd
import datetime
import matplotlib.pyplot as plt
import os
import seaborn as sns

os.makedirs("results/", exist_ok = True)

data_loader     = cs.DataLoader("input")
# (Main) Data
jhu_data        = data_loader.jhu(verbose = False)
jhu_data.records(country = "Italy")
# (Main) Population in each country
population_data = data_loader.population()

National_scenario = cs.Scenario(jhu_data, population_data, country="Italy", province= None, tau=1440)

here the kernel stops working, but is shown as still running (the "*" in Jupyter Notebook next to the cell).

Outputs

` [IPKernelApp] ERROR | Exception in message handler: Traceback (most recent call last): File "/home/andrea/anaconda3/lib/python3.7/site-packages/ipykernel/kernelbase.py", line 268, in dispatch_shell yield gen.maybe_future(handler(stream, idents, msg)) File "/home/andrea/anaconda3/lib/python3.7/site-packages/tornado/gen.py", line 735, in run value = future.result() File "/home/andrea/anaconda3/lib/python3.7/site-packages/tornado/gen.py", line 742, in run yielded = self.gen.throw(*exc_info) # type: ignore File "/home/andrea/anaconda3/lib/python3.7/site-packages/ipykernel/kernelbase.py", line 545, in execute_request user_expressions, allow_stdin, File "/home/andrea/anaconda3/lib/python3.7/site-packages/tornado/gen.py", line 735, in run value = future.result() File "/home/andrea/anaconda3/lib/python3.7/site-packages/tornado/gen.py", line 209, in wrapper yielded = next(result) File "/home/andrea/anaconda3/lib/python3.7/site-packages/ipykernel/ipkernel.py", line 287, in do_execute and should_run_async(code) File "/home/andrea/anaconda3/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 2963, in should_run_async stacklevel=2, DeprecationWarning:should_run_asyncwill not calltransform_cellautomatically in the future. Please pass the result totransformed_cellargument and any exception that happen during thetransform inpreprocessing_exc_tuple` in IPython 7.17 and above.

``

Environment

lisphilar commented 3 years ago

Thank you for your reporting. I will check the codes.

Did you try uninstall of all dependencies? This seems version conflict of dependencies.

pip install pip-autoremove
pip-autoremove covsirphy -y
pip install covsirphy
lisphilar commented 3 years ago

Before that, please share the output of pip freeze.

lisphilar commented 3 years ago

I'm trying to find solutions with CovsirPhy, but this is related to ipykernel or jupyter system.

andrybicio commented 3 years ago

Before that, please share the output of pip freeze.

Here you are

aiohttp==3.6.2 alabaster==0.7.12 alembic==1.5.1 anaconda-client==1.7.2 anaconda-navigator==1.9.12 anaconda-project @ file:///tmp/build/80754af9/anaconda-project_1610472525955/work appdirs==1.4.4 apptools @ file:///tmp/build/80754af9/apptools_1610638091833/work argh==0.26.2 argon2-cffi @ file:///tmp/build/80754af9/argon2-cffi_1596828452693/work arviz==0.6.1 asciitree==0.3.3 asn1crypto @ file:///tmp/build/80754af9/asn1crypto_1596577642040/work astroid @ file:///tmp/build/80754af9/astroid_1592495881661/work astropy @ file:///tmp/build/80754af9/astropy_1606922938720/work async-generator==1.10 async-timeout==3.0.1 asyncssh==2.3.0 atomicwrites==1.4.0 attrs @ file:///tmp/build/80754af9/attrs_1604765588209/work autopep8==1.4.4 Babel @ file:///tmp/build/80754af9/babel_1607110387436/work backcall==0.2.0 backports.functools-lru-cache @ file:///tmp/build/80754af9/backports.functools_lru_cache_1605305165209/work backports.shutil-get-terminal-size @ file:///tmp/build/80754af9/backports.shutil_get_terminal_size_1608222128777/work backports.tempfile @ file:///home/linux1/recipes/ci/backports.tempfile_1610991236607/work backports.weakref==1.0.post1 bcrypt==3.1.7 beautifulsoup4 @ file:///home/linux1/recipes/ci/beautifulsoup4_1610988766420/work better-exceptions==0.3.2 bitarray @ file:///tmp/build/80754af9/bitarray_1605065136653/work bkcharts==0.2 bleach @ file:///tmp/build/80754af9/bleach_1600439572647/work blis==0.4.1 bokeh @ file:///tmp/build/80754af9/bokeh_1603297847301/work boto==2.49.0 boto3==1.9.66 botocore==1.12.189 Bottleneck==1.3.2 brotlipy==0.7.0 cachetools @ file:///tmp/build/80754af9/cachetools_1607706694405/work catalogue==1.0.0 certifi==2020.12.5 cffi @ file:///tmp/build/80754af9/cffi_1606255099073/work cftime @ file:///tmp/build/80754af9/cftime_1605995786647/work chardet @ file:///tmp/build/80754af9/chardet_1605303159953/work click @ file:///home/linux1/recipes/ci/click_1610990599742/work click-plugins==1.1.1 cliff==3.6.0 cligj==0.7.1 cloudpickle==1.5.0 clyent==1.2.2 cmaes==0.7.0 cmd2==1.4.0 colorama @ file:///tmp/build/80754af9/colorama_1607707115595/work colorlog==4.7.2 conda==4.9.2 conda-build==3.20.3 conda-package-handling @ file:///tmp/build/80754af9/conda-package-handling_1603018138503/work conda-verify==3.4.2 configobj==5.0.6 contextlib2==0.6.0.post1 country-converter==0.7.1 covid19dh==2.3.0 covsirphy==2.16.0 cryptography @ file:///tmp/build/80754af9/cryptography_1607635305226/work cycler==0.10.0 cymem @ file:///tmp/build/80754af9/cymem_1605062262695/work cypari==2.3.1 Cython @ file:///tmp/build/80754af9/cython_1605457613176/work cytoolz==0.11.0 dask==2020.12.0 dataframe==0.2.1.3 decorator==4.4.2 defusedxml==0.6.0 descartes==1.1.0 diff-match-patch @ file:///tmp/build/80754af9/diff-match-patch_1594828741838/work dill==0.3.1.1 distributed @ file:///tmp/build/80754af9/distributed_1605066520545/work docutils==0.16 entrypoints==0.3 envisage @ file:///tmp/build/80754af9/envisage_1594351320406/work et-xmlfile==1.0.1 fastcache==1.1.0 fasteners @ file:///tmp/build/80754af9/fasteners_1608142287400/work filelock @ file:///home/linux1/recipes/ci/filelock_1610993975404/work Fiona==1.8.18 flake8==3.7.9 Flask==1.1.2 fortran-language-server==1.12.0 fs==2.4.11 fs-s3fs==1.1.1 fsspec==0.8.5 future==0.18.2 FXrays==1.3.3 genxword==2.1.0 geographiclib==1.50 geopandas==0.8.2 geopy @ file:///home/conda/feedstock_root/build_artifacts/geopy_1609078823613/work gevent @ file:///tmp/build/80754af9/gevent_1610823010370/work glob2 @ file:///home/linux1/recipes/ci/glob2_1610991677669/work gmpy2==2.0.8 graphviz==0.14 greenlet @ file:///tmp/build/80754af9/greenlet_1600873995270/work h5py==2.10.0 HeapDict==1.0.1 html5lib @ file:///tmp/build/80754af9/html5lib_1593446221756/work idna @ file:///home/linux1/recipes/ci/idna_1610986105248/work imageio @ file:///tmp/build/80754af9/imageio_1594161405741/work imagesize==1.2.0 img2pdf==0.3.3 importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1602276842396/work iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work intervaltree @ file:///tmp/build/80754af9/intervaltree_1598376443606/work ipykernel @ file:///tmp/build/80754af9/ipykernel_1596206598566/work/dist/ipykernel-5.3.4-py3-none-any.whl ipython @ file:///tmp/build/80754af9/ipython_1610725412642/work ipython-genutils @ file:///tmp/build/80754af9/ipython_genutils_1606773439826/work ipywidgets @ file:///tmp/build/80754af9/ipywidgets_1610481889018/work isort @ file:///tmp/build/80754af9/isort_1602603989581/work it-core-news-lg @ https://github.com/explosion/spacy-models/releases/download/it_core_news_lg-2.3.0/it_core_news_lg-2.3.0.tar.gz it-core-news-sm @ https://github.com/explosion/spacy-models/releases/download/it_core_news_sm-2.3.0/it_core_news_sm-2.3.0.tar.gz itsdangerous==1.1.0 japanmap==0.0.21 jdcal==1.4.1 jedi==0.15.2 jeepney @ file:///tmp/build/80754af9/jeepney_1606148855031/work jellyfish @ file:///home/conda/feedstock_root/build_artifacts/jellyfish_1602336227051/work Jinja2 @ file:///home/linux1/recipes/ci/jinja2_1610990516718/work jmespath @ file:///tmp/build/80754af9/jmespath_1594304593830/work joblib @ file:///tmp/build/80754af9/joblib_1607970656719/work json5==0.9.5 jsonpickle @ file:///tmp/build/80754af9/jsonpickle_1610909665283/work jsonschema==3.0.2 jupyter==1.0.0 jupyter-client @ file:///tmp/build/80754af9/jupyter_client_1601311786391/work jupyter-console @ file:///tmp/build/80754af9/jupyter_console_1598884538475/work jupyter-core @ file:///tmp/build/80754af9/jupyter_core_1606148959479/work jupyter-server-proxy @ file:///home/conda/feedstock_root/build_artifacts/jupyter-server-proxy_1590048206892/work jupyterlab==2.2.6 jupyterlab-pygments @ file:///tmp/build/80754af9/jupyterlab_pygments_1601490720602/work jupyterlab-server @ file:///tmp/build/80754af9/jupyterlab_server_1594164409481/work jupyterlab-widgets @ file:///tmp/build/80754af9/jupyterlab_widgets_1609884341231/work keyring @ file:///tmp/build/80754af9/keyring_1609353628028/work kiwisolver @ file:///tmp/build/80754af9/kiwisolver_1604014532738/work lazy-object-proxy @ file:///tmp/build/80754af9/lazy-object-proxy_1607707315973/work libarchive-c @ file:///home/linux1/recipes/ci/python-libarchive-c_1610974153025/work llvmlite==0.34.0 locket==0.2.0 lxml @ file:///tmp/build/80754af9/lxml_1606516847630/work lz4==2.2.1 Mako @ file:///tmp/build/80754af9/mako_1610650590832/work mapclassify==2.4.2 MarkupSafe @ file:///tmp/build/80754af9/markupsafe_1594371495811/work matplotlib @ file:///tmp/build/80754af9/matplotlib-base_1603376012865/work mayavi==4.7.1 mccabe==0.6.1 meshio @ file:///home/conda/feedstock_root/build_artifacts/meshio_1608663191312/work mistune @ file:///tmp/build/80754af9/mistune_1594373098390/work mkl-fft==1.2.0 mkl-random==1.1.1 mkl-service==2.3.0 mock @ file:///tmp/build/80754af9/mock_1607622725907/work monotonic==1.5 more-itertools @ file:///tmp/build/80754af9/more-itertools_1605111547926/work mpmath==1.1.0 msgpack @ file:///tmp/build/80754af9/msgpack-python_1607965762326/work multidict @ file:///tmp/build/80754af9/multidict_1600456400975/work multipledispatch==0.6.0 munch==2.5.0 murmurhash @ file:///tmp/build/80754af9/murmurhash_1607456104392/work navigator-updater==0.2.1 nb-conda-kernels @ file:///tmp/build/80754af9/nb_conda_kernels_1600445339329/work nbclient @ file:///tmp/build/80754af9/nbclient_1602783176460/work nbconvert @ file:///tmp/build/80754af9/nbconvert_1601914821128/work nbformat @ file:///tmp/build/80754af9/nbformat_1610738111109/work nest-asyncio @ file:///tmp/build/80754af9/nest-asyncio_1606153767164/work netCDF4==1.5.1.2 networkx @ file:///tmp/build/80754af9/networkx_1598376031484/work nltk @ file:///tmp/build/80754af9/nltk_1592496090529/work nose @ file:///tmp/build/80754af9/nose_1606773131901/work notebook @ file:///tmp/build/80754af9/notebook_1608835548841/work numba @ file:///tmp/build/80754af9/numba_1600102479638/work numcodecs @ file:///tmp/build/80754af9/numcodecs_1601500045532/work numexpr @ file:///tmp/build/80754af9/numexpr_1609354613445/work numpy @ file:///tmp/build/80754af9/numpy_and_numpy_base_1596233707986/work numpydoc @ file:///tmp/build/80754af9/numpydoc_1605117425582/work olefile==0.46 opencv-python==4.5.1.48 openpyxl @ file:///tmp/build/80754af9/openpyxl_1610651698508/work optuna==2.4.0 packaging @ file:///tmp/build/80754af9/packaging_1607971725249/work pandas==1.2.0 pandocfilters @ file:///tmp/build/80754af9/pandocfilters_1605120451932/work paramiko==2.7.1 parso==0.5.2 partd==1.1.0 path @ file:///tmp/build/80754af9/path_1607537225003/work pathlib2 @ file:///tmp/build/80754af9/pathlib2_1607024979554/work pathtools==0.1.2 patsy==0.5.1 pbr==5.5.1 pep8==1.7.1 pexpect @ file:///tmp/build/80754af9/pexpect_1605563209008/work pickleshare @ file:///tmp/build/80754af9/pickleshare_1606932040724/work Pillow @ file:///tmp/build/80754af9/pillow_1609786740831/work pkginfo==1.7.0 plac @ file:///tmp/build/80754af9/plac_1594259967326/work plink==2.3 plotly==4.5.4 pluggy==0.13.1 ply==3.11 preshed==3.0.2 prettytable==0.7.2 prometheus-client @ file:///tmp/build/80754af9/prometheus_client_1606344362066/work prompt-toolkit @ file:///tmp/build/80754af9/prompt-toolkit_1602688806899/work psutil @ file:///tmp/build/80754af9/psutil_1598370249042/work ptyprocess @ file:///tmp/build/80754af9/ptyprocess_1609355006118/work/dist/ptyprocess-0.7.0-py2.py3-none-any.whl py @ file:///tmp/build/80754af9/py_1607971587848/work pyarrow==0.17.0 pycairo==1.11.1 pycodestyle==2.5.0 pycosat==0.6.3 pycparser @ file:///tmp/build/80754af9/pycparser_1594388511720/work pycrypto==2.6.1 pycurl==7.43.0.6 pydocstyle @ file:///tmp/build/80754af9/pydocstyle_1598885001695/work pydot==1.4.1 pyemd==0.5.1 pyerfa @ file:///tmp/build/80754af9/pyerfa_1606860189168/work pyface @ file:///tmp/build/80754af9/pyface_1607623358767/work pyflakes==2.1.1 Pygments @ file:///tmp/build/80754af9/pygments_1610565767015/work PyGObject==3.38.0 pygpu==0.7.6 pygraphviz==1.3 pylint @ file:///tmp/build/80754af9/pylint_1598624038450/work pymc3==3.8 PyNaCl==1.4.0 pyodbc===4.0.0-unsupported pyOpenSSL @ file:///tmp/build/80754af9/pyopenssl_1608057966937/work pyparsing @ file:///home/linux1/recipes/ci/pyparsing_1610983426697/work pyperclip==1.8.1 Pyphen==0.9.5 pypng==0.0.20 pyproj==3.0.0.post1 pyrsistent @ file:///tmp/build/80754af9/pyrsistent_1600141707582/work PySocks @ file:///tmp/build/80754af9/pysocks_1594394576006/work pytest==0.0.0 python-dateutil==2.8.1 python-editor==1.0.4 python-jsonrpc-server==0.3.4 python-language-server==0.31.10 python-snappy==0.5.4 pytz @ file:///tmp/build/80754af9/pytz_1608922264688/work pyvis @ file:///home/conda/feedstock_root/build_artifacts/pyvis_1596500675592/work pyvista @ file:///home/conda/feedstock_root/build_artifacts/pyvista_1600914412586/work PyWavelets @ file:///tmp/build/80754af9/pywavelets_1601658308664/work pyxdg @ file:///tmp/build/80754af9/pyxdg_1603822279816/work PyYAML==5.3.1 pyzmq==20.0.0 QDarkStyle==2.8.1 QtAwesome @ file:///tmp/build/80754af9/qtawesome_1602272867890/work qtconsole @ file:///tmp/build/80754af9/qtconsole_1600870028330/work QtPy==1.9.0 regex @ file:///tmp/build/80754af9/regex_1606772657907/work requests @ file:///tmp/build/80754af9/requests_1608241421344/work retrying==1.3.3 rope @ file:///tmp/build/80754af9/rope_1602264064449/work Rtree==0.9.4 ruamel-yaml==0.15.87 ruptures==1.1.2 s3fs==0.4.2 s3transfer==0.1.13 scikit-image==0.16.2 scikit-learn==0.24.0 scipy==1.6.0 scooby @ file:///home/conda/feedstock_root/build_artifacts/scooby_1594303955168/work scribd-dl==0.4.5 seaborn @ file:///tmp/build/80754af9/seaborn_1608578541026/work SecretStorage @ file:///tmp/build/80754af9/secretstorage_1606864755624/work selenium==3.141.0 Send2Trash @ file:///tmp/build/80754af9/send2trash_1607525499227/work Shapely==1.7.1 simpervisor @ file:///home/conda/feedstock_root/build_artifacts/simpervisor_1609865618711/work simplegeneric==0.8.1 singledispatch @ file:///tmp/build/80754af9/singledispatch_1602523705405/work six @ file:///tmp/build/80754af9/six_1605205313296/work snakeviz==2.1.0 snappy==2.7 snappy-manifolds==1.1 snowballstemmer==2.0.0 soco==0.20 sortedcollections @ file:///tmp/build/80754af9/sortedcollections_1610912176901/work sortedcontainers @ file:///tmp/build/80754af9/sortedcontainers_1606865132123/work soupsieve @ file:///tmp/build/80754af9/soupsieve_1607965878077/work spacy @ file:///tmp/build/80754af9/spacy_1608321093591/work spherogram==1.8.2 Sphinx @ file:///tmp/build/80754af9/sphinx_1610133430332/work sphinxcontrib-applehelp==1.0.2 sphinxcontrib-devhelp==1.0.2 sphinxcontrib-htmlhelp==1.0.3 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.3 sphinxcontrib-serializinghtml==1.1.4 sphinxcontrib-websupport @ file:///tmp/build/80754af9/sphinxcontrib-websupport_1597081412696/work spyder==4.1.3 spyder-kernels @ file:///tmp/build/80754af9/spyder-kernels_1599056754119/work SQLAlchemy @ file:///tmp/build/80754af9/sqlalchemy_1608243750780/work srsly @ file:///tmp/build/80754af9/srsly_1607548514031/work statsmodels @ file:///tmp/build/80754af9/statsmodels_1606925351355/work stevedore==3.3.0 sympy @ file:///tmp/build/80754af9/sympy_1608137658835/work tables==3.6.1 tabulate==0.8.7 tblib @ file:///tmp/build/80754af9/tblib_1597928476713/work terminado==0.9.2 testpath==0.4.4 textacy==0.10.0 Theano==1.0.4 thinc @ file:///tmp/build/80754af9/thinc_1607710140838/work threadpoolctl @ file:///tmp/tmp9twdgx9k/threadpoolctl-2.1.0-py3-none-any.whl toml @ file:///tmp/build/80754af9/toml_1592853716807/work toolz @ file:///tmp/build/80754af9/toolz_1601054250827/work tornado==6.0.4 tqdm @ file:///tmp/build/80754af9/tqdm_1609788246169/work traitlets @ file:///tmp/build/80754af9/traitlets_1602787416690/work traits @ file:///tmp/build/80754af9/traits_1596110798593/work traitsui @ file:///tmp/build/80754af9/traitsui_1603305459846/work typed-ast @ file:///tmp/build/80754af9/typed-ast_1610484562261/work typing-extensions @ file:///tmp/build/80754af9/typing_extensions_1598376058250/work ujson==1.35 unicodecsv==0.14.1 Unidecode==1.2.0 urllib3 @ file:///tmp/build/80754af9/urllib3_1603305693037/work vtk==8.2.0 wasabi @ file:///tmp/build/80754af9/wasabi_1599244993840/work watchdog @ file:///tmp/build/80754af9/watchdog_1606939061947/work wbdata==0.3.0 wcwidth @ file:///tmp/build/80754af9/wcwidth_1593447189090/work webencodings==0.5.1 Werkzeug==1.0.1 widgetsnbextension==3.5.1 wordcloud @ file:///home/conda/feedstock_root/build_artifacts/wordcloud_1605555574624/work wrapt==1.11.2 wurlitzer @ file:///tmp/build/80754af9/wurlitzer_1594751868473/work xarray @ file:///tmp/build/80754af9/xarray_1606939276139/work xlrd @ file:///tmp/build/80754af9/xlrd_1608072521494/work XlsxWriter @ file:///tmp/build/80754af9/xlsxwriter_1602692860603/work xlwt==1.3.0 xmltodict==0.12.0 yapf @ file:///tmp/build/80754af9/yapf_1593528177422/work yarl @ file:///tmp/build/80754af9/yarl_1606939952652/work zarr @ file:///tmp/build/80754af9/zarr_1600550595518/work zict==2.0.0 zipp @ file:///tmp/build/80754af9/zipp_1604001098328/work zope.event==4.5.0 zope.interface @ file:///tmp/build/80754af9/zope.interface_1606940237377/work

lisphilar commented 3 years ago

Anaconda seems also related.

Did downgrading CovsirPhy fix this problem?

andrybicio commented 3 years ago

Actually downgrading only CovsirPhy solved the problem.

pip install --upgrade covsirphy==2.15.0

lisphilar commented 3 years ago

I released new stable version 2.16.1 with #597. Please update CovsirPhy with pip install --upgrade covsirphy==2.16.1 because I confirmed the problem was fixed in Kaggle Notebook.

Details: With !pip install --upgrade "git+https://github.com/lisphilar/covid19-sir.git@(commit number)", I found https://github.com/lisphilar/covid19-sir/commit/c55faabfa9b113fe0c81798a095463dc156050f4 caused error in Kaggle Notebook (Anaconda + pip).

With this commit, DeprecationWarning was assumed as a error. In Anaconda&pip environment, DeprecationWarning was raised by kernel-related packages and the commit converted this warning to a fal error.

andrybicio commented 3 years ago

I released new stable version 2.16.1 with #597. Please update CovsirPhy with pip install --upgrade covsirphy==2.16.1 because I confirmed the problem was fixed in Kaggle Notebook.

I confirmed it was fixed for me as well after upgrading to 2.16.1. Thank you!

lisphilar commented 3 years ago

Thank you for your confirmation!