Rstudio Cloud and PyPlot

I am working on a markdown document in RStudio Cloud - you can view it here: https://rstudio.cloud/project/735788

(please note, I put eval = F in the chunk so it would knit for class purposes)

When I try to call matplotlib and use pyplot, I get this error message:

RuntimeError: Evaluation error: ImportError: /lib/x86_64-linux-gnu/libz.so.1: version `ZLIB_1.2.9' not found (required by /home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages/matplotlib/../../../libpng16.so.16)

Detailed traceback: 
  File "/home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages/matplotlib/pyplot.py", line 722, in savefig
    res = fig.savefig(*args, **kwargs)
  File "/home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages/matplotlib/figure.py", line 2180, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "/home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages/matplotlib/backend_bases.py", line 2082, in print_figure
    **kwargs)
  File "/home/rstudio-user/.local/share/r-miniconda/envs/r-reticulate/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py", line 501, in print_png
    from matplotlib import _png
.

Detailed traceback: 
  File "<string>", line 1, in <module>
  File "/home/rstudio-user/R/x86_64-pc-linux-gnu-library/3.6/reticulate/python/rpytools/call.py", line 21, in python_function
    raise RuntimeError(res[kErrorKey])

Googling has lead me to believe that I can't fix this myself - it's a missing library that would normally be installed with sudo. Any other suggestions?

zlib is present, it's just version 1.2.8

You appear to be using a version of miniconda to install things that are pre-compiled and not compiling against the system upon which they are actually being used. If there is an option to compile matplot (or however libpng is installed into your reticulate) instead of downloading pre-compiled bits, that would be a good option.

Otherwise, I expect that we will be shifting the underlying version of Ubuntu that is used from 16.04 Xenial to 18.04 Bionic some time next year.

Thanks! I used pip install --ignore-installed matplotlib to reinstall it and that seemed to fix it.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.