zktuong / dandelion

dandelion - A single cell BCR/TCR V(D)J-seq analysis package for 10X Chromium 5' data
https://sc-dandelion.readthedocs.io/
GNU Affero General Public License v3.0
110 stars 25 forks source link

Backports error #432

Open obrien-james opened 2 months ago

obrien-james commented 2 months ago

Description of the bug

When running session_info.show() when dandelion has been imported raises an error:

Cell In[2], line 2
      1 #Output session Info
----> 2 session_info.show()

File ~/rds/hpc-work/conda_envs/new_bio/lib/python3.11/site-packages/session_info/main.py:209, in show(na, os, cpu, jupyter, dependencies, std_lib, private, write_req_file, req_file_name, html, excludes)
    207 for mod_name in clean_modules:
    208     mod_names.append(mod_name)
--> 209     mod = sys.modules[mod_name]
    210     # Since modules use different attribute names to store version info,
    211     # try the most common ones.
    212     try:

KeyError: 'backports'

Minimal reproducible example

#Standard Imports:
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib as mpl

import scanpy as sc
import dandelion as ddl
import pingouin as pg

import session_info

#Output session Info
session_info.show()

The error message produced by the code above

---------------------------------------------------------------------------
KeyError                          Traceback (most recent call last)
Cell In[2], line 2
      1 #Output session Info
----> 2 session_info.show()

File ~/rds/hpc-work/conda_envs/new_bio/lib/python3.11/site-packages/session_info/main.py:209, in show(na, os, cpu, jupyter, dependencies, std_lib, private, write_req_file, req_file_name, html, excludes)
    207 for mod_name in clean_modules:
    208     mod_names.append(mod_name)
--> 209     mod = sys.modules[mod_name]
    210     # Since modules use different attribute names to store version info,
    211     # try the most common ones.
    212     try:

KeyError: 'backports'

OS information

HPC cluster

Version information

scanpy==1.10.3 anndata==0.10.8 umap==0.5.6 numpy==2.0.2 scipy==1.14.1 pandas==2.2.3 scikit-learn==1.5.2 statsmodels==0.14.3 igraph==0.11.6 pynndescent==0.5.13

dandelion==0.3.8 pandas==2.2.3 numpy==1.26.4 matplotlib==3.9.2 networkx==3.3 scipy==1.14.1

Additional context

This is definitely caused only if importing dandelion. I have worked through each import and run session_info.show() and do not get this error until dandelion is imported.

zktuong commented 2 months ago

hi there, i'm not sure what's happening since backports is not a dependency in dandelion

zktuong commented 1 month ago

but just in case, can you report back what you see with pip show backports?

For example with anndata:

pip show anndata

Name: anndata
Version: 0.10.9
Summary: Annotated data.
Home-page: https://github.com/scverse/anndata
Author: Philipp Angerer, Alex Wolf, Isaac Virshup, Sergei Rybakov
Author-email: 
License: 
Location: /opt/homebrew/Caskroom/mambaforge/base/envs/dandelion/lib/python3.11/site-packages
Requires: array-api-compat, h5py, natsort, numpy, packaging, pandas, scipy
Required-by: anndata2ri, infercnvpy, kttools, milopy, mudata, palantir, sc-dandelion, scanpy, scFates, scirpy
obrien-james commented 1 month ago

I use conda to manage my environment (mainly). pip show backoports reports WARNING: Package(s) not found: backports

conda list backports reports:

# Name                    Version                   Build  Channel
backports                 1.0                pyhd8ed1ab_4    conda-forge
zktuong commented 1 month ago

how about conda-tree whoneeds backports https://anaconda.org/conda-forge/conda-tree

anyway, it's not an issue with dandelion:

>>> import dandelion
>>> import session_info
>>> session_info.show()
-----
dandelion           0.4.1.dev2
session_info        1.0.0
-----
Python 3.11.9 | packaged by conda-forge | (main, Apr 19 2024, 18:34:54) [Clang 16.0.6 ]
macOS-14.4-arm64-arm-64bit
-----
Session information updated at 2024-10-05 08:18