scs icon indicating copy to clipboard operation
scs copied to clipboard

Cannot install scs due to MacOS Accelerate framework

Open thomas-woodruff opened this issue 4 years ago • 3 comments

Hello there,

I'm having some trouble trying to install scs via pip. It looks like the problem may be to do with Mac OS version (Catalina 10.15.7) not playing happily with openblas. I'm trying to install scs into a virtual env using Python 3.8.2 and pip 21.0.1 .

Here's the full stack trace from pip install -U scs:

Collecting scs
  Using cached scs-2.1.2.tar.gz (3.5 MB)
    ERROR: Command errored out with exit status 1:
     command: /Users/tomwoodruff/Documents/code/footbot/venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/yk/r9_n73rs4xdg20z8twqtg_ph0000gp/T/pip-install-hb2eblci/scs_3fec55401e8d43238561b7faaae926be/setup.py'"'"'; __file__='"'"'/private/var/folders/yk/r9_n73rs4xdg20z8twqtg_ph0000gp/T/pip-install-hb2eblci/scs_3fec55401e8d43238561b7faaae926be/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/yk/r9_n73rs4xdg20z8twqtg_ph0000gp/T/pip-pip-egg-info-f9ofcc_g
         cwd: /private/var/folders/yk/r9_n73rs4xdg20z8twqtg_ph0000gp/T/pip-install-hb2eblci/scs_3fec55401e8d43238561b7faaae926be/
    Complete output (97 lines):
    Namespace(blas64=False, extraverbose=False, float32=False, gpu=False, int32=False, scs=False)
    running egg_info
    creating /private/var/folders/yk/r9_n73rs4xdg20z8twqtg_ph0000gp/T/pip-pip-egg-info-f9ofcc_g/scs.egg-info
    writing /private/var/folders/yk/r9_n73rs4xdg20z8twqtg_ph0000gp/T/pip-pip-egg-info-f9ofcc_g/scs.egg-info/PKG-INFO
    writing dependency_links to /private/var/folders/yk/r9_n73rs4xdg20z8twqtg_ph0000gp/T/pip-pip-egg-info-f9ofcc_g/scs.egg-info/dependency_links.txt
    writing requirements to /private/var/folders/yk/r9_n73rs4xdg20z8twqtg_ph0000gp/T/pip-pip-egg-info-f9ofcc_g/scs.egg-info/requires.txt
    writing top-level names to /private/var/folders/yk/r9_n73rs4xdg20z8twqtg_ph0000gp/T/pip-pip-egg-info-f9ofcc_g/scs.egg-info/top_level.txt
    writing manifest file '/private/var/folders/yk/r9_n73rs4xdg20z8twqtg_ph0000gp/T/pip-pip-egg-info-f9ofcc_g/scs.egg-info/SOURCES.txt'
    /private/var/folders/yk/r9_n73rs4xdg20z8twqtg_ph0000gp/T/pip-install-hb2eblci/scs_3fec55401e8d43238561b7faaae926be/.eggs/numpy-1.20.1-py3.8-macosx-10.14.6-x86_64.egg/numpy/distutils/system_info.py:844: UserWarning:
        Blas (http://www.netlib.org/blas/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [blas]) or by setting
        the BLAS environment variable.
      self.calc_info()
    /private/var/folders/yk/r9_n73rs4xdg20z8twqtg_ph0000gp/T/pip-install-hb2eblci/scs_3fec55401e8d43238561b7faaae926be/.eggs/numpy-1.20.1-py3.8-macosx-10.14.6-x86_64.egg/numpy/distutils/system_info.py:844: UserWarning:
        Blas (http://www.netlib.org/blas/) sources not found.
        Directories to search for the sources can be specified in the
        numpy/distutils/site.cfg file (section [blas_src]) or by setting
        the BLAS_SRC environment variable.
      self.calc_info()
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/yk/r9_n73rs4xdg20z8twqtg_ph0000gp/T/pip-install-hb2eblci/scs_3fec55401e8d43238561b7faaae926be/setup.py", line 229, in <module>
        run_install()
      File "/private/var/folders/yk/r9_n73rs4xdg20z8twqtg_ph0000gp/T/pip-install-hb2eblci/scs_3fec55401e8d43238561b7faaae926be/setup.py", line 226, in run_install
        install_scs()
      File "/private/var/folders/yk/r9_n73rs4xdg20z8twqtg_ph0000gp/T/pip-install-hb2eblci/scs_3fec55401e8d43238561b7faaae926be/setup.py", line 201, in install_scs
        setup(
      File "/Users/tomwoodruff/Documents/code/footbot/venv/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/Users/tomwoodruff/Documents/code/footbot/venv/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 299, in run
        self.find_sources()
      File "/Users/tomwoodruff/Documents/code/footbot/venv/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 306, in find_sources
        mm.run()
      File "/Users/tomwoodruff/Documents/code/footbot/venv/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 541, in run
        self.add_defaults()
      File "/Users/tomwoodruff/Documents/code/footbot/venv/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 577, in add_defaults
        sdist.add_defaults(self)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/command/sdist.py", line 228, in add_defaults
        self._add_defaults_ext()
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/command/sdist.py", line 311, in _add_defaults_ext
        build_ext = self.get_finalized_command('build_ext')
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 299, in get_finalized_command
        cmd_obj.ensure_finalized()
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 107, in ensure_finalized
        self.finalize_options()
      File "/private/var/folders/yk/r9_n73rs4xdg20z8twqtg_ph0000gp/T/pip-install-hb2eblci/scs_3fec55401e8d43238561b7faaae926be/setup.py", line 112, in finalize_options
        blas_info, lapack_info = get_infos()
      File "/private/var/folders/yk/r9_n73rs4xdg20z8twqtg_ph0000gp/T/pip-install-hb2eblci/scs_3fec55401e8d43238561b7faaae926be/setup.py", line 84, in get_infos
        blas_info = get_info('blas')
      File "/private/var/folders/yk/r9_n73rs4xdg20z8twqtg_ph0000gp/T/pip-install-hb2eblci/scs_3fec55401e8d43238561b7faaae926be/.eggs/numpy-1.20.1-py3.8-macosx-10.14.6-x86_64.egg/numpy/distutils/system_info.py", line 584, in get_info
        return cl().get_info(notfound_action)
      File "/private/var/folders/yk/r9_n73rs4xdg20z8twqtg_ph0000gp/T/pip-install-hb2eblci/scs_3fec55401e8d43238561b7faaae926be/.eggs/numpy-1.20.1-py3.8-macosx-10.14.6-x86_64.egg/numpy/distutils/system_info.py", line 844, in get_info
        self.calc_info()
      File "/private/var/folders/yk/r9_n73rs4xdg20z8twqtg_ph0000gp/T/pip-install-hb2eblci/scs_3fec55401e8d43238561b7faaae926be/.eggs/numpy-1.20.1-py3.8-macosx-10.14.6-x86_64.egg/numpy/distutils/system_info.py", line 2040, in calc_info
        info = self.check_libs(lib_dirs, blas_libs, [])
      File "/private/var/folders/yk/r9_n73rs4xdg20z8twqtg_ph0000gp/T/pip-install-hb2eblci/scs_3fec55401e8d43238561b7faaae926be/.eggs/numpy-1.20.1-py3.8-macosx-10.14.6-x86_64.egg/numpy/distutils/system_info.py", line 986, in check_libs
        info = self._check_libs(lib_dirs, libs, opt_libs, [ext])
      File "/private/var/folders/yk/r9_n73rs4xdg20z8twqtg_ph0000gp/T/pip-install-hb2eblci/scs_3fec55401e8d43238561b7faaae926be/.eggs/numpy-1.20.1-py3.8-macosx-10.14.6-x86_64.egg/numpy/distutils/system_info.py", line 1057, in _check_libs
        found_dirs, found_libs = self._find_libs(lib_dirs, libs, exts)
      File "/private/var/folders/yk/r9_n73rs4xdg20z8twqtg_ph0000gp/T/pip-install-hb2eblci/scs_3fec55401e8d43238561b7faaae926be/.eggs/numpy-1.20.1-py3.8-macosx-10.14.6-x86_64.egg/numpy/distutils/system_info.py", line 1041, in _find_libs
        found_lib = self._find_lib(lib_dir, lib, exts)
      File "/private/var/folders/yk/r9_n73rs4xdg20z8twqtg_ph0000gp/T/pip-install-hb2eblci/scs_3fec55401e8d43238561b7faaae926be/.eggs/numpy-1.20.1-py3.8-macosx-10.14.6-x86_64.egg/numpy/distutils/system_info.py", line 1022, in _find_lib
        raise RuntimeError(_accel_msg.format(filename=p[0]))
    RuntimeError: Found /usr/lib/libblas.dylib, but that file is a symbolic link to the MacOS Accelerate framework, which is not supported by NumPy. You must configure the build to use a different optimized library, or disable the use of optimized BLAS and LAPACK by setting the environment variables NPY_BLAS_ORDER="" and NPY_LAPACK_ORDER="" before building NumPy.
    blas_mkl_info:
      NOT AVAILABLE
    blis_info:
      NOT AVAILABLE
    openblas_info:
        libraries = ['openblas', 'openblas']
        library_dirs = ['/usr/local/lib']
        language = c
        define_macros = [('HAVE_CBLAS', None)]
    blas_opt_info:
        libraries = ['openblas', 'openblas']
        library_dirs = ['/usr/local/lib']
        language = c
        define_macros = [('HAVE_CBLAS', None)]
    lapack_mkl_info:
      NOT AVAILABLE
    openblas_lapack_info:
        libraries = ['openblas', 'openblas']
        library_dirs = ['/usr/local/lib']
        language = c
        define_macros = [('HAVE_CBLAS', None)]
    lapack_opt_info:
        libraries = ['openblas', 'openblas']
        library_dirs = ['/usr/local/lib']
        language = c
        define_macros = [('HAVE_CBLAS', None)]
    ----------------------------------------

Thanks for your help!

thomas-woodruff avatar Mar 06 '21 09:03 thomas-woodruff

Thanks for posting this, can you try the steps here and see if that fixes it? It looks like downgrading numpy to 1.18 is the best approach now, either that or manually specifying your own blas install (which SCS can already handle if you want to do that instead).

bodono avatar Mar 08 '21 16:03 bodono

Thanks for the assist @bodono . Unfortunately, I still couldn't get it working. In the end I refactored things a bit to run everything in docker. For posterity, here's a project with a working Dockerfile for cvxpy/scs: https://github.com/mariohsouto/cvxpy_docker

thomas-woodruff avatar Mar 17 '21 17:03 thomas-woodruff

Ok thanks for the update. I will see what I can do about this soon.

bodono avatar Mar 18 '21 12:03 bodono