chriscainx / mnnpy

An implementation of MNN (Mutual Nearest Neighbors) correct in python.
BSD 3-Clause "New" or "Revised" License
71 stars 31 forks source link

Does not install on macOS #15

Open veghp opened 6 years ago

veghp commented 6 years ago

Tried installing this for scanpy, as recommended (pip install mnnpy), on a macOS High Sierra (v10.13.4) within a Miniconda environment, but it returns an error:

clang: error: unsupported option '-fopenmp'
  error: command 'gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for mnnpy

From what I've read online, clang on OSX is different, which may be the problem. Is there a way to install mnnpy on Mac?

aopisco commented 6 years ago

I'm having exactly the same issue

clang: error: unsupported option '-fopenmp' error: command 'gcc' failed with exit status 1 ---------------------------------------- Failed building wheel for mnnpy Running setup.py clean for mnnpy Failed to build mnnpy

cfriedline commented 6 years ago

I was able to install mnnpy with the homebrew version of gcc 8.2 on OSX 10.13.6. Just had to point to the usable gcc.

export CC=/usr/local/Cellar/gcc/8.2.0/bin/gcc-8
pip install mnnpy
bjstewart1 commented 6 years ago

I also get

clang: error: unsupported option '-fopenmp'
error: command 'gcc' failed with exit status 1
----------------------------------------
Failed building wheel for mnnpy
Running setup.py clean for mnnpy
Failed to build mnnpy

The above suggestion re: gcc doesn't work for me

aopisco commented 6 years ago

@bjstewart1 I'm using mnn through scanpy (https://scanpy.readthedocs.io/en/latest/api/scanpy.api.pp.mnn_correct.html) - have you tried that option?

bjstewart1 commented 6 years ago

@aopisco ideally i'd like to integrate with my R workflow. Scanpy is a bit fiddly in terms of working with reticulate, which is why I thought i'd try mnnpy directly.

aopisco commented 6 years ago

@bjstewart1 I see what you mean... may I ask why you don't use the R version from Marioni's lab (in library scater)?

bjstewart1 commented 6 years ago

@aopisco I've got a lot of cells! Looking for a fast implementation of mnncorrect and in R it is really very slow. Their fastMNN works fast - my experience is that whilst it works well for bringing together large clusters, it (?the denoising) seems to hinder identification of rare cell types... Anyway, I thought it would be good to experiment with this implementation of mnncorrect, if I could install it!

bjstewart1 commented 6 years ago

In fact, what is more, installation of scanpy on my mac did not include mnnpy (or mnn_correct as it is called there) presumably because it cannot be installed because of this issue:

/usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -Imnnpy -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c mnnpy/_utils.c -o build/temp.macosx-10.6-intel-3.6/mnnpy/_utils.o -O2 -ffast-math -march=native -fopenmp
  clang: error: unsupported option '-fopenmp'
  clang: error: unsupported option '-fopenmp'
  error: command '/usr/bin/clang' failed with exit status 1

  ----------------------------------------
  Failed building wheel for mnnpy
bjstewart1 commented 5 years ago

After much reinstalling, and steps I almost certainly cannot replicate, it now installs. Required installing llvm from brew and lomp from brew....

chriscainx commented 5 years ago

Glad you guys could work it out. I was actually developing from my mac but didn't encounter the issue. I may have installed all those deps without knowing...

cornhundred commented 5 years ago

I was able to install mnnpy with the homebrew version of gcc 8.2 on OSX 10.13.6. Just had to point to the usable gcc.

export CC=/usr/local/Cellar/gcc/8.2.0/bin/gcc-8
pip install mnnpy

@cfriedline that worked for me.

The following steps worked on two different macs for me 1) $ brew install gcc --without-multlib 2) $ export CC=/usr/local/Cellar/gcc/8.2.0/bin/gcc-8 3) pip install mnnpy

LiBuchauer commented 5 years ago

Another thing to try if you are struggling with this is the following slight adjustment to the above recipe

brew install gcc export CC=/usr/local/Cellar/gcc/8.3.0/bin/g++-8 pip install mnnpy

(the relevant adjustment is g++ instead of gcc, not the version number ;-) )

This worked for me in an anaconda environment on MacOS Mojave.

yzcv commented 4 years ago

Hi,

I tried the solutions you guys mentioned, but I still can not install mnnpy package. What should I do?