Open aravind1338 opened 3 years ago
Thanks for the bug report! I think you should use:
import scanpy as sc
instead of
import scanpy.api as sc
Is there any reason you're using scanpy.api
?
@flying-sheep @falexwolf, was there a reason we didn't just make those statements equivalent?
I'm actually testing and tweaking someone else's code that was written a while ago. I assume they used
import scanpy.api as sc
because it was appropriate then. I personally resolved my issue by downgrading versions, I just wanted to bring this up!
I'm actually testing and tweaking someone else's code that was written a while ago. I assume they used
import scanpy.api as sc
because it was appropriate then. I personally resolved my issue by downgrading versions, I just wanted to bring this up!
I encountered the same issue. Which version are you using to fix this?
I'm actually testing and tweaking someone else's code that was written a while ago. I assume they used
import scanpy.api as sc
because it was appropriate then. I personally resolved my issue by downgrading versions, I just wanted to bring this up!I encountered the same issue. Which version are you using to fix this?
nm, downgrading to 1.5.1 fixed my problem. Thanks!
Hi I had this problem as well with 1.6.0 it was triggered by scanpy's test code.
scanpy.api (unittest.loader._FailedTest) ... ERROR
======================================================================
ERROR: scanpy.api (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: scanpy.api
Traceback (most recent call last):
File "/usr/lib/python3.9/unittest/loader.py", line 470, in _find_test_path
package = self._get_module_from_name(name)
File "/usr/lib/python3.9/unittest/loader.py", line 377, in _get_module_from_name
__import__(name)
File "/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9_scanpy/build/scanpy/api/__init__.py", line 27, in <module>
from . import pl
File "/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9_scanpy/build/scanpy/api/pl.py", line 1, in <module>
from ..plotting._anndata import scatter, violin, ranking, clustermap, stacked_violin, heatmap, dotplot, matrixplot, tracksplot
ImportError: cannot import name 'stacked_violin' from 'scanpy.plotting._anndata' (/<<PKGBUILDDIR>>/.pybuild/cpython3_3.9_scanpy/build/scanpy/plotting/_anndata.py)
----------------------------------------------------------------------
Ran 1 test in 0.000s
I ended up with this patch to get the tests to run successfully.
--- a/scanpy/api/pl.py
+++ b/scanpy/api/pl.py
@@ -1,4 +1,7 @@
-from ..plotting._anndata import scatter, violin, ranking, clustermap, stacked_violin, heatmap, dotplot, matrixplot, tracksplot
+from ..plotting._anndata import scatter, violin, ranking, clustermap, heatmap, tracksplot
+from ..plotting._stacked_violin import stacked_violin
+from ..plotting._dotplot import dotplot
+from ..plotting._matrixplot import matrixplot
from ..plotting._preprocessing import filter_genes_dispersion, highly_variable_genes
Minimal code sample (that we can copy&paste without having any data)
This is with the latest version of scanpy. I looked at the code and scanpy/apt/pl.py still has from ..plotting._anndata import scatter, violin, ranking, clustermap, stacked_violin, heatmap, dotplot, matrixplot, tracksplot, even as the plotting library has been refactored and the dotplot, matrixplot and stacked_violin are now in separate files.
I tested this a few days ago and it was working fine then, the update to anndata probably happened in the last couple of days