icbi-lab / infercnvpy

Infer copy number variation (CNV) from scRNA-seq data. Plays nicely with Scanpy.
https://infercnvpy.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
131 stars 27 forks source link

Encountering an ImportError with conda environment #139

Open Richard-D-Watson opened 1 month ago

Richard-D-Watson commented 1 month ago

Report

Hi. Thank you so much for your efforts in developing this package. I've come across some difficulties when trying to start.

In short: I guess I've met a dependency issue. Could you share all the dependencies of the latest version of your infercnvpy package?

In detail: ①I created a conda environment using the following command: conda create --name infercnvpy python=3.10 ②Then I installed infercnvpy using the following command: pip install git+https://github.com/icbi-lab/infercnvpy.git@main ③I activated this conda environment on Jupyter Notebook, and tried to follow your tutorial on "https://infercnvpy.readthedocs.io/en/latest/notebooks/tutorial_3k.html"

Here is the code in the first cell: import scanpy as sc import infercnvpy as cnv import matplotlib.pyplot as plt import warnings Here is the Error: `--------------------------------------------------------------------------- ImportError Traceback (most recent call last) Cell In[4], line 1 ----> 1 import scanpy as sc 2 import infercnvpy as cnv 3 import matplotlib.pyplot as plt

File ~/.conda/envs/infercnvpy/lib/python3.10/site-packages/scanpy/init.py:45 30 set_figure_params = settings.set_figure_params 32 from anndata import ( 33 AnnData, 34 concat, (...) 42 read_umi_tools, 43 ) ---> 45 from . import datasets, experimental, external, get, logging, metrics, queries 46 from . import plotting as pl 47 from . import preprocessing as pp

File ~/.conda/envs/infercnvpy/lib/python3.10/site-packages/scanpy/experimental/init.py:3 1 from future import annotations ----> 3 from . import pp 5 all = ["pp"]

File ~/.conda/envs/infercnvpy/lib/python3.10/site-packages/scanpy/experimental/pp/init.py:3 1 from future import annotations ----> 3 from scanpy.experimental.pp._highly_variable_genes import highly_variable_genes 4 from scanpy.experimental.pp._normalization import ( 5 normalize_pearson_residuals, 6 normalize_pearson_residuals_pca, 7 ) 8 from scanpy.experimental.pp._recipes import recipe_pearson_residuals

File ~/.conda/envs/infercnvpy/lib/python3.10/site-packages/scanpy/experimental/pp/_highly_variable_genes.py:27 25 from scanpy.get import _get_obs_rep 26 from scanpy.preprocessing._distributed import materialize_as_ndarray ---> 27 from scanpy.preprocessing._utils import _get_mean_var 29 if TYPE_CHECKING: 30 from typing import Literal

File ~/.conda/envs/infercnvpy/lib/python3.10/site-packages/scanpy/preprocessing/init.py:5 3 from ..neighbors import neighbors 4 from ._combat import combat ----> 5 from ._deprecated.highly_variable_genes import filter_genes_dispersion 6 from ._highly_variable_genes import highly_variable_genes 7 from ._normalization import normalize_total

File ~/.conda/envs/infercnvpy/lib/python3.10/site-packages/scanpy/preprocessing/_deprecated/highly_variable_genes.py:13 11 from ... import logging as logg 12 from .._distributed import materialize_as_ndarray ---> 13 from .._utils import _get_mean_var 15 if TYPE_CHECKING: 16 from typing import Literal

File ~/.conda/envs/infercnvpy/lib/python3.10/site-packages/scanpy/preprocessing/_utils.py:9 7 import numpy as np 8 from scipy import sparse ----> 9 from sklearn.random_projection import sample_without_replacement 11 from .._utils import axis_sum, elem_mul 13 if TYPE_CHECKING:

File ~/.conda/envs/infercnvpy/lib/python3.10/site-packages/sklearn/init.py:85 80 from . import ( 81 check_build, # noqa: F401 82 _distributor_init, # noqa: F401 83 ) 84 from .base import clone ---> 85 from .utils._show_versions import show_versions 87 all__ = [ 88 "calibration", 89 "cluster", (...) 130 "show_versions", 131 ] 133 _BUILT_WITH_MESON = False

File ~/.conda/envs/infercnvpy/lib/python3.10/site-packages/sklearn/utils/_show_versions.py:15 12 from threadpoolctl import threadpool_info 14 from .. import version ---> 15 from ._openmp_helpers import _openmp_parallelism_enabled 18 def _get_sys_info(): 19 """System information 20 21 Returns (...) 25 26 """

ImportError: dlopen: cannot load any more object with static TLS`

I'm a grade 1 medical student and don't have much knowledge in handling this. I guess there is something wrong with package versions or something. Maybe I need to specify python version, all the dependent packages' versions and the infercnvpy package version. And it would be nice if you or anyonne could share all the requirements in creating the conda environment and installing the dependent packages that work well on your devices.

Best Regards

Version information

No response

grst commented 1 month ago

Hi @Richard-D-Watson,

the issue doesn't come directly from infercnvpy, but rather from scikit-learn.

The issue has been mentioned in other places, e.g. https://github.com/scverse/scanpy/issues/1121 https://github.com/scikit-learn/scikit-learn/issues/14485 https://github.com/pytorch/pytorch/issues/2575

From skimming through them, a very old operating system or gcc compiler could be the isssue.