umap icon indicating copy to clipboard operation
umap copied to clipboard

Not compatible with M1 Mac with bumpy ver 1.21 ??

Open mv96 opened this issue 3 years ago • 6 comments

HI, I tried to run UMAP on M1 Mac on numpy version 1.21, however one of the dependencies (numba requires 1.20 version of numpy)

any suggestions ?


---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/var/folders/tm/9klk1nzn2lz690wvdfb85s_00000gn/T/ipykernel_31208/469094592.py in <module>
----> 1 import umap
      2 reducer = umap.UMAP(n_neighbors=20,n_components=3,verbose=True)
      3 X_transformed =reducer.fit_transform(X)
      4 X_transformed.shape

~/miniforge3/envs/tensorflow/lib/python3.9/site-packages/umap/__init__.py in <module>
      1 from warnings import warn, catch_warnings, simplefilter
----> 2 from .umap_ import UMAP
      3 
      4 try:
      5     with catch_warnings():

~/miniforge3/envs/tensorflow/lib/python3.9/site-packages/umap/umap_.py in <module>
     26 from scipy.sparse import tril as sparse_tril, triu as sparse_triu
     27 import scipy.sparse.csgraph
---> 28 import numba
     29 
     30 import umap.distances as dist

~/miniforge3/envs/tensorflow/lib/python3.9/site-packages/numba/__init__.py in <module>
    196 
    197 _ensure_llvm()
--> 198 _ensure_critical_deps()
    199 
    200 # we know llvmlite is working as the above tests passed, import it now as SVML

~/miniforge3/envs/tensorflow/lib/python3.9/site-packages/numba/__init__.py in _ensure_critical_deps()
    136         raise ImportError("Numba needs NumPy 1.17 or greater")
    137     elif numpy_version > (1, 20):
--> 138         raise ImportError("Numba needs NumPy 1.20 or less")
    139 
    140     try:

ImportError: Numba needs NumPy 1.20 or less

mv96 avatar Oct 13 '21 15:10 mv96

Numba is currently a pretty hard dependency. They do have some newer releases (and prereleases) available on their own conda channel. Perhaps working with a newer numba may help? It may be a little hard to get everything to work on the very edge though -- support for M1 is still coming for some things.

lmcinnes avatar Oct 13 '21 15:10 lmcinnes

I'm running into this on an Intel Mac as well. Same exact error:

    136         raise ImportError("Numba needs NumPy 1.17 or greater")
    137     elif numpy_version > (1, 20):
--> 138         raise ImportError("Numba needs NumPy 1.20 or less")
    139 
    140     try:

ImportError: Numba needs NumPy 1.20 or less

Running pip freeze produces:

cycler==0.10.0
gensim==4.1.2
joblib==1.1.0
kiwisolver==1.3.2
llvmlite==0.37.0
matplotlib==3.4.3
numba==0.54.1
numpy==1.20.0 <----- NOTE
pandas==1.3.4
Pillow==8.4.0
pynndescent==0.5.5
pyparsing==3.0.0
python-dateutil==2.8.2
pytz==2021.3
scikit-learn==1.0
scipy==1.7.1
seaborn==0.11.2
six==1.16.0
sklearn==0.0
smart-open==5.2.1
threadpoolctl==3.0.0
tqdm==4.62.3
umap-learn==0.5.1

Additional info: I can only get to this point if I attempt to import umap like so:

from umap.umap_ import UMAP

If I import with:

import umap
red = umap.UMAP()

I get the following error:

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

nleroy917 avatar Oct 24 '21 01:10 nleroy917

I'm really not sure to be honest. The fact that you get AttributeError: module 'umap' has no attribute 'UMAP' is odd in and of itself. Can you get away with numpy 1.19? This looks like a numba issue at heart, so hopefully a new numba release might manage to fix this in due course.

lmcinnes avatar Oct 25 '21 14:10 lmcinnes

Woke up yesterday and tried again and it worked ¯_(ツ)_/¯ . My VSCode has been acting real funky lately, so it's probably just an issue there.

Thanks for the response!

nleroy917 avatar Oct 25 '21 14:10 nleroy917

Glad it worked in the end. I wish this sort of stuff was less of a mystery to me, but at least it sometimes mysteriously works as well as mysteriously breaking.

On Mon, Oct 25, 2021 at 10:54 AM Nathan LeRoy @.***> wrote:

Woke up yesterday and tried again and it worked ¯_(ツ)_/¯ . My VSCode has been acting real funky lately, so it's probably just an issue there.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lmcinnes/umap/issues/783#issuecomment-951010475, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC3IUBJHXAFSJJ54XFI4N2DUIVVQRANCNFSM5F5NNOGA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

lmcinnes avatar Oct 25 '21 16:10 lmcinnes

I can't get it working :( When I try to install umap-learn, It will fail because NumPy 1.19.4 is not supported on Mac M1.

Any idea how can I get it installed?

yuval-illumex avatar Dec 08 '21 16:12 yuval-illumex