We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I installed scanpy as the first package in a brand new conda environment. This worked fine but when importing scanpy I get the error below. It sounds like this is because as of pandas 2.0 is_categorical is deprecated: https://stackoverflow.com/questions/76234312/importerror-cannot-import-name-is-categorical-from-pandas-api-types
is_categorical
This issue is also fixed when I downgrade pandas to 1.5.3.
import scanpy as sc
--------------------------------------------------------------------------- ImportError Traceback (most recent call last) Untitled-1.ipynb Cell 20 in <cell line: 1>() ----> 1 import scanpy as sc File ~/mambaforge/envs/basic_comp_bio/lib/python3.9/site-packages/scanpy/__init__.py:18, in <module> 16 from . import preprocessing as pp 17 from . import plotting as pl ---> 18 from . import datasets, logging, queries, external, get 20 from anndata import AnnData, concat 21 from anndata import ( 22 read_h5ad, 23 read_csv, (...) 29 read_umi_tools, 30 ) File ~/mambaforge/envs/basic_comp_bio/lib/python3.9/site-packages/scanpy/external/__init__.py:4, in <module> 2 from . import pl 3 from . import pp ----> 4 from . import exporting 6 import sys 7 from .. import _utils File ~/mambaforge/envs/basic_comp_bio/lib/python3.9/site-packages/scanpy/external/exporting.py:14, in <module> 12 import matplotlib.pyplot as plt 13 from anndata import AnnData ---> 14 from pandas.api.types import is_categorical 16 from ..preprocessing._utils import _get_mean_var 17 from .._utils import NeighborsView ImportError: cannot import name 'is_categorical' from 'pandas.api.types' (/Users/michael/mambaforge/envs/basic_comp_bio/lib/python3.9/site-packages/pandas/api/types/__init__.py)
conda list # packages in environment at /Users/michael/mambaforge/envs/basic_comp_bio: # # Name Version Build Channel anndata 0.9.1 pyhd8ed1ab_0 conda-forge appnope 0.1.2 py39hca03da5_1001 anaconda asttokens 2.0.5 pyhd3eb1b0_0 anaconda backcall 0.2.0 pyhd3eb1b0_0 anaconda blosc 1.21.4 hc338f07_0 conda-forge brotli 1.0.9 h1a8c8d9_9 conda-forge brotli-bin 1.0.9 h1a8c8d9_9 conda-forge brotli-python 1.0.9 py39h23fbdae_9 conda-forge bzip2 1.0.8 h3422bc3_4 conda-forge c-ares 1.19.1 hb547adb_0 conda-forge c-blosc2 2.10.0 h068da5f_0 conda-forge ca-certificates 2022.4.26 hca03da5_0 anaconda cached-property 1.5.2 hd8ed1ab_1 conda-forge cached_property 1.5.2 pyha770c72_1 conda-forge certifi 2022.6.15 py39hca03da5_0 anaconda charset-normalizer 3.2.0 pyhd8ed1ab_0 conda-forge colorama 0.4.6 pyhd8ed1ab_0 conda-forge curl 8.1.2 hc52a3a8_1 conda-forge cycler 0.11.0 pyhd8ed1ab_0 conda-forge debugpy 1.5.1 py39hc377ac9_0 anaconda decorator 5.1.1 pyhd3eb1b0_0 anaconda dunamai 1.18.0 pyhd8ed1ab_0 conda-forge entrypoints 0.4 py39hca03da5_0 anaconda executing 0.8.3 pyhd3eb1b0_0 anaconda fonttools 4.41.0 py39h0f82c59_0 conda-forge freetype 2.12.1 hd633e50_1 conda-forge get_version 3.5.4 pyhd8ed1ab_0 conda-forge gettext 0.21.1 h0186832_0 conda-forge git 2.41.0 pl5321h46e2b6d_0 conda-forge h5py 3.9.0 nompi_py39he9c2634_101 conda-forge hdf5 1.14.1 nompi_h3aba7b3_100 conda-forge idna 3.4 pyhd8ed1ab_0 conda-forge importlib-metadata 6.8.0 pyha770c72_0 conda-forge importlib_metadata 6.8.0 hd8ed1ab_0 conda-forge ipykernel 6.9.1 py39hca03da5_0 anaconda ipython 8.3.0 py39hca03da5_0 anaconda jedi 0.18.1 py39hca03da5_1 anaconda joblib 1.3.0 pyhd8ed1ab_1 conda-forge jupyter_client 7.2.2 py39hca03da5_0 anaconda jupyter_core 4.10.0 py39hca03da5_0 anaconda kiwisolver 1.4.4 py39haaf3ac1_1 conda-forge krb5 1.21.1 h92f50d5_0 conda-forge lcms2 2.15 hd835a16_1 conda-forge legacy-api-wrap 1.2 py_0 conda-forge lerc 4.0.0 h9a09cb3_0 conda-forge libaec 1.0.6 hb7217d7_1 conda-forge libblas 3.9.0 17_osxarm64_openblas conda-forge libbrotlicommon 1.0.9 h1a8c8d9_9 conda-forge libbrotlidec 1.0.9 h1a8c8d9_9 conda-forge libbrotlienc 1.0.9 h1a8c8d9_9 conda-forge libcblas 3.9.0 17_osxarm64_openblas conda-forge libcurl 8.1.2 hc52a3a8_1 conda-forge libcxx 16.0.6 h4653b0c_0 conda-forge libdeflate 1.18 h1a8c8d9_0 conda-forge libedit 3.1.20191231 hc8eb9b7_2 conda-forge libev 4.33 h642e427_1 conda-forge libexpat 2.5.0 hb7217d7_1 conda-forge libffi 3.4.2 h3422bc3_5 conda-forge libgfortran 5.0.0 12_2_0_hd922786_31 conda-forge libgfortran5 12.2.0 h0eea778_31 conda-forge libiconv 1.17 he4db4b2_0 conda-forge libjpeg-turbo 2.1.5.1 h1a8c8d9_0 conda-forge liblapack 3.9.0 17_osxarm64_openblas conda-forge libllvm14 14.0.6 hd1a9a77_3 conda-forge libnghttp2 1.52.0 hae82a92_0 conda-forge libopenblas 0.3.23 openmp_hc731615_0 conda-forge libpng 1.6.39 h76d750c_0 conda-forge libsodium 1.0.18 h1a28f6b_0 anaconda libsqlite 3.42.0 hb31c410_0 conda-forge libssh2 1.11.0 h7a5bd25_0 conda-forge libtiff 4.5.1 h23a1a89_0 conda-forge libwebp-base 1.3.1 hb547adb_0 conda-forge libxcb 1.15 hf346824_0 conda-forge libzlib 1.2.13 h53f4e23_5 conda-forge llvm-openmp 16.0.6 h1c12783_0 conda-forge llvmlite 0.40.1 py39hbad4f83_0 conda-forge lz4-c 1.9.4 hb7217d7_0 conda-forge matplotlib-base 3.5.3 py39ha500c34_2 conda-forge matplotlib-inline 0.1.2 pyhd3eb1b0_2 anaconda munkres 1.0.7 py_1 bioconda natsort 8.4.0 pyhd8ed1ab_0 conda-forge ncurses 6.4 h7ea286d_0 conda-forge nest-asyncio 1.5.5 py39hca03da5_0 anaconda networkx 3.1 pyhd8ed1ab_0 conda-forge numba 0.57.1 py39he8ed757_0 conda-forge numexpr 2.8.4 py39hd28f0be_0 conda-forge numpy 1.24.4 py39h485cf63_0 conda-forge openjpeg 2.5.0 hbc2ba62_2 conda-forge openssl 3.1.1 h53f4e23_1 conda-forge packaging 23.1 pyhd8ed1ab_0 conda-forge pandas 2.0.3 py39h6b13a34_1 conda-forge parso 0.8.3 pyhd3eb1b0_0 anaconda patsy 0.5.3 pyhd8ed1ab_0 conda-forge pcre2 10.40 hb34f9b4_0 conda-forge perl 5.32.1 4_hf2054a2_perl5 conda-forge pexpect 4.8.0 pyhd3eb1b0_3 anaconda pickleshare 0.7.5 pyhd3eb1b0_1003 anaconda pillow 10.0.0 py39h1641143_0 conda-forge pip 23.2 pyhd8ed1ab_0 conda-forge platformdirs 3.9.1 pyhd8ed1ab_0 conda-forge pooch 1.7.0 pyha770c72_3 conda-forge prompt-toolkit 3.0.20 pyhd3eb1b0_0 anaconda pthread-stubs 0.4 h27ca646_1001 conda-forge ptyprocess 0.7.0 pyhd3eb1b0_2 anaconda pure_eval 0.2.2 pyhd3eb1b0_0 anaconda py-cpuinfo 9.0.0 pyhd8ed1ab_0 conda-forge pygments 2.11.2 pyhd3eb1b0_0 anaconda pynndescent 0.5.10 pyh1a96a4e_0 conda-forge pyparsing 3.1.0 pyhd8ed1ab_0 conda-forge pysocks 1.7.1 pyha2e5f31_6 conda-forge pytables 3.8.0 py39h0da393b_2 conda-forge python 3.9.16 hea58f1e_0_cpython conda-forge python-dateutil 2.8.2 pyhd8ed1ab_0 conda-forge python-tzdata 2023.3 pyhd8ed1ab_0 conda-forge python_abi 3.9 3_cp39 conda-forge pytz 2023.3 pyhd8ed1ab_0 conda-forge pyzmq 22.3.0 py39hc377ac9_2 anaconda readline 8.2 h92ec313_1 conda-forge requests 2.31.0 pyhd8ed1ab_0 conda-forge scanpy 1.7.2 pyhdfd78af_0 bioconda scikit-learn 1.3.0 py39hd5c4a62_0 conda-forge scipy 1.11.1 py39ha6b2cbd_0 conda-forge seaborn 0.12.2 hd8ed1ab_0 conda-forge seaborn-base 0.12.2 pyhd8ed1ab_0 conda-forge setuptools 68.0.0 pyhd8ed1ab_0 conda-forge setuptools-scm 7.1.0 pyhd8ed1ab_0 conda-forge setuptools_scm 7.1.0 hd8ed1ab_0 conda-forge sinfo 0.3.1 py_0 conda-forge six 1.16.0 pyh6c4a22f_0 conda-forge snappy 1.1.10 h17c5cce_0 conda-forge stack_data 0.2.0 pyhd3eb1b0_0 anaconda statsmodels 0.14.0 py39h8a366b7_1 conda-forge stdlib-list 0.8.0 pyhd8ed1ab_0 conda-forge tbb 2021.9.0 hffc8910_0 conda-forge threadpoolctl 3.2.0 pyha21a80b_0 conda-forge tk 8.6.12 he1e0b03_0 conda-forge tomli 2.0.1 pyhd8ed1ab_0 conda-forge tornado 6.1 py39h1a28f6b_0 anaconda tqdm 4.65.0 pyhd8ed1ab_1 conda-forge traitlets 5.1.1 pyhd3eb1b0_0 anaconda typing-extensions 4.7.1 hd8ed1ab_0 conda-forge typing_extensions 4.7.1 pyha770c72_0 conda-forge tzdata 2023c h71feb2d_0 conda-forge umap-learn 0.5.3 py39h2804cbe_1 conda-forge unicodedata2 15.0.0 py39h02fc5c5_0 conda-forge urllib3 2.0.3 pyhd8ed1ab_1 conda-forge wcwidth 0.2.5 pyhd3eb1b0_0 anaconda wheel 0.40.0 pyhd8ed1ab_1 conda-forge xorg-libxau 1.0.11 hb547adb_0 conda-forge xorg-libxdmcp 1.1.3 h27ca646_0 conda-forge xz 5.2.6 h57fd34a_0 conda-forge zeromq 4.3.4 hc377ac9_0 anaconda zipp 3.16.2 pyhd8ed1ab_0 conda-forge zlib-ng 2.0.7 h1a8c8d9_0 conda-forge zstd 1.5.2 h4f39d0f_7 conda-forge
The text was updated successfully, but these errors were encountered:
You have scanpy 1.7.3, not the newest version. This is fixed in #2434.
I’ll release 1.9.3 soon with the fix.
Sorry, something went wrong.
No branches or pull requests
Please make sure these conditions are met
What happened?
I installed scanpy as the first package in a brand new conda environment. This worked fine but when importing scanpy I get the error below. It sounds like this is because as of pandas 2.0
is_categorical
is deprecated: https://stackoverflow.com/questions/76234312/importerror-cannot-import-name-is-categorical-from-pandas-api-typesThis issue is also fixed when I downgrade pandas to 1.5.3.
Minimal code sample
Error output
Versions
The text was updated successfully, but these errors were encountered: