Closed kkmll closed 1 year ago
Could you attach the full error message, including the stacks? The numpy dependency was added only because of this issue. I am just wondering if the error came up from my code.
Sorry about my late replay.
I upgraded numpy to 1.24 and here is the error message;
Traceback (most recent call last):
File "/home/altan/anaconda3/bin/vcfstats", line 8, in <module>
sys.exit(main())
File "/home/altan/anaconda3/lib/python3.9/site-packages/vcfstats/cli.py", line 235, in main
instance.plot()
File "/home/altan/anaconda3/lib/python3.9/site-packages/vcfstats/instance.py", line 285, in plot
self.save_plot(plt, theme_elems)
File "/home/altan/anaconda3/lib/python3.9/site-packages/vcfstats/instance.py", line 325, in save_plot
plt.save(
File "/home/altan/anaconda3/lib/python3.9/site-packages/plotnine/ggplot.py", line 727, in save
fig, p = self.draw(return_ggplot=True)
File "/home/altan/anaconda3/lib/python3.9/site-packages/plotnine/ggplot.py", line 217, in draw
self._draw_legend()
File "/home/altan/anaconda3/lib/python3.9/site-packages/plotnine/ggplot.py", line 425, in _draw_legend
legend_box = self.guides.build(self)
File "/home/altan/anaconda3/lib/python3.9/site-packages/plotnine/guides/guides.py", line 144, in build
gboxes = self.draw(gdefs, plot.theme)
File "/home/altan/anaconda3/lib/python3.9/site-packages/plotnine/guides/guides.py", line 286, in draw
return [g.draw() for g in gdefs]
File "/home/altan/anaconda3/lib/python3.9/site-packages/plotnine/guides/guides.py", line 286, in <listcomp>
return [g.draw() for g in gdefs]
File "/home/altan/anaconda3/lib/python3.9/site-packages/plotnine/guides/guide_legend.py", line 308, in draw
if isinstance(item, np.float) and np.float.is_integer(item):
File "/home/altan/anaconda3/lib/python3.9/site-packages/numpy/__init__.py", line 305, in __getattr__
raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
hope it helps. thanks
as I see vcfstats 0.4.2 required numpy <2.0, >=1.22. However when I try to create SNP dist plot via
vcfstats --vcf examples/sample.vcf \ --outdir examples/ \ --formula 'COUNT(1, VARTYPE[snp]) ~ SUBST[A>T,A>G,A>C,T>A,T>G,T>C,G>A,G>T,G>C,C>A,C>T,C>G]' \ --title 'Number of substitutions of SNPs (passed)' \ --config examples/config.toml \ --passed
it gives an error as module 'numpy' has no attribute 'float'. This is because as of numpy v1.20, numpy.float was deprecated. Anyway by downgrading the numpy even if pip gives an error as incompatible numpy version it still creates the desired plot. So maybe you would like to fix this, thanks.