This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to fix ModuleNotFoundError: No module named 'skmisc'?

Hi all,

After running as instruction message I still got error:

    pip install --user scikit-misc

    sc.pp.highly_variable_genes(adata, n_top_genes = 2000, subset = True, flavor = 'seurat_v3')

ModuleNotFoundError                       Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/scanpy/preprocessing/_highly_variable_genes.py in _highly_variable_genes_seurat_v3(adata, layer, n_top_genes, batch_key, check_values, span, subset, inplace)
     52     try:
---> 53         from skmisc.loess import loess
     54     except ImportError:

ModuleNotFoundError: No module named 'skmisc'

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
2 frames
/usr/local/lib/python3.7/dist-packages/scanpy/preprocessing/_highly_variable_genes.py in _highly_variable_genes_seurat_v3(adata, layer, n_top_genes, batch_key, check_values, span, subset, inplace)
     54     except ImportError:
     55         raise ImportError(
---> 56             'Please install skmisc package via `pip install --user scikit-misc'
     57         )
     58     df = pd.DataFrame(index=adata.var_names)

ImportError: Please install skmisc package via `pip install --user scikit-misc

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------

The code is from: https://github.com/mousepixels/sanbomics_scripts/blob/main/single_cell_analysis_complete_class.ipynb

Thank you so much!

skmisc

2 answers

Depending on how your system is set up, this command pip install --user scikit-misc could be installing the package for Python v2, while your program needs Python v3. I suggest you try the same command but type pip3 instead.

Thanks Mensur! It still gives me the same error message. I run on Google colab.

I ran into this error as well and solved it by restarting the kernel.

After restart the kernel, you need to type in the command all over again (except installing the packages you had already installed)

Hope this helps.

Kehan

It was 8 months ago so I don't remember if I resolve the error but thank you!

This worked for me. After "pip install --user scikit-misc", I restarted the kernel and it worked

Log in to answer this question.