Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unpin package dependencies #350

Merged
merged 8 commits into from
Sep 28, 2019
Merged

Unpin package dependencies #350

merged 8 commits into from
Sep 28, 2019

Conversation

jarmarshall
Copy link
Contributor

Since some progress has been made with updating packages I decided to see what happened when all pinnings were removed. The results were encouraging in that issue #210 did not manifest again on Mac in Safari. I played a little and saw only one problem... interacting repeatedly with controller vector1 in the user manual resulted in the following warning recurring after a while:

IOPub message rate exceeded.
The notebook server will temporarily stop sending output
to the client in order to avoid crashing it.
To change this limit, set the config variable
`--NotebookApp.iopub_msg_rate_limit`.

Current values:
NotebookApp.iopub_msg_rate_limit=1000.0 (msgs/sec)
NotebookApp.rate_limit_window=3.0 (secs)

@willfurnass could you review, play with these settings, and consider if this is indeed a complete fix? Be good to get @joefresna trying to break it too...

Should close #349 when merged

@jarmarshall
Copy link
Contributor Author

@willfurnass the Travis build for Python 3.6 seems to have failed for some server reason - are you able to do a local Tox test as part of your review please?

Copy link
Collaborator

@willfurnass willfurnass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jarmarshall With unpinned dependency versions changing widgets for e.g. model2.integrate() result in the creation of a new figure rather than the updating of an existing figure. I think this is distinct from #158 but it may be related.

I suspect the cleanest approach to addressing this could be to minimise the use of the stateful matplotlib API in favour of the cleaner OO API and pass references to Axes objects to functions that need to update matplotlib plots.

A meeting in person may be the quickest way to bootstrap my understanding of how MuMoT currently handles plotting inc figure updates.

@willfurnass
Copy link
Collaborator

Also, the Travis CI build with Python 3.6 seemed to fail because of a timeout at Travis' end so I've restarted that job.

@codecov-io
Copy link

codecov-io commented Sep 23, 2019

Codecov Report

Merging #350 into master will increase coverage by 1.81%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #350      +/-   ##
==========================================
+ Coverage   68.92%   70.73%   +1.81%     
==========================================
  Files           9        9              
  Lines        5766     5967     +201     
  Branches     1572     1748     +176     
