umap: Attribute Error
Hi there, these are my system specs: macOS Sierra 10.12.3 (16D32)
I have installed umap through pip. When I try to run it this the error message that comes up. I’m unsure what the problem is, any ideas?
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-10-68ef34dfa695> in <module>()
16 umap_mfccs = get_scaled_umap_embeddings(mfcc_features,
17 neighbours,
---> 18 distances)
19 umap_embeddings_mfccs.append(umap_mfccs)
20
<ipython-input-10-68ef34dfa695> in get_scaled_umap_embeddings(features, neighbour, distance)
1 def get_scaled_umap_embeddings(features, neighbour, distance):
2
----> 3 embedding = umap.UMAP(n_neighbors=neighbour,
4 min_dist = distance,
5 metric = 'correlation').fit_transform(features)
AttributeError: module 'umap' has no attribute 'UMAP'
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 3
- Comments: 23 (4 by maintainers)
Commits related to this issue
- add metric option precomputed (#24) — committed to LGro/umap by LGro 7 years ago
- Fix umap dependency, see https://github.com/lmcinnes/umap/issues/24 — committed to kevinrobinson/interpretability by kevinrobinson 5 years ago
I also had the same issue (
import umap; umap.UMAP
returnsAttributeError: module 'umap' has no attribute 'UMAP'
) (MacOS, High Sierra, installed via pip).As a workaround
import umap.umap_ as umap
seems to work instead ofimport umap
Hi, I can’t say for sure but potentially it may be that you actually have the wrong umap. Due to name collisions the UMAP algorithm code is under the name
umap-learn
on PyPI so if you didyou will get a different package that does not to what you want.
If that is the case then you’ll want
If that is not the problem then there is something else wrong that is going to be harder to diagnose. Either way, please let me know, and sorry about the naming confusion on pip.
I encountered this error due to having named my python-file umap.py. Felt quite silly and changed filename, which solved the problem.
Actually, I have used the following: pip uninstall umap
pip install umap-learn
Now on the notebook: import umap.umap_ as umap reducer=umap.UMAP()
It works well.
I was facing the same problem too, I’m suing windows, conda versions, and what i did is that pip uninstall umap-learn pip install umap-learn and then follow it pip install umap
it just worked !
The best I can offer is that you need to make sure that the mapping based
umap
package has been completely purged from your python install before trying to installumap-learn
. I would suggest finding the relevantsite-packages
directory and removing any and all files and directories there that start withumap
and then trying to re-installumap-learn
.I just encountered this common problem today. Working from within a Jupyter Notebook I performed:
Then
caused the common error here. I installed ‘umap-learn’ but to no avail.
I corrected the issue by uninstalling ‘umap’, then also uninstalling ‘umap-learn’, then reinstalling ‘umap-learn’ and restarting my kernel:
With this solution, I was then successful with:
Thanks for your excellent work on this package @lmcinnes . I know the problem is not related to the package itself, but just wanted to document it for tracking purposes. FYI I also ran into the same issue yesterday. I think I installed the other
umap
first then figured out thatumap-learn
was the right choice. After uninstalling the incorrectumap
I had to still do a bunch of installs and uninstalls ofumap-learn
usingconda
andpip
. Finally I made sure thatsite-packages
was clean and did a few more installs. Finally got it to work. So there was lots of frustration, but eventually got it to work.I am getting this problem too now upon my very first attempt to use UMAP. 😦 I have taken care to only install
umap-learn
and notumap
to begin with. Theimport umap.umap_ as umap
workaround fails too.Running from a Jupyter notebook with python 3.6 on an Ubuntu machine.
This seemed to get me around the original error (after also switching to installing umap-learn instead), but then my kernel died on attempting umap.UMAP().fit_transform().
(Datalab running on a Google Cloud Dataproc cluster)