wdecoster / NanoPlot

Plotting scripts for long read sequencing data
http://nanoplot.bioinf.be
MIT License
432 stars 47 forks source link

AttributeError: 'PolyCollection' object has no property 'stat_func' #222

Closed jaybake5 closed 3 years ago

jaybake5 commented 3 years ago

Good afternoon, I'm having issues installing and running NanoPlot. I installed NanoPlot with conda create -n nanoplot_env -c bioconda nanoplot, and I am getting the following error:

$ NanoPlot -t 4 --fastq G3-combined.fastq --plots hex dot --N50 -o G3_combined_nanoplot
/usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/_collections_abc.py:702: MatplotlibDeprecationWarning: The global colormaps dictionary is no longer considered public API.
  return len(self._mapping)
/usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/_collections_abc.py:720: MatplotlibDeprecationWarning: The global colormaps dictionary is no longer considered public API.
  yield from self._mapping
/usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/seaborn/distributions.py:2557: FutureWarning: `distplot` is a deprecated function and will be removed in a future version. Please adapt your code to use either `displot` (a figure-level function with similar flexibility) or `histplot` (an axes-level function for histograms).
  warnings.warn(msg, FutureWarning)

If you read this then NanoPlot 1.32.1 has crashed :-(
Please try updating NanoPlot and see if that helps...

If not, please report this issue at https://github.com/wdecoster/NanoPlot/issues
If you could include the log file that would be really helpful.
Thanks!

Traceback (most recent call last):
  File "/usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/bin/NanoPlot", line 10, in <module>
    sys.exit(main())
  File "/usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/nanoplot/NanoPlot.py", line 101, in main
    plots = make_plots(datadf, settings)
  File "/usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/nanoplot/NanoPlot.py", line 169, in make_plots
    plot_settings=plot_settings)
  File "/usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/nanoplotter/nanoplotter_main.py", line 135, in scatter
    height=10)
  File "/usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/seaborn/_decorators.py", line 46, in inner_f
    return f(**kwargs)
  File "/usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/seaborn/axisgrid.py", line 2189, in jointplot
    grid.plot_joint(plt.hexbin, **joint_kws)
  File "/usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/seaborn/axisgrid.py", line 1736, in plot_joint
    func(self.x, self.y, **kwargs)
  File "/usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/matplotlib/pyplot.py", line 2673, in hexbin
    **({"data": data} if data is not None else {}), **kwargs)
  File "/usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/matplotlib/__init__.py", line 1447, in inner
    return func(ax, *map(sanitize_sequence, args), **kwargs)
  File "/usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/matplotlib/axes/_axes.py", line 4853, in hexbin
    collection.update(kwargs)
  File "/usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/matplotlib/artist.py", line 996, in update
    raise AttributeError(f"{type(self).__name__!r} object "
AttributeError: 'PolyCollection' object has no property 'stat_func'

I tried updating:

$ conda update nanoplot
Collecting package metadata (current_repodata.json): done
Solving environment: done

# All requested packages already installed.

so I tried updating with pip:

$ pip install NanoPlot --upgrade
Requirement already satisfied: NanoPlot in /local/ifs2_projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages (1.32.1)
Collecting NanoPlot
  Using cached NanoPlot-1.33.1-py3-none-any.whl
Requirement already satisfied: pandas>=0.22.0 in /local/ifs2_projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages (from NanoPlot) (1.2.0)
Requirement already satisfied: numpy in /local/ifs2_projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages (from NanoPlot) (1.19.5)
Requirement already satisfied: pyarrow in /local/ifs2_projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages (from NanoPlot) (0.11.1)
Requirement already satisfied: biopython in /local/ifs2_projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages (from NanoPlot) (1.78)
Requirement already satisfied: nanomath>=1.0.0 in /local/ifs2_projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages (from NanoPlot) (1.2.0)
Requirement already satisfied: matplotlib>=3.1.3 in /local/ifs2_projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages (from NanoPlot) (3.3.3)
Requirement already satisfied: python-dateutil in /local/ifs2_projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages (from NanoPlot) (2.8.1)
Requirement already satisfied: plotly>=4.9.0 in /local/ifs2_projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages (from NanoPlot) (4.14.3)
Requirement already satisfied: pysam>0.10.0.0 in /local/ifs2_projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages (from NanoPlot) (0.15.3)
Requirement already satisfied: scipy in /local/ifs2_projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages (from NanoPlot) (1.6.0)
Requirement already satisfied: nanoget>=1.14.0 in /local/ifs2_projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages (from NanoPlot) (1.15.0)
Collecting pauvre==0.2.0
  Using cached pauvre-0.2-py3-none-any.whl
Requirement already satisfied: scikit-learn in /local/ifs2_projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages (from pauvre==0.2.0->NanoPlot) (0.24.0)
Collecting seaborn==0.10.1
  Using cached seaborn-0.10.1-py3-none-any.whl (215 kB)
Requirement already satisfied: cycler>=0.10 in /local/ifs2_projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages (from matplotlib>=3.1.3->NanoPlot) (0.10.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /local/ifs2_projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages (from matplotlib>=3.1.3->NanoPlot) (1.3.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in /local/ifs2_projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages (from matplotlib>=3.1.3->NanoPlot) (2.4.7)
Requirement already satisfied: pillow>=6.2.0 in /local/ifs2_projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages (from matplotlib>=3.1.3->NanoPlot) (8.1.0)
Requirement already satisfied: six in /local/ifs2_projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages (from cycler>=0.10->matplotlib>=3.1.3->NanoPlot) (1.15.0)
Requirement already satisfied: pytz>=2017.3 in /local/ifs2_projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages (from pandas>=0.22.0->NanoPlot) (2020.5)
Requirement already satisfied: retrying>=1.3.3 in /local/ifs2_projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages (from plotly>=4.9.0->NanoPlot) (1.3.3)
Collecting kaleido
  Using cached kaleido-0.1.0-py2.py3-none-manylinux1_x86_64.whl (74.6 MB)
Collecting Python-Deprecated
  Using cached Python_Deprecated-1.1.0-py2.py3-none-any.whl
Requirement already satisfied: threadpoolctl>=2.0.0 in /local/ifs2_projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages (from scikit-learn->pauvre==0.2.0->NanoPlot) (2.1.0)
Requirement already satisfied: joblib>=0.11 in /local/ifs2_projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages (from scikit-learn->pauvre==0.2.0->NanoPlot) (1.0.0)
Installing collected packages: Python-Deprecated, seaborn, pauvre, kaleido, NanoPlot
  Attempting uninstall: seaborn
    Found existing installation: seaborn 0.11.1
    Uninstalling seaborn-0.11.1:
      Successfully uninstalled seaborn-0.11.1
  Attempting uninstall: pauvre
    Found existing installation: pauvre 0.1924
    Uninstalling pauvre-0.1924:
      Successfully uninstalled pauvre-0.1924
  Attempting uninstall: NanoPlot
    Found existing installation: NanoPlot 1.32.1
    Uninstalling NanoPlot-1.32.1:
      Successfully uninstalled NanoPlot-1.32.1
Successfully installed NanoPlot-1.33.1 Python-Deprecated-1.1.0 kaleido-0.1.0 pauvre-0.2 seaborn-0.10.1

This appeared to work, but now I get glibc errors:

$ NanoPlot -t 4 --fastq G3-combined.fastq --plots hex dot --N50 -o G3_combined_nanoplot

If you read this then NanoPlot 1.33.1 has crashed :-(
Please try updating NanoPlot and see if that helps...

If not, please report this issue at https://github.com/wdecoster/NanoPlot/issues
If you could include the log file that would be really helpful.
Thanks!

Traceback (most recent call last):
  File "/usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/bin/NanoPlot", line 8, in <module>
    sys.exit(main())
  File "/usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/nanoplot/NanoPlot.py", line 101, in main
    plots = make_plots(datadf, settings)
  File "/usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/nanoplot/NanoPlot.py", line 155, in make_plots
    title=settings["title"])
  File "/usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/nanoplotter/nanoplotter_main.py", line 324, in length_plots
    plots.append(dynamic_histogram(array=array, name=name, path=path, title=title, color=color))
  File "/usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/nanoplotter/nanoplotter_main.py", line 347, in dynamic_histogram
    dynhist.save()
  File "/usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/nanoplotter/plot.py", line 42, in save
    self.save_static()
  File "/usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/nanoplotter/plot.py", line 58, in save_static
    pio.write_image(self.fig, self.path.replace('html', 'png'), engine="kaleido")
  File "/usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/plotly/io/_kaleido.py", line 252, in write_image
    engine=engine,
  File "/usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/plotly/io/_kaleido.py", line 132, in to_image
    fig_dict, format=format, width=width, height=height, scale=scale
  File "/usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/kaleido/scopes/plotly.py", line 104, in transform
    figure, format=format, width=width, height=height, scale=scale
  File "/usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/kaleido/scopes/base.py", line 280, in _perform_transform
    self._ensure_kaleido()
  File "/usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/kaleido/scopes/base.py", line 188, in _ensure_kaleido
    raise ValueError(message)
ValueError: Failed to start Kaleido subprocess. Error stream:

./bin/kaleido: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by ./bin/kaleido)
./bin/kaleido: /lib64/libc.so.6: version `GLIBC_2.15' not found (required by ./bin/kaleido)
./bin/kaleido: /lib64/libc.so.6: version `GLIBC_2.16' not found (required by ./bin/kaleido)
./bin/kaleido: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/kaleido/executable/lib/libnss3.so)
./bin/kaleido: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/kaleido/executable/lib/libnssutil3.so)
./bin/kaleido: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/kaleido/executable/lib/libnspr4.so)
./bin/kaleido: /lib64/libc.so.6: version `GLIBC_2.15' not found (required by /usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/kaleido/executable/lib/libnspr4.so)
./bin/kaleido: /lib64/libc.so.6: version `GLIBC_2.17' not found (required by /usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/kaleido/executable/lib/libnspr4.so)
./bin/kaleido: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/kaleido/executable/lib/libexpat.so.1)
./bin/kaleido: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/kaleido/executable/lib/libplc4.so)
./bin/kaleido: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot_env/lib/python3.7/site-packages/kaleido/executable/lib/libplds4.so)

