Closed SteveDiamond closed 11 months ago
SCS relies on Numpy to tell it where these libraries are on your system, using
the get_info
commands:
from numpy.distutils.system_info import get_info
print(get_info("blas_opt")) # best blas install
print(get_info("lapack_opt")) # best lapack install
print(get_info("blas")) # fall back blas install
print(get_info("lapack")) # fall back lapack install
What do the outputs of running those commands yield?
After that: Does libmkl_rt
exist on the machine?
If not the user needs to install a blas / lapack lib and reinstall SCS.
If it does exist, then it sounds like something is wrong with the DYLD_LIBRARY_PATH
environment variable (try also LD_RUNPATH_SEARCH_PATH
, LD_LIBRARY_PATH
etc., I'm not exactly sure which one is best). If you append the location of the mkl library to the env variable it should pick it up.
I had a similar problem with scs>=3.0.0, Mac OS X 10.14.6 and python 3.7.7.
The error message I receive is the following
In [2]: import scs
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-97fdeadba5ba> in <module>
----> 1 import scs
~/virtualenvs/dev/lib/python3.7/site-packages/scs/__init__.py in <module>
2 from warnings import warn
3 from scipy import sparse
----> 4 import _scs_direct
5
6 __version__ = _scs_direct.version()
ImportError: dlopen(/Users/enrico/virtualenvs/dev/lib/python3.7/site-packages/_scs_direct.cpython-37m-darwin.so, 2): Symbol not found: _aligned_alloc
Referenced from: /Users/enrico/virtualenvs/dev/lib/python3.7/site-packages/scs/.dylibs/libgomp.1.dylib (which was built for Mac OS X 10.15)
Expected in: /usr/lib/libSystem.B.dylib
in /Users/enrico/virtualenvs/dev/lib/python3.7/site-packages/scs/.dylibs/libgomp.1.dylib
Running the commands suggested by @bodono produces
Python 3.7.7 (v3.7.7:d7c567b08f, Mar 10 2020, 02:56:16)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.31.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from numpy.distutils.system_info import get_info
...: print(get_info("blas_opt")) # best blas install
...: print(get_info("lapack_opt")) # best lapack install
...: print(get_info("blas")) # fall back blas install
...: print(get_info("lapack")) # fall back lapack install
{'extra_compile_args': ['-msse3', '-I/System/Library/Frameworks/vecLib.framework/Headers'], 'extra_link_args': ['-Wl,-framework', '-Wl,Accelerate'], 'define_macros': [('NO_ATLAS_INFO', 3), ('HAVE_CBLAS', None)]}
{'extra_compile_args': ['-msse3', '-I/System/Library/Frameworks/vecLib.framework/Headers'], 'extra_link_args': ['-Wl,-framework', '-Wl,Accelerate'], 'define_macros': [('NO_ATLAS_INFO', 3), ('HAVE_CBLAS', None)]}
/var/folders/9r/gd86060902l6q82mdjnv8sgr0000gn/T/tmp4h4phrhy/source.c:1:10: fatal error: 'cblas.h' file not found
#include <cblas.h>
^~~~~~~~~
1 error generated.
{'libraries': ['blas', 'blas'], 'library_dirs': ['/usr/lib'], 'include_dirs': ['/usr/local/include']}
{'libraries': ['lapack', 'lapack'], 'library_dirs': ['/usr/lib'], 'language': 'f77'}
If I downgrade to version 2.1.4 I do not have problems.
Thanks.
This should be fixed now, the whole packaging code has been rewritten and it has smarter ways to detect blas
on your system.
Please read this first
If you are have a problem that SCS struggles with you can pass a string to the
write_data_filename
argument and SCS will dump a file containing the problem to disk. Zip the file and send it to us or attach it to this bug report for easy reproduction of the issue.A common cause of issues is not linking BLAS/LAPACK libraries correctly. If you are having this issue please search for resources on installing and linking these libraries first. You can try openblas if you need a BLAS library.
Specifications
Description
Someone with a vanilla Python 3 setup tried to install SCS and got an import error.
How to reproduce
The problem occurred on two different machines with vanilla (no conda or venv) Python 3 setups.
Additional information
Output