georgebv / pyextremes

Extreme Value Analysis (EVA) in Python
https://georgebv.github.io/pyextremes/
MIT License
239 stars 47 forks source link

Error when running your quick start example #35

Closed DamienIrving closed 2 years ago

DamienIrving commented 2 years ago

I tried to run the quick start example on your website and got an error when trying to plot the diagnostics.

You can view the error in the following notebook: https://github.com/climate-resilient-enterprise/frequency-analysis/blob/master/examples/pyextremes_example.ipynb

It was run on Rocky Linux 8.6, with pyextremes version 2.2.4 and python version 3.10.5.

georgebv commented 2 years ago

This looks like a bug with matplotlib and not with pyextremes - the error occurs when figure is created. Try running the following code and post here what happens:

import matplotlib.pyplot as plt
plt.figure(figsize=(5,5), dpi=96)

I would also like to know how you installed pyextremes - looks like miniconda. Can you share your python environment (output of conda list command)? I'd like to see versions of all packages you have there.

DamienIrving commented 2 years ago

Thanks for the prompt to run conda list.

When I ran your quick start example on my linux machine in an existing conda environment (which threw the error I shared and give the same error for plt.figure(figsize=(5,5), dpi=96)), conda list showed the following versions of matplotlib were installed:

matplotlib-base          3.5.3             py310h78c5c2f_2    conda-forge
matplotlib-inline         0.1.5              pyhd8ed1ab_0         conda-forge

I then created a fresh environment with just pyextremes and jupyter installed (conda create -n pyextreme jupyter pyextremes) and the quick start example worked just fine. This time conda list showed:

matplotlib-base          3.5.3             py310h78c5c2f_2    conda-forge
matplotlib-inline         0.1.6              pyhd8ed1ab_0         conda-forge

I therefore ran conda update matplotlib-inline in my existing conda environment, which fixed the error I shared with you.

I wonder whether in the conda package for pyextremes you could require matplotlib-inline >= 1.6? That might prevent anyone else having this same problem.

Thanks again for your help.

georgebv commented 2 years ago

Glad it worked out for you. matplotlib-inline is a jupyter dependency and is not related to pyextremes (even though it's convenient to use in jupyter).

This was a bug with that specific version (0.1.5) of matplotlib-inline: https://github.com/ipython/matplotlib-inline/pull/19, so I'm closing this issue.