rrwick / Verticall

Recombination-free trees
GNU General Public License v3.0
56 stars 2 forks source link

Matplotlib error #1

Closed gbouras13 closed 2 years ago

gbouras13 commented 2 years ago

Hi Ryan,

Verticall looks absolutely amazing like the rest of your work! I am very keen to understand and use it on a bunch of different datasets I have.

I've found an issue with the installation that seems to be caused by the recent matplotlib 3.6.0 release, a dependency of plotnine (see this issue ).

First, I tried using the pip3 methods of installation, but I kept getting an error with meson to do with OpenBLAS

  Run-time dependency openblas found: NO (tried pkgconfig, framework and cmake)
  Run-time dependency openblas found: NO (tried pkgconfig, framework and cmake)

  ../../scipy/meson.build:130:0: ERROR: Dependency "OpenBLAS" not found, tried pkgconfig, framework and cmake

(I imagine what follows will be relevant for pip installations anyway if it installs matplotlib v3.6.0).

So I switched to conda.

When I installed the packages outlined in requirements.txt with conda, I got this error.

File "/Users/a1667917/mambaforge/envs/verticall/lib/python3.10/site-packages/plotnine/stats/stat_density_2d.py", line 3, in import matplotlib._contour as _contour ModuleNotFoundError: No module named 'matplotlib._contour'

When I enforced matplotlib==3.5.3 instead Verticall installed perfectly.

Here is my forked repo for anyone who wants to try a conda install with conda (with minimap2 as well).

Assuming the yml file is in a cloned Verticall repo directory

conda env create -f Verticall/conda_environment.yml 
conda activate verticall 
pip3 install ./Verticall
verticall --help

Which worked.

George

rrwick commented 2 years ago

Thanks for this!

Verticall only uses Matplotlib and plotnine in a couple of its commands (e.g. Verticall view), so I'll look into moving the imports around so those packages are only loaded when those commands are run. That way users could run other Verticall commands, even if they run into these package issues.

Ryan

rrwick commented 2 years ago

This seems to be fixed in the newest version of plotnine: https://plotnine.readthedocs.io/en/stable/changelog.html. I just tried with plotnine v0.10.1 and matplotlib v3.6.1, and it seems to work fine.

However, I also moved the matplotlib and plotnine imports into the functions that use them, so if a problem like this shows up in the future, it will only affect Verticall when using its plotting functionality. This has the bonus benefit of making all Verticall commands (even verticall --help) launch a bit faster.

Thanks!