aertslab / pySCENIC

pySCENIC is a lightning-fast python implementation of the SCENIC pipeline (Single-Cell rEgulatory Network Inference and Clustering) which enables biologists to infer transcription factors, gene regulatory networks and cell types from single-cell RNA-seq data.
http://scenic.aertslab.org
GNU General Public License v3.0
400 stars 176 forks source link

ImportError: cannot import name 'FeatherReader' from 'pyarrow.feather' #164

Closed aaronkwc closed 4 years ago

aaronkwc commented 4 years ago

I followed the tutorial page https://pyscenic.readthedocs.io/en/latest/tutorial.html to try to run pySCENIC, but during importing there is already an error.

import os
import glob
import pickle
import pandas as pd
import numpy as np

from dask.diagnostics import ProgressBar

from arboreto.utils import load_tf_names
from arboreto.algo import grnboost2

from pyscenic.rnkdb import FeatherRankingDatabase as RankingDatabase
from pyscenic.utils import modules_from_adjacencies, load_motifs
from pyscenic.prune import prune2df, df2regulons
from pyscenic.aucell import aucell

import seaborn as sns

DATA_FOLDER="~/tmp"
RESOURCES_FOLDER="~/resources"
DATABASE_FOLDER = "~/databases/"
SCHEDULER="123.122.8.24:8786"
DATABASES_GLOB = os.path.join(DATABASE_FOLDER, "mm9-*.mc9nr.feather")
MOTIF_ANNOTATIONS_FNAME = os.path.join(RESOURCES_FOLDER, "motifs-v9-nr.mgi-m0.001-o0.0.tbl")
MM_TFS_FNAME = os.path.join(RESOURCES_FOLDER, 'mm_tfs.txt')
SC_EXP_FNAME = os.path.join(RESOURCES_FOLDER, "GSE60361_C1-3005-Expression.txt")
REGULONS_FNAME = os.path.join(DATA_FOLDER, "regulons.p")
MOTIFS_FNAME = os.path.join(DATA_FOLDER, "motifs.csv")
ImportError                               Traceback (most recent call last)
<ipython-input-1-099430b65773> in <module>
     10 from arboreto.algo import grnboost2
     11 
---> 12 from pyscenic.rnkdb import FeatherRankingDatabase as RankingDatabase
     13 from pyscenic.utils import modules_from_adjacencies, load_motifs
     14 from pyscenic.prune import prune2df, df2regulons

~/.conda/envs/aaron/lib/python3.8/site-packages/pyscenic/rnkdb.py in <module>
     10 from .genesig import GeneSignature
     11 from cytoolz import memoize
---> 12 from pyarrow.feather import write_feather, FeatherReader
     13 from tqdm import tqdm
     14 

ImportError: cannot import name 'FeatherReader' from 'pyarrow.feather' (/home/aaronkwc/.conda/envs/aaron/lib/python3.8/site-packages/pyarrow/feather.py)

I guess the error comes from the pyarrow package? The version i used is pyarrow 0.17.0. Even pyscenic -h doesn't work, it gives the same error. I installed pyscenic on my conda environment, does this make a difference?

cflerin commented 4 years ago

Hi @aaronkwc ,

It looks like the latest release of pyarrow (0.17.0) has broken something. Can you try downgrading?

pip install pyarrow==0.16.0

This fixed the problem for me.

aaronkwc commented 4 years ago

Hi @cflerin ,

Worked like a charm! Downgrading the pyarrow to 0.16.0 and restarting jupyter notebook did the trick for me. Thanks a lot.