wdecoster / NanoPlot

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

dependencies missing after pip install NanoPlot and pip install NanoPlot --upgrade #287

Closed michael-liem closed 1 year ago

michael-liem commented 2 years ago

I created an conda environment with the following nanoplot.yml file:

name: nanoplot dependencies: -python=3.8

create environment $conda env create --file nanoplot.yml $conda activate nanoplot

install and upgrade nanoplot $pip install NanoPlot $pip install NanoPlot --upgrade

hereafter I got an error message indicating matplotlib and seaborn was not installed, I tried to fix it with: $python -m pip install --user matplotlib seaborn

at this point I do get a plot (yeah) but there are still error messages showing up: NanoPlot -t 10 --fastq ~/file.fastq --maxlength 40000 --plots dot --legacy hex

If you read this then NanoPlot 1.39.0 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 "/home/michael/miniconda3/envs/daur2/bin/NanoPlot", line 8, in sys.exit(main()) File "/home/michael/miniconda3/envs/daur2/lib/python3.8/site-packages/nanoplot/NanoPlot.py", line 109, in main plots = make_plots(datadf, settings) File "/home/michael/miniconda3/envs/daur2/lib/python3.8/site-packages/nanoplot/NanoPlot.py", line 181, in make_plots nanoplotter.scatter( File "/home/michael/miniconda3/envs/daur2/lib/python3.8/site-packages/nanoplotter/nanoplotter_main.py", line 172, in scatter plots_made += scatter_legacy(x=x[idx], File "/home/michael/miniconda3/envs/daur2/lib/python3.8/site-packages/nanoplotter/nanoplotter_main.py", line 231, in scatter_legacy plot = sns.jointplot( File "/home/michael/miniconda3/envs/daur2/lib/python3.8/site-packages/seaborn/_decorators.py", line 46, in inner_f return f(kwargs) File "/home/michael/miniconda3/envs/daur2/lib/python3.8/site-packages/seaborn/axisgrid.py", line 2300, in jointplot grid.plot_joint(plt.hexbin, joint_kws) File "/home/michael/miniconda3/envs/daur2/lib/python3.8/site-packages/seaborn/axisgrid.py", line 1808, in plot_joint func(self.x, self.y, *kwargs) File "/home/michael/.local/lib/python3.8/site-packages/matplotlib/pyplot.py", line 2572, in hexbin ret = gca().hexbin( File "/home/michael/.local/lib/python3.8/site-packages/matplotlib/init__.py", line 1412, in inner return func(ax, map(sanitize_sequence, args), **kwargs) File "/home/michael/.local/lib/python3.8/site-packages/matplotlib/axes/_axes.py", line 4824, in hexbin collection.update(kwargs) File "/home/michael/.local/lib/python3.8/site-packages/matplotlib/artist.py", line 1064, in update raise AttributeError(f"{type(self).name!r} object " AttributeError: 'PolyCollection' object has no property 'stat_func'

Hope this helps to improve,

Cheers, Michael

p.s. I just figured out then when I omit the flag --legacy hex no error messages occur

wdecoster commented 2 years ago

I am a little confused why you are installing things both with conda and pip. I would recommend you stick to one of those installation methods.

The error you report is a duplicate of https://github.com/wdecoster/NanoPlot/issues/201 Please downgrade seaborn to version 0.10.1

michael-liem commented 2 years ago

Why I setup the environment with conda and then inside the environment I install NanoPlot with pip instead of conda you mean?

That is another fix since conda install nanoplot couldn't find the correct channel, even though I run conda config before installing NanoPlot : conda config --add channels defaults conda config --add channels bioconda conda config --add channels conda-forge conda install nanoplot

It was an - all roads lead to Rome - idea

However, I just retried the conda install nanoplot and now the correct channels are found (apparently), hmmm maybe the datarepo was temporarily unavailable or something . Sorry for the confusing message.

I made another environment using the yml file shown above. Inside the environment I run conda config (as shown above) and then conda install nanoplot, the correct channels are found and the installation is complete.

When I run: NanoPlot -t 10 --fastq reads.fastq --maxlength 40000 --plots dot --legacy hex

I still get this error message:

If you read this then NanoPlot 1.39.0 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 "/home/michael/miniconda3/envs/test2/lib/python3.8/site-packages/nanoplotter/nanoplotter_main.py", line 201, in scatter_legacy import seaborn as sns ModuleNotFoundError: No module named 'seaborn'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/michael/miniconda3/envs/test2/bin/NanoPlot", line 10, in sys.exit(main()) File "/home/michael/miniconda3/envs/test2/lib/python3.8/site-packages/nanoplot/NanoPlot.py", line 109, in main plots = make_plots(datadf, settings) File "/home/michael/miniconda3/envs/test2/lib/python3.8/site-packages/nanoplot/NanoPlot.py", line 181, in make_plots nanoplotter.scatter( File "/home/michael/miniconda3/envs/test2/lib/python3.8/site-packages/nanoplotter/nanoplotter_main.py", line 172, in scatter plots_made += scatter_legacy(x=x[idx], File "/home/michael/miniconda3/envs/test2/lib/python3.8/site-packages/nanoplotter/nanoplotter_main.py", line 204, in scatter_legacy sys.stderr("NanoPlot needs seaborn and matplotlib with --legacy") TypeError: '_io.TextIOWrapper' object is not callable

When I try to update nanoplot with: conda update nanoplot

everything seems up to date according to: Collecting package metadata (current_repodata.json): done Solving environment: done

All requested packages already installed.

Then I rerun the command: NanoPlot -t 10 --fastq reads.fastq --maxlength 40000 --plots dot --legacy hex

and the same error message occurs, it seems that seaborn and matplotlib are not automatically installed when using either pip or conda install?

Do I need to install those manually?

Thank you!

Michael

michael-liem commented 2 years ago

I have figured this out for you; when I make two identical conda environments using a yml file

name: test1 dependencies: -python=3.8

name: test2 dependencies: -python=3.8

Then when I go inside the environments and try to install NanoPlot in two ways: env test1) conda install -c bioconda nanoplot env test2) conda install nanoplot

only the second install is able to finish.

conda install -c bioconda nanoplot is trying to solve the environment but seems to be stuck (its has been trying to solve it for over 30 minutes and is still running)

conda install -c bioconda nanoplot Collecting package metadata (current_repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve. Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source. Collecting package metadata (repodata.json): done Solving environment: \

It is because of this behavior that I initially decided to install NanoPlot with pip. However due to some coincidental mistake I forgot to indicate the -c bioconda channel during another installation try, to find out NanoPlot actually gets installed when omitting the -c flag during installation.