question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

module 'umap' has no attribute '__version__'

See original GitHub issue

Hey!

I hope you are doing well.

I run into the error AttributeError: module ‘umap’ has no attribute ‘version’ when running this code:

import pandas as pd
#pd.set_option("display.max_columns", None)
import numpy as np
import anndata
import scanpy as sc

%store -r df

adata = anndata.AnnData(df)
sc.pp.neighbors(adata, n_neighbors=10, n_pcs=40)
sc.tl.paga(adata)
sc.pl.paga(adata, plot=False)
sc.tl.umap(adata, init_pos='paga')

I am using Python 3.8 on Jupyter Notebooks on Mac M1.

Please find below the error in a more detailed fashion:

AttributeError                            Traceback (most recent call last)
<ipython-input-7-7cfb2fb3103e> in <module>
----> 1 sc.tl.umap(adata, init_pos='paga')
      2 sc.pl.umap(adata)

~/opt/anaconda3/lib/python3.8/site-packages/scanpy/tools/_umap.py in umap(adata, min_dist, spread, n_components, maxiter, alpha, gamma, negative_sample_rate, init_pos, random_state, a, b, copy, method, neighbors_key)
    141         import umap
    142 
--> 143     if version.parse(umap.__version__) >= version.parse("0.5.0"):
    144 
    145         def simplicial_set_embedding(*args, **kwargs):

AttributeError: module 'umap' has no attribute '__version__'

Would you have any idea on how to solve this? I think it is a package dependency problem.

Thank you in advance for your help!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
hurleyLicommented, Nov 8, 2021

@hurleyLi, would you mind opening an issue over on umap that you’re unable to get a __version__ from it? It would be nice to have that fixed/ at least tracked down upstream.

Figure it out. In my case it’s because I have both umap and umap-learn installed, see here: https://github.com/theislab/scanpy/issues/2045#issuecomment-963533994

1reaction
flying-sheepcommented, Aug 13, 2021

Why are we using umap.__version__ instead of importlib.metadata.version('umap-learn')?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to resolve the error, "module umap has no attribute ...
I changed the name to umap_application.py and the problem was resolved. So, check if you named any of your files as umap. Share....
Read more >
module 'umap' has no attribute 'UMAP' · Issue #828 - GitHub
I have umap-learn installed, not umap. I have tried importing as above, no luck. Any ideas? my error is this: AttributeError: module 'umap'...
Read more >
Attributeerror module umap has no attribute umap ( Solved )
Attributeerror module umap has no attribute umap error occurs because of using incorrect module umap in the place of umap-learn before importing umap....
Read more >
RunUMAP in Seurat not working: module 'umap' has no ...
This is resolved by installing the more recent version of the code from GitHub. git clone https://github.com/lmcinnes/umap cd umap pip ...
Read more >
umap-learn - PyPI
UMAP. Uniform Manifold Approximation and Projection (UMAP) is a dimension reduction technique that can be used for visualisation similarly to t-SNE, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found