So I tried creating a blank conda environment, and then installed pip with conda install pip and then tried pip install NanoPlot, and I got a whole bunch of red text ending with:

In file included from /usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot3_env/include/python3.9/unicodeobject.h:1026:0,
                       from /usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot3_env/include/python3.9/Python.h:97,
                       from numpy/random/mtrand/mtrand.c:4:
      /usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot3_env/include/python3.9/cpython/unicodeobject.h:446:26: note: declared here
       static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~
      error: Command "gcc -pthread -B /usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot3_env/compiler_compat -Wl,--sysroot=/ -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot3_env/include -fPIC -O2 -isystem /usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot3_env/include -fPIC -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -Inumpy/core/include -Ibuild/src.linux-x86_64-3.9/numpy/core/include/numpy -Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot3_env/include/python3.9 -Ibuild/src.linux-x86_64-3.9/numpy/core/src/common -Ibuild/src.linux-x86_64-3.9/numpy/core/src/npymath -Ibuild/src.linux-x86_64-3.9/numpy/core/src/common -Ibuild/src.linux-x86_64-3.9/numpy/core/src/npymath -c numpy/random/mtrand/mtrand.c -o build/temp.linux-x86_64-3.9/numpy/random/mtrand/mtrand.o -MMD -MF build/temp.linux-x86_64-3.9/numpy/random/mtrand/mtrand.o.d" failed with exit status 1
      ----------------------------------------
  ERROR: Command errored out with exit status 1: /usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot3_env/bin/python3.9 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/local/ifs3_scratch/MISC/jobaker/TMP/pip-install-3645_4qd/numpy_4366d5ecce854be49b8470bdbec914e0/setup.py'"'"'; __file__='"'"'/local/ifs3_scratch/MISC/jobaker/TMP/pip-install-3645_4qd/numpy_4366d5ecce854be49b8470bdbec914e0/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /local/ifs3_scratch/MISC/jobaker/TMP/pip-record-hoo8_dyb/install-record.txt --single-version-externally-managed --prefix /local/ifs3_scratch/MISC/jobaker/TMP/pip-build-env-550hbjgc/overlay --compile --install-headers /local/ifs3_scratch/MISC/jobaker/TMP/pip-build-env-550hbjgc/overlay/include/python3.9/numpy Check the logs for full command output.
  ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot3_env/bin/python3.9 /usr/local/projdata/0718/projects/jon/conda_envs/envs/nanoplot3_env/lib/python3.9/site-packages/pip install --ignore-installed --no-user --prefix /local/ifs3_scratch/MISC/jobaker/TMP/pip-build-env-550hbjgc/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'cython >= 0.29' 'numpy==1.14.5; python_version<'"'"'3.7'"'"'' 'numpy==1.16.0; python_version>='"'"'3.7'"'"'' setuptools setuptools_scm wheel Check the logs for full command output.

