getspams / spams-python

Python interface for SPAMS (SPArse Modeling Software)
https://thoth.inrialpes.fr/people/mairal/spams/
GNU General Public License v3.0
15 stars 5 forks source link

Failure to install spams from PyPI: /home/mathurin/anaconda3/envs/tmp3/compiler_compat/ld: cannot find -lblas #17

Open mathurinm opened 2 years ago

mathurinm commented 2 years ago

@gdurif In a fresh env, even after conda installing mkl:

pip install spams
Collecting spams
  Downloading spams-2.6.5.3.tar.gz (2.0 MB)
     |████████████████████████████████| 2.0 MB 2.5 MB/s 
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting Pillow>=6.0
  Using cached Pillow-9.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.3 MB)
Collecting six>=1.12
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting Cython>=0.29
  Using cached Cython-0.29.28-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (1.9 MB)
Collecting numpy>=1.12
  Using cached numpy-1.22.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.8 MB)
Collecting scipy>=1.0
  Using cached scipy-1.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (42.1 MB)
Building wheels for collected packages: spams
  Building wheel for spams (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/mathurin/anaconda3/envs/tmp3/bin/python /home/mathurin/anaconda3/envs/tmp3/lib/python3.9/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmp9eukjn7k
       cwd: /tmp/pip-install-2nppa315/spams_1fee5df198a74721ad97f5f2c91d22df
  Complete output (223 lines):
  /tmp/pip-build-env-eoydywvg/overlay/lib/python3.9/site-packages/setuptools/dist.py:738: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
    warnings.warn(
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.9
  creating build/lib.linux-x86_64-3.9/myscipy_rand
  copying myscipy_rand/myscipy_rand.py -> build/lib.linux-x86_64-3.9/myscipy_rand
  copying myscipy_rand/__init__.py -> build/lib.linux-x86_64-3.9/myscipy_rand
  creating build/lib.linux-x86_64-3.9/spams_wrap
  copying spams_wrap/__init__.py -> build/lib.linux-x86_64-3.9/spams_wrap
  copying spams_wrap/spams_wrap.py -> build/lib.linux-x86_64-3.9/spams_wrap
  creating build/lib.linux-x86_64-3.9/spams
  copying spams/spams.py -> build/lib.linux-x86_64-3.9/spams
  copying spams/__init__.py -> build/lib.linux-x86_64-3.9/spams
  creating build/lib.linux-x86_64-3.9/spams/tests
  copying spams/tests/test_linalg.py -> build/lib.linux-x86_64-3.9/spams/tests
  copying spams/tests/run.py -> build/lib.linux-x86_64-3.9/spams/tests
  copying spams/tests/test_utils.py -> build/lib.linux-x86_64-3.9/spams/tests
  copying spams/tests/test_spams.py -> build/lib.linux-x86_64-3.9/spams/tests
  copying spams/tests/__init__.py -> build/lib.linux-x86_64-3.9/spams/tests
  copying spams/tests/test_dictLearn.py -> build/lib.linux-x86_64-3.9/spams/tests
  copying spams/tests/test_decomp.py -> build/lib.linux-x86_64-3.9/spams/tests
  copying spams/tests/test_prox.py -> build/lib.linux-x86_64-3.9/spams/tests
  creating build/lib.linux-x86_64-3.9/spams/data
  copying spams/data/lena.png -> build/lib.linux-x86_64-3.9/spams/data
  copying spams/data/boat.png -> build/lib.linux-x86_64-3.9/spams/data
  copying spams/version -> build/lib.linux-x86_64-3.9/spams
  running build_ext
  In file included from /tmp/pip-build-env-eoydywvg/overlay/lib/python3.9/site-packages/numpy/core/include/numpy/ndarraytypes.h:1822,
                   from /tmp/pip-build-env-eoydywvg/overlay/lib/python3.9/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
                   from /tmp/pip-build-env-eoydywvg/overlay/lib/python3.9/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                   from spams_wrap/spams.h:458,
                   from spams_wrap/spams_wrap.cpp:3130:
  /tmp/pip-build-env-eoydywvg/overlay/lib/python3.9/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
     17 | #warning "Using deprecated NumPy API, disable it with " \
        |  ^~~~~~~
  In file included from spams_wrap/spams_wrap.cpp:3130:
  spams_wrap/spams.h:35:57: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
     35 | template<typename T> void _sort(Vector<T> *v,bool mode) throw(const char *){
        |                                                         ^~~~~
  spams_wrap/spams.h:40:61: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
     40 | template<typename T> void _AAt(SpMatrix<T> *A,Matrix<T> *B) throw(const char *) {
        |                                                             ^~~~~
  spams_wrap/spams.h:47:76: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
     47 | template<typename T> void _XAt(SpMatrix<T> *A,Matrix<T> *X,Matrix<T> *XAt) throw(const char *) {
        |                                                                            ^~~~~
  spams_wrap/spams.h:54:29: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
     54 |       const T a, const T b) throw(const char *) {
        |                             ^~~~~
  spams_wrap/spams.h:76:71: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
     76 | template<typename T> void _applyBayerPattern(Vector<T> *v,int offset) throw(const char *){
        |                                                                       ^~~~~
  spams_wrap/spams.h:80:116: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
     80 | template<typename T> void _conjugateGradient(Matrix<T> *A,Vector<T> *b,Vector<T> *x,const T tol,const int itermax) throw(const char *){
        |                                                                                                                    ^~~~~
  In file included from spams_wrap/spams_wrap.cpp:3130:
  spams_wrap/spams.h:101:29: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    101 |       const int numThreads) throw(const char *) {
        |                             ^~~~~
  spams_wrap/spams.h:112:1: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    112 | throw(const char *)
        | ^~~~~
  spams_wrap/spams.h:150:1: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    150 | throw(const char *)
        | ^~~~~
  spams_wrap/spams.h:194:1: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    194 | throw(const char *)
        | ^~~~~
  spams_wrap/spams.h:221:1: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    221 | throw(const char *)
        | ^~~~~
  spams_wrap/spams.h:251:196: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    251 | SpMatrix<T> *_omp(Matrix<T> *X,Matrix<T> *D,Matrix<T> **path,bool return_reg_path,bool given_L,Vector<int>*L,bool given_eps,Vector<T>*eps,bool given_Lambda,Vector<T>*Lambda,const int numThreads) throw(const char *){
        |                                                                                                                                                                                                    ^~~~~
  spams_wrap/spams.h:296:216: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    296 | SpMatrix<T> *_ompMask(Matrix<T> *X,Matrix<T> *D,Matrix<bool> *B,Matrix<T> **path,bool return_reg_path,bool given_L,Vector<int>*L,bool given_eps,Vector<T>*eps,bool given_Lambda,Vector<T>*Lambda,const int numThreads) throw(const char *){
        |                                                                                                                                                                                                                        ^~~~~
  spams_wrap/spams.h:345:130: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    345 | SpMatrix<T> *_cd(Matrix<T> *X,Matrix<T> *D,SpMatrix<T>*alpha,T lambda1, constraint_type mode, int itermax, T tol,int numThreads) throw(const char *){
        |                                                                                                                                  ^~~~~
  spams_wrap/spams.h:363:97: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    363 | SpMatrix<T> *_somp(Matrix<T> *X,Matrix<T> *D,Vector<int> *groups,int LL, T eps, int numThreads) throw(const char *){
        |                                                                                                 ^~~~~
  spams_wrap/spams.h:419:144: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    419 | void _l1L2BCD(Matrix<T> *X,Matrix<T> *D,Matrix<T>*alpha0,Vector<int> *groups,T lambda1, constraint_type mode,int itermax,T tol,int numThreads) throw(const char *){
        |                                                                                                                                                ^~~~~
  In file included from spams_wrap/spams_wrap.cpp:3130:
  spams_wrap/spams.h:500:1: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    500 | throw(const char *)
        | ^~~~~
  In file included from spams_wrap/spams_wrap.cpp:3130:
  spams_wrap/spams.h:652:1: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    652 | throw(const char *)
        | ^~~~~
  spams_wrap/spams.h:820:1: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    820 | throw(const char *)
        | ^~~~~
  spams_wrap/spams.h:958:1: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    958 | throw(const char *)
        | ^~~~~
  spams_wrap/spams.h:1018:1: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
   1018 | throw(const char *)
        | ^~~~~
  spams_wrap/spams.h:1097:1: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
   1097 | throw(const char *)
        | ^~~~~
  spams_wrap/spams.h:1187:10: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
   1187 |       )  throw(const char *){
        |          ^~~~~
  spams_wrap/spams.h:1342:189: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
   1342 | Matrix<T> *_archetypalAnalysisInit(Matrix<T>* X, Matrix<T>* Z0, SpMatrix<T>** spA, SpMatrix<T>** spB, bool robust, T epsilon, bool computeXtX, int stepsFISTA, int stepsAS, int numThreads) throw(const char *)  {
        |                                                                                                                                                                                             ^~~~~
  spams_wrap/spams.h:1351:194: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
   1351 | Matrix<T> *_archetypalAnalysis(Matrix<T>* X, int p, SpMatrix<T>** spA, SpMatrix<T>** spB, bool robust, T epsilon, bool computeXtX, int stepsFISTA, int stepsAS, bool randominit, int numThreads) throw(const char *) {
        |                                                                                                                                                                                                  ^~~~~
  spams_wrap/spams.h:1360:92: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
   1360 |   SpMatrix<T> *_decompSimplex(Matrix<T>* X, Matrix<T>* Z, bool computeXtX, int numThreads) throw(const char*){
        |                                                                                            ^~~~~
  spams_wrap/spams.h:1380:74: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
   1380 | void _im2col_sliding(Matrix<T>  *A,Matrix<T>  *B,int m, int n,bool RGB)  throw(const char *){
        |                                                                          ^~~~~
  In file included from spams_wrap/spams_wrap.cpp:3131:
  spams_wrap/prox/groups-graph.h:202:74: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    202 | std::vector<StructNodeElem<T> *> *_groupStructOfString(const char *data) throw(const char *){
        |                                                                          ^~~~~
  spams_wrap/prox/groups-graph.h:227:70: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    227 | std::vector<StructNodeElem<T> *> *_readGroupStruct(const char *file) throw(const char *){
        |                                                                      ^~~~~
  spams_wrap/prox/groups-graph.h:253:70: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    253 | std::vector<StructNodeElem<T> *> *_simpleGroupTree(int *degr, int n) throw(const char *){
        |                                                                      ^~~~~
  In file included from spams_wrap/spams_wrap.cpp:3131:
  spams_wrap/prox/groups-graph.h:483:129: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    483 | Vector<T> *_graphOfGroupStruct(std::vector<StructNodeElem<T> *> *gstruct,SpMatrix<bool> **pgroups,SpMatrix<bool> **pgroups_var) throw(const char *) {
        |                                                                                                                                 ^~~~~
  spams_wrap/prox/groups-graph.h:568:197: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
    568 | int _treeOfGroupStruct(std::vector<StructNodeElem<T> *> *gstruct,int **pperm,int *pnb_vars,Vector<T> **peta_g,SpMatrix<bool> **pgroups,Vector<int> **pown_variables,Vector<int> **pN_own_variables) throw(const char *){
        |                                                                                                                                                                                                     ^~~~~
  In file included from spams_wrap/linalg/utils.h:126,
                   from spams_wrap/decomp/decomp.h:33,
                   from spams_wrap/dictLearn/dicts.h:35,
                   from spams_wrap/spams.h:25,
                   from spams_wrap/spams_wrap.cpp:3130:
  spams_wrap/linalg/linalg.h: In instantiation of ‘void SpMatrix<T>::mult(const SpVector<T>&, Vector<T>&, T, T) const [with T = bool]’:
  spams_wrap/linalg/linalg.h:4359:13:   required from here
  spams_wrap/linalg/linalg.h:4370:21: warning: ‘*’ in boolean context, suggest ‘&&’ instead [-Wint-in-bool-context]
   4370 |       T val = alpha * x.v(i);
        |               ~~~~~~^~~~~~~~
  spams_wrap/linalg/linalg.h: In instantiation of ‘void SpMatrix<T>::mult(const Vector<T>&, Vector<T>&, T, T) const [with T = bool]’:
  spams_wrap/linalg/linalg.h:4339:13:   required from here
  spams_wrap/linalg/linalg.h:4349:18: warning: ‘*’ in boolean context, suggest ‘&&’ instead [-Wint-in-bool-context]
   4349 |       T sca=alpha* prX[i];
        |             ~~~~~^~~~~~
  spams_wrap/linalg/linalg.h: In instantiation of ‘void Matrix<T>::mult(const SpVector<T>&, Vector<T>&, T, T) const [with T = bool]’:
  spams_wrap/linalg/linalg.h:1799:35:   required from here
  spams_wrap/linalg/linalg.h:1812:28: warning: ‘*’ in boolean context, suggest ‘&&’ instead [-Wint-in-bool-context]
   1812 |          cblas_axpy<T>(_m,a*x._v[i],_X+x._r[i]*_m,1,b._X,1);
        |                           ~^~~~~~
  spams_wrap/linalg/linalg.h: In instantiation of ‘void Matrix<T>::multTrans(const SpVector<T>&, Vector<T>&, T, T) const [with T = bool]’:
  spams_wrap/linalg/linalg.h:4408:24:   required from ‘void SpMatrix<T>::mult(const Matrix<T>&, Matrix<T>&, bool, bool, T, T) const [with T = bool]’
  spams_wrap/linalg/linalg.h:4379:13:   required from here
  spams_wrap/linalg/linalg.h:1766:25: warning: ‘*’ in boolean context, suggest ‘&&’ instead [-Wint-in-bool-context]
   1766 |          b._X[i] = alpha*col.dot(x);
        |                    ~~~~~^~~~~~~~~~~
  spams_wrap/linalg/linalg.h: In instantiation of ‘void Matrix<T>::rank1Update(const Vector<T>&, const SpVector<T>&, T) [with T = bool]’:
  spams_wrap/linalg/linalg.h:1902:26:   required from ‘void Matrix<T>::mult(const SpMatrix<T>&, Matrix<T>&, bool, bool, T, T) const [with T = bool]’
  spams_wrap/linalg/linalg.h:1856:13:   required from here
  spams_wrap/linalg/linalg.h:2464:23: warning: ‘*’ in boolean context, suggest ‘&&’ instead [-Wint-in-bool-context]
   2464 |       Xi.add(vec1,v[i]*alpha);
        |                   ~~~~^~~~~~
  In file included from /usr/include/string.h:495,
                   from /home/mathurin/anaconda3/envs/tmp3/include/python3.9/Python.h:30,
                   from spams_wrap/spams_wrap.cpp:171:
  In function ‘char* strncpy(char*, const char*, size_t)’,
      inlined from ‘void regul_error(char*, int, const char*)’ at spams_wrap/dictLearn/dicts.h:78:12:
  /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:34: warning: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
    106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
        |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  In file included from spams_wrap/spams.h:25,
                   from spams_wrap/spams_wrap.cpp:3130:
  spams_wrap/dictLearn/dicts.h: In function ‘void regul_error(char*, int, const char*)’:
  spams_wrap/dictLearn/dicts.h:67:18: note: length computed here
     67 |   int n1 = strlen(message);
        |            ~~~~~~^~~~~~~~~
  In file included from /usr/include/string.h:495,
                   from /home/mathurin/anaconda3/envs/tmp3/include/python3.9/Python.h:30,
                   from spams_wrap/spams_wrap.cpp:171:
  In function ‘char* strncpy(char*, const char*, size_t)’,
      inlined from ‘void regul_error(char*, int, const char*)’ at spams_wrap/dictLearn/dicts.h:81:14:
  /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:34: warning: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
    106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
        |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  In file included from spams_wrap/spams.h:25,
                   from spams_wrap/spams_wrap.cpp:3130:
  spams_wrap/dictLearn/dicts.h: In function ‘void regul_error(char*, int, const char*)’:
  spams_wrap/dictLearn/dicts.h:80:21: note: length computed here
     80 |       int k = strlen(regul_table[i].name);
        |               ~~~~~~^~~~~~~~~~~~~~~~~~~~~
  In file included from /usr/include/string.h:495,
                   from /home/mathurin/anaconda3/envs/tmp3/include/python3.9/Python.h:30,
                   from spams_wrap/spams_wrap.cpp:171:
  In function ‘char* strncpy(char*, const char*, size_t)’,
      inlined from ‘void SWIG_Python_FixMethods(PyMethodDef*, swig_const_info*, swig_type_info**, swig_type_info**)’ at spams_wrap/spams_wrap.cpp:25671:22,
      inlined from ‘PyObject* PyInit__spams_wrap()’ at spams_wrap/spams_wrap.cpp:25771:25:
  /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:34: warning: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ output truncated before terminating nul copying 10 bytes from a string of the same length [-Wstringop-truncation]
    106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
        |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  In function ‘void* memset(void*, int, size_t)’,
      inlined from ‘void coreORMP(Vector<T>&, Vector<T>&, Vector<T>&, Matrix<T>&, Matrix<T>&, Matrix<T>&, Matrix<T>&, Vector<T>&, const AbstractMatrix<T>&, Vector<int>&, Vector<T>&, T&, const T*, const int*, const T*, T*) [with T = double]’ at spams_wrap/decomp/decomp.h:635:13:
  /usr/include/x86_64-linux-gnu/bits/string_fortified.h:71:33: warning: ‘void* __builtin_memset(void*, int, long unsigned int)’ specified bound between 18446744056529682432 and 18446744073709551608 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
     71 |   return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
        |          ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  In function ‘void* memset(void*, int, size_t)’,
      inlined from ‘void coreORMP(Vector<T>&, Vector<T>&, Vector<T>&, Matrix<T>&, Matrix<T>&, Matrix<T>&, Matrix<T>&, Vector<T>&, const AbstractMatrix<T>&, Vector<int>&, Vector<T>&, T&, const T*, const int*, const T*, T*) [with T = float]’ at spams_wrap/decomp/decomp.h:635:13:
  /usr/include/x86_64-linux-gnu/bits/string_fortified.h:71:33: warning: ‘void* __builtin_memset(void*, int, long unsigned int)’ specified bound between 18446744065119617024 and 18446744073709551612 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
     71 |   return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
        |          ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  /home/mathurin/anaconda3/envs/tmp3/compiler_compat/ld: cannot find -lblas
  /home/mathurin/anaconda3/envs/tmp3/compiler_compat/ld: cannot find -llapack
  collect2: error: ld returned 1 exit status
  error: Command "g++ -pthread -B /home/mathurin/anaconda3/envs/tmp3/compiler_compat -shared -Wl,-rpath,/home/mathurin/anaconda3/envs/tmp3/lib -Wl,-rpath-link,/home/mathurin/anaconda3/envs/tmp3/lib -L/home/mathurin/anaconda3/envs/tmp3/lib -L/home/mathurin/anaconda3/envs/tmp3/lib -Wl,-rpath,/home/mathurin/anaconda3/envs/tmp3/lib -Wl,-rpath-link,/home/mathurin/anaconda3/envs/tmp3/lib -L/home/mathurin/anaconda3/envs/tmp3/lib build/temp.linux-x86_64-3.9/spams_wrap/spams_wrap.o -L/home/mathurin/anaconda3/envs/tmp3/lib -L/usr/local/lib -L/usr/lib64 -L/usr/lib -L/usr/lib/x86_64-linux-gnu -lstdc++ -lblas -llapack -o build/lib.linux-x86_64-3.9/_spams_wrap.cpython-39-x86_64-linux-gnu.so -fopenmp" failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for spams
Failed to build spams
ERROR: Could not build wheels for spams which use PEP 517 and cannot be installed directly

seems very related tothe issue I have with celer: https://stackoverflow.com/questions/71340058/conda-does-not-look-for-libpthread-and-libpthread-nonshared-at-the-right-place-w/71414439#71414439

gdurif commented 2 years ago

Hi, thanks for the report. Sorry for the problem.

I guess it explains the test fail for https://github.com/benchopt/benchmark_lasso/pull/66

I'll look into this. I did not test with (ana)conda. Thanks for the pointer to the celer issue.

Does pip install --no-build-isolation spams works? (as adviced by Thomas in his answer)

gdurif commented 2 years ago

@samuelstjean any idea how to solve the incompatibility between pyproject.toml and conda setup? thanks

mathurinm commented 2 years ago

Yes, pip install --no-build-isolation spams works (I have to install numpy manually before).

gdurif commented 2 years ago

@mathurinm a temporary fix would be to list numpy as a requirement for the spams solver?

Is it possible to pass arguments to pip through benchOpt solver requirements?

samuelstjean commented 2 years ago

I'm wondering if the the issue is something else, I am also using conda here. Seems like the problem is that the setup.py looks for whatever numpy is linked to, here the intel mkl. Since the build isolation re-downloads everything, it will now look for whatever this new numpy is using, that is regular regular blas/lapack in another default folder, and it fails since conda has mkl instead (and your system presumably did not have those). That's also 'bad', since you'll end up with numpy linked to some libs, and spams linked to something else because of build isolation.

Might be difficult, but one way would be to look for mkl first (or other stuff) and go through a list of candidates or something rather than what numpy is linked to. I'm not sure how we want to deal with this case since it's difficult to account for everything, and using build without isolation will also lead to the same issue of different linked libs in some cases. Probably why I ended up hardcoding everything now that I think about it.

But in general, I think the problem stems from assuming that whatever numpy is linked to, we also want to use that and they even give us the path for it. I'm not sure it would work on a brand new system where the user has no blas/lapack for example, but grabbing the source with build isolation would likely fail since no headers would be present on the system (similar to here, where the conda folder is hidden in the process). In any case I do not see an easy solution that just works unfortunately, except if we end up providing premade builds for everyone since this goes away in itself in a way.

gdurif commented 2 years ago

@samuelstjean Thanks for your input.

Providing pre-built wheels would then be a solution I guess? no compilation, hence no linking...

samuelstjean commented 2 years ago

Kind of, since it would be easy for people in general to get it running. People using it on clusters or fancy stuff (like the new M1 mac, or those arm windows computers I guess) will also need to build it themselves presumably. I'm not sure how to properly do it if you want to support everything here, because computers. Even in my builds I was piggybacking on numpy paths to find the system libs I already installed, and just hardcoding the rest when it was not working for (mac?) and windows. So either we assume that people not using the future builds can figure it out or we put time to properly do it.

gdurif commented 2 years ago

Maybe a solution would be to suggest users to properly convert from PyPI to conda package with:

conda skeleton pypi my_package
conda build my_package
conda install --use-local my_package

Source