broadinstitute / CellBender

CellBender is a software package for eliminating technical artifacts from high-throughput single-cell RNA sequencing (scRNA-seq) data.
https://cellbender.rtfd.io
BSD 3-Clause "New" or "Revised" License
285 stars 52 forks source link

Problem installing cellbender #351

Open marctormo opened 5 months ago

marctormo commented 5 months ago

Hello,

I tried to install CellBender with conda but I'm getting this error when executing:

(cellbender) bash-4.2$ cellbender 
Traceback (most recent call last):
  File "/homes/aplic/noarch/software/Miniconda3/4.9.2/envs/cellbender/bin/cellbender", line 8, in <module>
    sys.exit(main())
  File "/gpfs42/robbyfs/homes/aplic/noarch/build_custom/CellBender/cellbender/base_cli.py", line 108, in main
    cli_dict = generate_cli_dictionary()
  File "/gpfs42/robbyfs/homes/aplic/noarch/build_custom/CellBender/cellbender/base_cli.py", line 65, in generate_cli_dictionary
    module_cli = importlib.import_module('.'.join(module_cli_str_list))
  File "/homes/aplic/noarch/software/Miniconda3/4.9.2/envs/cellbender/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/gpfs42/robbyfs/homes/aplic/noarch/build_custom/CellBender/cellbender/remove_background/cli.py", line 8, in <module>
    from cellbender.remove_background.run import run_remove_background
  File "/gpfs42/robbyfs/homes/aplic/noarch/build_custom/CellBender/cellbender/remove_background/run.py", line 5, in <module>
    from cellbender.remove_background.data.dataset import get_dataset_obj, \
  File "/gpfs42/robbyfs/homes/aplic/noarch/build_custom/CellBender/cellbender/remove_background/data/dataset.py", line 9, in <module>
    from cellbender.remove_background.data.io import load_data
  File "/gpfs42/robbyfs/homes/aplic/noarch/build_custom/CellBender/cellbender/remove_background/data/io.py", line 4, in <module>
    import anndata
  File "/homes/aplic/noarch/software/Miniconda3/4.9.2/envs/cellbender/lib/python3.7/site-packages/anndata/__init__.py", line 7, in <module>
    from ._core.anndata import AnnData
  File "/homes/aplic/noarch/software/Miniconda3/4.9.2/envs/cellbender/lib/python3.7/site-packages/anndata/_core/anndata.py", line 18, in <module>
    from natsort import natsorted
  File "/homes/aplic/noarch/software/Miniconda3/4.9.2/envs/cellbender/lib/python3.7/site-packages/natsort/__init__.py", line 3, in <module>
    from natsort.natsort import (
  File "/homes/aplic/noarch/software/Miniconda3/4.9.2/envs/cellbender/lib/python3.7/site-packages/natsort/natsort.py", line 757, in <module>
    os_sort_key = os_sort_keygen()
  File "/homes/aplic/noarch/software/Miniconda3/4.9.2/envs/cellbender/lib/python3.7/site-packages/natsort/natsort.py", line 725, in os_sort_keygen
    loc = natsort.compat.locale.get_icu_locale()
  File "/homes/aplic/noarch/software/Miniconda3/4.9.2/envs/cellbender/lib/python3.7/site-packages/natsort/compat/locale.py", line 44, in get_icu_locale
    return icu.Locale(f"{language_code}.{encoding}")
AttributeError: module 'icu' has no attribute 'Locale'

Do you have any clues on how to solve that? Many thanks!

sjfleming commented 5 months ago

It looks like this is coming down to something in anndata, which is a package that cellbender imports and uses to read .h5ad AnnData-format files.

I wonder if you can try the following: import anndata in python

(cellbender) bash-4.2$ python
>>> import anndata

Do you see the same error? Maybe you could look into different ways to install anndata. For example, you might be able to conda install anndata (https://anaconda.org/conda-forge/anndata) rather than relying on cellbender to pip install anndata as a dependency.

I will say: miniconda 4.9.2 looks like it's python 3.8. But cellbender only supports python 3.7 currently. I'd recommend making sure you're using python 3.7. If you don't it will cause problems for cellbender.

marctormo commented 5 months ago

Hi and thanks for your answer.

Unfortunately, I'm obtaining the same error. What I'm doing is:

conda create -y -n cellbender python=3.7
source activate cellbender
conda install -y -c anaconda pytables
pip install torch==1.11.0
conda install -y anaconda::libstdcxx-ng 
conda install -y anndata
export LD_LIBRARY_PATH=/homes/aplic/noarch/software/Miniconda3/4.9.2/envs/cellbender/lib/:$LD_LIBRARY_PATH
cd /aplic/noarch/build_custom/
git clone https://github.com/broadinstitute/CellBender.git
# modify requirements.txt: remove anndata>=0.7, add torch==1.11.0
pip install -e CellBender

And I'm obtaing the same errors:

(cellbender) bash-4.2$ python -c "import anndata"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/homes/aplic/noarch/software/Miniconda3/4.9.2/envs/cellbender/lib/python3.7/site-packages/anndata/__init__.py", line 7, in <module>
    from ._core.anndata import AnnData
  File "/homes/aplic/noarch/software/Miniconda3/4.9.2/envs/cellbender/lib/python3.7/site-packages/anndata/_core/anndata.py", line 18, in <module>
    from natsort import natsorted
  File "/homes/aplic/noarch/software/Miniconda3/4.9.2/envs/cellbender/lib/python3.7/site-packages/natsort/__init__.py", line 3, in <module>
    from natsort.natsort import (
  File "/homes/aplic/noarch/software/Miniconda3/4.9.2/envs/cellbender/lib/python3.7/site-packages/natsort/natsort.py", line 757, in <module>
    os_sort_key = os_sort_keygen()
  File "/homes/aplic/noarch/software/Miniconda3/4.9.2/envs/cellbender/lib/python3.7/site-packages/natsort/natsort.py", line 725, in os_sort_keygen
    loc = natsort.compat.locale.get_icu_locale()
  File "/homes/aplic/noarch/software/Miniconda3/4.9.2/envs/cellbender/lib/python3.7/site-packages/natsort/compat/locale.py", line 44, in get_icu_locale
    return icu.Locale(f"{language_code}.{encoding}")
AttributeError: module 'icu' has no attribute 'Locale'

(cellbender) bash-4.2$ python -V
Python 3.7.12

Thanks!