==========================================
+ Hits         3974     4221     +247     
+ Misses       1398     1363      -35     
+ Partials      394      383      -11
Impacted Files Coverage Δ
mumot/views.py 66.21% <100%> (ø) ⬆️
mumot/__init__.py 92% <100%> (+7.38%) ⬆️
mumot/controllers.py 77.82% <0%> (ø) ⬆️
mumot/models.py 78.48% <0%> (+6.5%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8dcd2c3...7550bd6. Read the comment docs.

@jarmarshall
Copy link
Contributor Author

jarmarshall commented Sep 24, 2019

@willfurnass so that's not working properly on Linux - what version of Python are you on? I agree the stateful logic needs checking but be good to find out why this works on Mac but not on Linux - I am using Python 3.7.4 with the following environment. If we can identify the differences and some further, minor, pinning, maybe on minimum versions, then perhaps that will be sufficient for now.

antlr4-python3-runtime    4.7.2                    pypi_0    pypi
appnope                   0.1.0                    pypi_0    pypi
attrs                     19.1.0                   pypi_0    pypi
backcall                  0.1.0                    pypi_0    pypi
bleach                    3.1.0                    pypi_0    pypi
ca-certificates           2019.8.28                     0  
cairo                     1.14.12              hc4e6be7_4  
certifi                   2019.9.11                py37_0  
cycler                    0.10.0                   pypi_0    pypi
decorator                 4.4.0                    pypi_0    pypi
defusedxml                0.6.0                    pypi_0    pypi
entrypoints               0.3                      pypi_0    pypi
expat                     2.2.6                h0a44026_0  
fontconfig                2.13.0               h5d5b041_1  
freetype                  2.9.1                hb4e5f40_0  
fribidi                   1.0.5                h1de35cc_0  
gettext                   0.19.8.1             h15daf44_3  
glib                      2.56.2               hd9629dc_0  
graphite2                 1.3.13               h2098e52_0  
graphviz                  2.40.1               hefbbd9a_2  
harfbuzz                  1.8.8                hb8d4a28_0  
icu                       58.2                 h4b95b61_1  
ipykernel                 5.1.2                    pypi_0    pypi
ipython                   7.8.0                    pypi_0    pypi
ipython-genutils          0.2.0                    pypi_0    pypi
ipywidgets                7.5.1                    pypi_0    pypi
jedi                      0.15.1                   pypi_0    pypi
jinja2                    2.10.1                   pypi_0    pypi
jpeg                      9b                   he5867d9_2  
jsonschema                3.0.2                    pypi_0    pypi
jupyter-client            5.3.3                    pypi_0    pypi
jupyter-core              4.5.0                    pypi_0    pypi
kiwisolver                1.1.0                    pypi_0    pypi
libcxx                    4.0.1                hcfea43d_1  
libcxxabi                 4.0.1                hcfea43d_1  
libedit                   3.1.20181209         hb402a30_0  
libffi                    3.2.1                h475c297_4  
libiconv                  1.15                 hdd342a3_7  
libpng                    1.6.37               ha441bb4_0  
libtiff                   4.0.10               hcb84e12_2  
libxml2                   2.9.9                hf6e021a_1  
markupsafe                1.1.1                    pypi_0    pypi
matplotlib                3.1.1                    pypi_0    pypi
mistune                   0.8.4                    pypi_0    pypi
mpmath                    1.1.0                    pypi_0    pypi
mumot                     1.0.0                    pypi_0    pypi
nbconvert                 5.6.0                    pypi_0    pypi
nbformat                  4.4.0                    pypi_0    pypi
ncurses                   6.1                  h0a44026_1  
networkx                  2.3                      pypi_0    pypi
notebook                  6.0.1                    pypi_0    pypi
numpy                     1.17.2                   pypi_0    pypi
openssl                   1.1.1d               h1de35cc_1  
pandocfilters             1.4.2                    pypi_0    pypi
pango                     1.42.4               h060686c_0  
parso                     0.5.1                    pypi_0    pypi
pcre                      8.43                 h0a44026_0  
pexpect                   4.7.0                    pypi_0    pypi
pickleshare               0.7.5                    pypi_0    pypi
pip                       19.2.2                   py37_0  
pixman                    0.38.0               h1de35cc_0  
prometheus-client         0.7.1                    pypi_0    pypi
prompt-toolkit            2.0.9                    pypi_0    pypi
ptyprocess                0.6.0                    pypi_0    pypi
pydstool                  0.90.3                   pypi_0    pypi
pygments                  2.4.2                    pypi_0    pypi
pyparsing                 2.4.2                    pypi_0    pypi
pyrsistent                0.15.4                   pypi_0    pypi
python                    3.7.4                h359304d_1  
python-dateutil           2.8.0                    pypi_0    pypi
python-graphviz           0.13                     pypi_0    pypi
pyzmq                     18.1.0                   pypi_0    pypi
readline                  7.0                  h1de35cc_5  
scipy                     1.3.1                    pypi_0    pypi
send2trash                1.5.0                    pypi_0    pypi
setuptools                41.2.0                   py37_0  
six                       1.12.0                   pypi_0    pypi
sqlite                    3.29.0               ha441bb4_0  
sympy                     1.4                      pypi_0    pypi
terminado                 0.8.2                    pypi_0    pypi
testpath                  0.4.2                    pypi_0    pypi
tk                        8.6.8                ha441bb4_0  
tornado                   6.0.3                    pypi_0    pypi
traitlets                 4.3.2                    pypi_0    pypi
wcwidth                   0.1.7                    pypi_0    pypi
webencodings              0.5.1                    pypi_0    pypi
wheel                     0.33.6                   py37_0  
widgetsnbextension        3.5.1                    pypi_0    pypi
xz                        5.2.4                h1de35cc_4  
zlib                      1.2.11               h1de35cc_3  
zstd                      1.3.7                h5bba6e5_0  

@willfurnass
Copy link
Collaborator

Hmm, I can't spot any obvious differences between your conda env and my auto-generated tox env that might explain this:

$ .tox/py37/bin/python -m pip freeze
alabaster==0.7.12
antlr4-python3-runtime==4.7.2
atomicwrites==1.3.0
attrs==19.1.0
Babel==2.7.0
backcall==0.1.0
bleach==3.1.0
certifi==2019.9.11
chardet==3.0.4
codecov==2.0.15
colorama==0.4.1
coverage==4.5.4
cycler==0.10.0
decorator==4.4.0
defusedxml==0.6.0
docutils==0.15.2
entrypoints==0.3
gitdb2==2.0.5
GitPython==3.0.2
graphviz==0.13
idna==2.8
imagesize==1.1.0
importlib-metadata==0.23
ipykernel==5.1.2
ipython==7.8.0
ipython-genutils==0.2.0
ipywidgets==7.5.1
jedi==0.15.1
Jinja2==2.10.1
jsonschema==3.0.2
jupyter==1.0.0
jupyter-client==5.3.3
jupyter-console==6.0.0
jupyter-core==4.5.0
kiwisolver==1.1.0
MarkupSafe==1.1.1
matplotlib==3.1.1
mistune==0.8.4
more-itertools==7.2.0
mpmath==1.1.0
mumot==1.0.0
nbconvert==5.6.0
nbdime==1.1.0
nbformat==4.4.0
nbval==0.9.2
networkx==2.3
notebook==6.0.1
numpy==1.17.2
packaging==19.2
pandocfilters==1.4.2
parso==0.5.1
pexpect==4.7.0
pickleshare==0.7.5
pluggy==0.13.0
prometheus-client==0.7.1
prompt-toolkit==2.0.9
ptyprocess==0.6.0
py==1.8.0
PyDSTool==0.90.3
Pygments==2.4.2
pyparsing==2.4.2
pyrsistent==0.15.4
pytest==5.1.3
pytest-cov==2.7.1
python-dateutil==2.8.0
pytz==2019.2
pyzmq==18.1.0
qtconsole==4.5.5
requests==2.22.0
scipy==1.3.1
Send2Trash==1.5.0
six==1.12.0
smmap2==2.0.5
snowballstemmer==1.9.1
Sphinx==2.2.0
sphinxcontrib-applehelp==1.0.1
sphinxcontrib-devhelp==1.0.1
sphinxcontrib-htmlhelp==1.0.2
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.2
sphinxcontrib-serializinghtml==1.1.3
sympy==1.4
terminado==0.8.2
testpath==0.4.2
tornado==6.0.3
traitlets==4.3.2
urllib3==1.25.5
wcwidth==0.1.7
webencodings==0.5.1
widgetsnbextension==3.5.1
zipp==0.6.0

@jarmarshall If you run jupyter within a tox environment using the following then do you experience the same issue with duplicate plots (rather than updated plots)?

$ tox -r
$ .tox/py37/bin/jupyter notebook

@jarmarshall
Copy link
Contributor Author

OK - @willfurnass are you able to isolate which command causes the duplicate figure to appear? This would involve looking into _replotFunction in whichever view you want to work. Removing stateful calls to matplotlib is a good idea but it would be helpful to know which of several candidates is the culprit... main candidates are plt.gca(), plt.gcf() or plt.plot(figureNum) I believe...

@jarmarshall
Copy link
Contributor Author

Looking in the replot function for field views, there is also plt.clf() - so I suspect either this or plt.plot(figNum) are causing the problem...

@jarmarshall
Copy link
Contributor Author

Just noted this warning for multi controllers:

/Users/james/Google Drive/Home/Git/MuMoT/mumot/views.py:550: MatplotlibDeprecationWarning: Adding an axes using the same arguments as a previous axes currently reuses the earlier instance.  In a future version, a new instance will always be created and returned.  Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.
  plt.subplot(self._numRows, self._numColumns, subPlotNum)

@jarmarshall
Copy link
Contributor Author

OK - so I thought to point MyBinder at the update-notebook branch and can confirm that the same issue is present there... also I now have a testing environment to try and fix this in. Who's working on this? Me? Are you doing anything at present @willfurnass ?

@jarmarshall
Copy link
Contributor Author

jarmarshall commented Sep 28, 2019

OK, so looking at this on binder I now think that the problem probably lies with the nbagg backend to matplotlib, which handles notebook rendering of interactive figures; the usual interactive figure buttons are missing...

Also, we're only using TkAgg under OS X, which may help explain why the issue still manifests on Linux, but apparently not on Mac...

@jarmarshall
Copy link
Contributor Author

jarmarshall commented Sep 28, 2019

Yup, that's it... still need to find a Windows tester

@jarmarshall jarmarshall merged commit 0da06d0 into master Sep 28, 2019
@willfurnass
Copy link
Collaborator

@jarmarshall Your removal of that call to create a new figure has fixed the duplicate figure issue on Linux.

NB your attempt to force TkAgg hasn't worked for me: matplotlib.get_backend() still returns nbAgg within a Jupyter session on my Linux box.

@willfurnass willfurnass deleted the update-notebook branch September 30, 2019 11:51
@jarmarshall
Copy link
Contributor Author

Which call? As long as it works...

@willfurnass
Copy link
Collaborator

Your removal of plt.figure(self._figureNum) did the trick.

@jarmarshall
Copy link
Contributor Author

Interesting - I think I may have done that by accident - I am now surprised that the right figures get updated when there are multiple figures being interacted with, but on OS X it seems correct - can you please check on Linux? The failure mode would be create controller1, then controller2, interact with controller1 again and the other controller's figure is updated...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unpin package dependencies
3 participants