Any help would be fantastic. Thanks a lot,

Jon

wdecoster commented 3 years ago

Hi Jon,

Sorry for the inconvenience!

Your first error seems similar to https://github.com/wdecoster/NanoPlot/issues/201 In those cases, seaborn seems to cause issues with matplotlib, so I recommend downgrading seaborn. This is probably the easiest to solve too (out of your installation trouble). My newest conda recipe is stuck (https://github.com/bioconda/bioconda-recipes/pull/24347) because of some incompatible upstream dependencies, so you will have to downgrade seaborn now 'manually'. If the next version bioconda version gets fixed it should be taken care of automatically.

I am not sure if this contributed to what you are seeing, but it's generally not recommended to mix conda and pip. Unfortunate that you get kaleido errors... I'm not sure what the cause is there, if we can't solve those we may have to report those at https://github.com/plotly/Kaleido

The last error (with pip in the conda environment) looks rather scary too, so I'd rather try to solve that if all other things fail :)

Wouter

wdecoster commented 3 years ago

Hi,

Did this help in any way?

Thanks, Wouter

jaybake5 commented 3 years ago

Hi, Thanks a lot Wouter! I initially used a colleague's working NanoPlot environment to circumvent the issue, so sorry I didn't reply quickly. I just created a new conda environment with conda create -n nanoplot4_env -c bioconda nanoplot and then downgraded seaborn with conda install seaborn==0.10.1. I didn't change anything with matplotlib...I wasn't super clear from the other issue you referenced if I needed to. Regardless, NanoPlot now seems to be working. Very Best and thanks again,

Jon

wdecoster commented 3 years ago

Hi Jon,

Thanks for the feedback, it shouldn't be necessary to touch matplotlib. Good to hear it works, let me know if you encounter other issues!

Wouter

danrdanny commented 3 years ago

In case it comes up I just installed NanoPlot using Conda and ran into the same 'stat_func' error and did resolve it simply by downgrading seaborn with conda install seaborn==0.10.1.

wdecoster commented 3 years ago

I'm sorry for that, but good to hear that you could solve it. I can't get a new version on bioconda due to some incompatibilities, unfortunately.