Giter VIP home page Giter VIP logo

Comments (23)

matiasdahl avatar matiasdahl commented on April 28, 2024 91

I also had the same issue (import umap; umap.UMAP returns AttributeError: module 'umap' has no attribute 'UMAP') (MacOS, High Sierra, installed via pip).

As a workaround import umap.umap_ as umap seems to work instead of import umap

from umap.

lmcinnes avatar lmcinnes commented on April 28, 2024 53

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 did

pip install umap

you will get a different package that does not to what you want.

If that is the case then you'll want

pip uninstall umap
pip install umap-learn

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.

from umap.

vedal avatar vedal commented on April 28, 2024 26

I encountered this error due to having named my python-file umap.py. Felt quite silly and changed filename, which solved the problem.

from umap.

bashhwu avatar bashhwu commented on April 28, 2024 9

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.

from umap.

muj1og avatar muj1og commented on April 28, 2024 5

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 !

from umap.

lmcinnes avatar lmcinnes commented on April 28, 2024 4

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 install umap-learn. I would suggest finding the relevant site-packages directory and removing any and all files and directories there that start with umap and then trying to re-install umap-learn.

from umap.

benrhodeland avatar benrhodeland commented on April 28, 2024 3

I just encountered this common problem today. Working from within a Jupyter Notebook I performed:

!pip install umap

Then

import umap
reducer = umap.UMAP()

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:

!pip uninstall umap
!pip uninstall umap-learn
!pip install umap-learn

With this solution, I was then successful with:

import umap
reducer = umap.UMAP()

from umap.

tanghoiy avatar tanghoiy commented on April 28, 2024 1

I also had the same issue (import umap; umap.UMAP returns AttributeError: module 'umap' has no attribute 'UMAP') (MacOS, High Sierra, installed via pip).

As a workaround import umap.umap_ as umap seems to work instead of import umap

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)

from umap.

Benz-Tracxpoint avatar Benz-Tracxpoint commented on April 28, 2024 1

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 not umap to begin with. The import umap.umap_ as umap workaround fails too.

Running from a Jupyter notebook with python 3.6 on an Ubuntu machine.

from umap.

00krishna avatar 00krishna commented on April 28, 2024 1

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 that umap-learn was the right choice. After uninstalling the incorrect umap I had to still do a bunch of installs and uninstalls of umap-learn using conda and pip. Finally I made sure that site-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.

from umap.

Jhard01 avatar Jhard01 commented on April 28, 2024

I have tried this, unfortunately, had no luck regarding the name confusion on pip. I am going to look at this again, I will let you know if there is any progress.

from umap.

lmcinnes avatar lmcinnes commented on April 28, 2024

Thanks. I'm sorry I can't be more help but I currently can't reproduce the problem (or even have any idea what might be causing it). Please keep me updated. I'm sure it is frustrating and I appreciate your patience and willingness to try and work through it.

from umap.

sabyadg avatar sabyadg commented on April 28, 2024

I still get this error and have tried the umap-learn trick using conda install :( I am using Mac OS X (Sierra)

from umap.

sabyadg avatar sabyadg commented on April 28, 2024

from umap.

SaKOLOURI avatar SaKOLOURI commented on April 28, 2024

I have the same problem , but at first my code worked without any problem but after some pip install of different library files it happens ,
umapdim=umap.UMAP(n_neighbors=20)
x_train_umap=umapdim.fit_transform(x_train,y=y_train)
x_test_umap=umapdim.transform(x_test)
fig,[ax1,ax2]=plt.subplots(1,2,figsize=(10,5))
ax1.scatter(x_train_umap[:,0],x_train_umap[:,1],c=y_train)
ax2.scatter(x_test_umap[:,0],x_test_umap[:,1],c=y_test)
plt.show()
svm.fit(x_train_umap,y_train)
y_test_predict=svm.predict(x_test_umap)
print((1.*(y_test_predict==y_test)).sum()/y_test.shape[0])
I had tried the above solution but they're not worked on my issue ., I have umap-learn and umap is not installed on my system .
is there any way to see witch library cause this conflict ?

from umap.

lmcinnes avatar lmcinnes commented on April 28, 2024

from umap.

SaKOLOURI avatar SaKOLOURI commented on April 28, 2024

from umap.

sabyadg avatar sabyadg commented on April 28, 2024

from umap.

SaKOLOURI avatar SaKOLOURI commented on April 28, 2024

Yes sir ,I agree with you in this case , I'm a newcomer on python , but from my former experiences on other programming software (specially on Siemens software's ) it's some times the only way.

from umap.

tjrileywisc avatar tjrileywisc commented on April 28, 2024

Not sure if this situation helps anyone (or is expected), but I ran into this situation when I tried to run transform() on new data, from a joblib pickle of a previous umap run, where that pickle was created from a previous release of umap.

I'm able to run transform() again after recreating the joblib pickle with the new version.

from umap.

yinleon avatar yinleon commented on April 28, 2024

Maybe we can look into by the joblib pickle works with scikit-learn models, but fails here...

from umap.

abhinabasaha avatar abhinabasaha commented on April 28, 2024

I also had the same issue (import umap; umap.UMAP returns AttributeError: module 'umap' has no attribute 'UMAP') (MacOS, High Sierra, installed via pip).

As a workaround import umap.umap_ as umap seems to work instead of import umap

this has worked for me

from umap.

sleighsoft avatar sleighsoft commented on April 28, 2024

The proper way to install UMAP is documented in the README.md.

Many people assume the package is called umap while instead it is called umap-learn.
Thank you for clarifying @benrhodeland.

In general: Read the README.

from umap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.