pavlin-policar / openTSNE

Extensible, parallel implementations of t-SNE
https://opentsne.rtfd.io
BSD 3-Clause "New" or "Revised" License
1.42k stars 157 forks source link

Failed to install from source #230

Closed Yangxiaojun1230 closed 1 year ago

Yangxiaojun1230 commented 1 year ago
Expected behaviour

I want to install from source in a conda env . But failed in building matrix_mul extension. pyhon version: python3.8 gcc version: 9.3.1 20200408 (Red Hat 9.3.1-2) (GCC) cython version: 0.29.33 setuptools version: 65.5.0 distutils version : 3.8.13

Actual behaviour

Found openmp. Compiling with openmp flags... building 'openTSNE._matrix_mul.matrix_mul' extension gcc -pthread -B /opt/anaconda1anaconda2anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/oshome/jyang/anaconda3/envs/GraphEmb/include -I/oshome/jyang/anaconda3/envs/GraphEmb/Library/include -I/oshome/jyang/anaconda3/envs/GraphEmb/lib/python3.8/site-packages/numpy/core/include -I/opt/anaconda1anaconda2anaconda3/include/python3.8 -c openTSNE/_matrix_mul/matrix_mul_fftw3.cpp -o build/temp.linux-x86_64-cpython-38/openTSNE/_matrix_mul/matrix_mul_fftw3.o -O3 -ffast-math -fno-finite-math-only -fno-associative-math -march=native -fopenmp cc1plus: warning: command line option \u2018-Wstrict-prototypes\u2019 is valid for C/ObjC but not for C++ In file included from /oshome/jyang/anaconda3/envs/GraphEmb/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h:1960, from /oshome/jyang/anaconda3/envs/GraphEmb/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h:12, from /oshome/jyang/anaconda3/envs/GraphEmb/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h:5, from openTSNE/_matrix_mul/matrix_mul_fftw3.cpp:777: /oshome/jyang/anaconda3/envs/GraphEmb/lib/python3.8/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:16:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp] 16 | #warning "Using deprecated NumPy API, disable it with " \ | ^~~ g++ -pthread -B /opt/anaconda1anaconda2anaconda3/compiler_compat -Wl,--sysroot=/ -pthread -shared -B /opt/anaconda1anaconda2anaconda3/compiler_compat -L/opt/anaconda1anaconda2anaconda3/lib -Wl,-rpath=/opt/anaconda1anaconda2anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-cpython-38/openTSNE/_matrix_mul/matrix_mul_fftw3.o -L/oshome/jyang/anaconda3/envs/GraphEmb/lib -L/oshome/jyang/anaconda3/envs/GraphEmb/Library/lib -lfftw3 -o build/lib.linux-x86_64-cpython-38/openTSNE/_matrix_mul/matrix_mul.cpython-38-x86_64-linux-gnu.so -fopenmp /opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: /usr/local/lib/libfftw3.a(apiplan.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC

Steps to reproduce the behavior

python setup.py build

Could any one give some advice?

pavlin-policar commented 1 year ago

I'm not sure, I've never seen an error like this before. Maybe you can manually go into setup.py and disable FFTW3, and see if that fixes the issue? Or maybe try adding the -fPIC flag to the compiler, again in setup.py, as it's suggesting.

It seems like you've got a system-wide installation of FFTW3, so it's trying to link against that. Maybe installing FFTW3 from conda-forge might fix the problem?

Are you running this on an OSX system, or a linux distribution? On OSX, sometimes the openMP library can be a bit finicky.

That's pretty much all the ideas I can think of that might be the issue. Please let me know if you manage to fix this.

Yangxiaojun1230 commented 1 year ago

I'm not sure, I've never seen an error like this before. Maybe you can manually go into setup.py and disable FFTW3, and see if that fixes the issue? Or maybe try adding the -fPIC flag to the compiler, again in setup.py, as it's suggesting.

It seems like you've got a system-wide installation of FFTW3, so it's trying to link against that. Maybe installing FFTW3 from conda-forge might fix the problem?

Are you running this on an OSX system, or a linux distribution? On OSX, sometimes the openMP library can be a bit finicky.

That's pretty much all the ideas I can think of that might be the issue. Please let me know if you manage to fix this.

Appreciate your reply , I fixed it by disable FFTW3. BTW, I am trying to fix some parts of embedding points , and then obtain other point coordinates from these points. What do you think of this?

pavlin-policar commented 1 year ago

I'm glad you've fixed it! I'll go ahead and close this issue for the time being then.

Do you mean you want to create an embedding on part of the points first, then add the other points into the embedding? If so, you can do that using the .transform functionality. But if you do go this route, the new points you put in with the .transform won't consider interactions between themselves, and that often isn't what you'd want.

Or do you mean you want to fix the final position of only some of the points and have all the other points be optimized w.r.t. that? That is an interesting use case, and I've often thought about implementing that, but this isn't possible in the current version of openTSNE.