scrublet icon indicating copy to clipboard operation
scrublet copied to clipboard

AttributeError while loading gene list

Open ishwarvh opened this issue 3 years ago • 9 comments

Hello,

I am unable to get scrublet to load the genes.tsv file.

I see the following attribute error:

AttributeError: module 'scrublet' has no attribute 'load_genes'

I have renamed the "features.tsv" file from the CellRanger count pipeline to "genes.tsv", since that is the only file with the list of genes. Is this sufficient for scrublet?

I am using python3.5.6

Googling did not show me any relevant info on this. Hope to hear back.

Thank you, Ishwar

ishwarvh avatar Mar 23 '21 20:03 ishwarvh

FYI, this error occurs even with the example pbmc8k dataset.

I want to give scrublet a try because it is talked so highly in the scrna field.

Any help to get past this will be appreciated.

Thanks

ishwarvh avatar Mar 24 '21 02:03 ishwarvh

Hi @ishwarvh, based on the error you're getting, I'm guessing scrublet hasn't been installed correctly. Can you tell me how you set it up on your system?

swolock avatar Mar 24 '21 03:03 swolock

Hi @swolock,

Thanks for getting back so quickly. I have tried installing it using "pip" as well as installing it from source using "git clone" from your and the Klein lab git repository.

You are right about it not being installed correctly. I have tried installing it on Mac OSX 10.11 and Ubuntu 16.04 and on both system's: "which scrublet" and "whereis scrublet" does not return anything.

I have updated pip and pip3 to the latest versions, since the older versions of pip had difficulty installing the llvmlite requirements. So, that leads me to think pip is not the problem here!

One other thing. I tried installing the latest version of scrublet (v0.2.3) using

pip install scrublet==0.2.3

This returned the following message

"successfully uninstalled scrublet-0.2.1 and successfully installed scrublet-0.2.3."

However, I still can't find or import scrublet !

ishwarvh avatar Mar 24 '21 04:03 ishwarvh

In case this helps,

pip list installed: does not show scrublet to be installed

pip3 list installed: shows scrublet-0.2.3 installed.

To resolve this pip vs pip3 issue:

I removed all the previously downloaded source files, then ran:

python3 -m pip install scrublet

Since I didn't have any luck with that, I redownloaded the source files from your git repository, followed by:

python3 -m pip install -r requirements.txt
python3 -m pip install --upgrade .

This finished the installation and I have the following message:

Successfully built scrublet Installing collected packages: scrublet Successfully installed scrublet-0.2.2

The problem may be that scrublet is being installed in home/.local/python3.6/site-packages/

I am not sure if this is expected behavior or I am doing something wrong.

I also tried explicitly calling scrublet from this installed location in my python script. But that also gives me the same attribute error.

ishwarvh avatar Mar 24 '21 04:03 ishwarvh

Here is what I have learnt from this ordeal. This issue seems to be due to Python3 installing packages locally for the user.

In my case I was to find scrublet in home/.local/lib/python3.6/site-packages/ whether I installed it using PyPi or from source. However, I was unable to load scrublet despite adding the above location to $PATH.

To resolve this, I created a virtual env and installed scrublet using:

python3 -m pip venv env python3 -m pip install scrublet==0.2.3

No success with this either. I still get the same error!

ishwarvh avatar Mar 24 '21 14:03 ishwarvh

Sorry you're having so much trouble with this, but I haven't seen this problem before and do not know how to address it. I typically use miniconda to manage my python environments – maybe worth a shot?

swolock avatar Mar 30 '21 02:03 swolock

To anyone who comes across the same error, try this before anything else : 1- If you were working on a conda env, delete it, and create a new one : conda create --name myenv python=3.6 Python version is important for scrublet to run properly, 3.6 works fine (first time it did not work for me bc I was using python 3.9) 2- activate your newly created env : conda activate myenv 3- Install scrublet with this command : python3.6 -m pip install scrublet 4 - Check if installation is done : pip list installed

If you can't find scrublet, it means there are other issues. PS : In this project, I am using scrublet on R, in a conda env.

Hope this helps someone !

liliay avatar Feb 24 '22 10:02 liliay

To add to the above, in case someone is struggling to make this work, in my case, this error stemmed from me having a python script named scrublet.py in my working directory, which was loading instead of the module's functions (I could find scrublet installed in the appropriate virtual environment with the appropriate python version).

Once I renamed the script, everything worked as expected. This is because the source for scrublet is named scrublet.py as well and I created ambiguity by naming my script the same!

JimmyAusDS avatar Mar 03 '22 19:03 JimmyAusDS

Aww thanks @JimmyAusDS ! I was starting to wonder if I was going insane...

jtremblay avatar Apr 25 '23 18:04 jtremblay