在 m1 mac 上安装 SCIP

时间:2021-06-02 16:04:47

标签: python macos scipy apple-m1 scip

我正在尝试在运行 python 3.7 的 m1 Mac 上安装 scip

我创建了一个在 x86_64 中运行的终端,并且能够按照 these instructions 编译 scip:

直接编译 SCIP 的方法如下:

  1. 解压压缩包“tar xvzf scip-x.y.z.tgz”
  2. 进入目录“cd scip-x.y.z”
  3. 开始编译 SCIP“make”
  4. (推荐)检查您的 SCIP 安装“make test”

但我不知道接下来要做什么。然后我尝试 pip install pyscipopt 但我收到以下错误:

Collecting pyscipopt
  Using cached PySCIPOpt-3.1.5.tar.gz (623 kB)
Requirement already satisfied: wheel in /Users/chiennifer/.pyenv/versions/3.7.7/lib/python3.7/site-packages (from pyscipopt) (0.36.2)
Building wheels for collected packages: pyscipopt
  Building wheel for pyscipopt (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/chiennifer/.pyenv/versions/3.7.7/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/b7/nnczj7h90wn8ds7ht2ljn2l80000gn/T/pip-install-7dve8tcz/pyscipopt_d6deb81abfa54b778aab0b28d10bb306/setup.py'"'"'; __file__='"'"'/private/var/folders/b7/nnczj7h90wn8ds7ht2ljn2l80000gn/T/pip-install-7dve8tcz/pyscipopt_d6deb81abfa54b778aab0b28d10bb306/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/b7/nnczj7h90wn8ds7ht2ljn2l80000gn/T/pip-wheel-f_3atwka
       cwd: /private/var/folders/b7/nnczj7h90wn8ds7ht2ljn2l80000gn/T/pip-install-7dve8tcz/pyscipopt_d6deb81abfa54b778aab0b28d10bb306/
  Complete output (39 lines):
  Using include path </private/var/folders/b7/nnczj7h90wn8ds7ht2ljn2l80000gn/T/pip-install-7dve8tcz/pyscipopt_d6deb81abfa54b778aab0b28d10bb306/src>.
  Using SCIP library <scip> at </private/var/folders/b7/nnczj7h90wn8ds7ht2ljn2l80000gn/T/pip-install-7dve8tcz/pyscipopt_d6deb81abfa54b778aab0b28d10bb306/lib>.
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-11.1-x86_64-3.7
  creating build/lib.macosx-11.1-x86_64-3.7/pyscipopt
  copying src/pyscipopt/Multidict.py -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
  copying src/pyscipopt/__init__.py -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
  copying src/pyscipopt/scip.pyx -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
  copying src/pyscipopt/scip.pxd -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
  copying src/pyscipopt/propagator.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
  copying src/pyscipopt/heuristic.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
  copying src/pyscipopt/event.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
  copying src/pyscipopt/lp.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
  copying src/pyscipopt/relax.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
  copying src/pyscipopt/benders.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
  copying src/pyscipopt/conshdlr.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
  copying src/pyscipopt/benderscut.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
  copying src/pyscipopt/nodesel.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
  copying src/pyscipopt/expr.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
  copying src/pyscipopt/branchrule.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
  copying src/pyscipopt/sepa.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
  copying src/pyscipopt/presol.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
  copying src/pyscipopt/pricer.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
  running build_ext
  building 'pyscipopt.scip' extension
  creating build/temp.macosx-11.1-x86_64-3.7
  creating build/temp.macosx-11.1-x86_64-3.7/src
  creating build/temp.macosx-11.1-x86_64-3.7/src/pyscipopt
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/bzip2/include -I/usr/local/opt/readline/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/bzip2/include -I/usr/local/opt/readline/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/zlib/include -I/usr/local/opt/bzip2/include -I/private/var/folders/b7/nnczj7h90wn8ds7ht2ljn2l80000gn/T/pip-install-7dve8tcz/pyscipopt_d6deb81abfa54b778aab0b28d10bb306/src -I/Users/chiennifer/.pyenv/versions/3.7.7/include/python3.7m -c src/pyscipopt/scip.c -o build/temp.macosx-11.1-x86_64-3.7/src/pyscipopt/scip.o
  In file included from src/pyscipopt/scip.c:635:
  In file included from /usr/local/include/scip/scip.h:35:
  /usr/local/include/scip/def.h:43:10: fatal error: 'scip/config.h' file not found
  #include "scip/config.h"
           ^~~~~~~~~~~~~~~
  1 error generated.
  error: command 'clang' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for pyscipopt
  Running setup.py clean for pyscipopt
Failed to build pyscipopt
Installing collected packages: pyscipopt
    Running setup.py install for pyscipopt ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/chiennifer/.pyenv/versions/3.7.7/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/b7/nnczj7h90wn8ds7ht2ljn2l80000gn/T/pip-install-7dve8tcz/pyscipopt_d6deb81abfa54b778aab0b28d10bb306/setup.py'"'"'; __file__='"'"'/private/var/folders/b7/nnczj7h90wn8ds7ht2ljn2l80000gn/T/pip-install-7dve8tcz/pyscipopt_d6deb81abfa54b778aab0b28d10bb306/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/b7/nnczj7h90wn8ds7ht2ljn2l80000gn/T/pip-record-uyujqy4v/install-record.txt --single-version-externally-managed --compile --install-headers /Users/chiennifer/.pyenv/versions/3.7.7/include/python3.7m/pyscipopt
         cwd: /private/var/folders/b7/nnczj7h90wn8ds7ht2ljn2l80000gn/T/pip-install-7dve8tcz/pyscipopt_d6deb81abfa54b778aab0b28d10bb306/
    Complete output (39 lines):
    Using include path </private/var/folders/b7/nnczj7h90wn8ds7ht2ljn2l80000gn/T/pip-install-7dve8tcz/pyscipopt_d6deb81abfa54b778aab0b28d10bb306/src>.
    Using SCIP library <scip> at </private/var/folders/b7/nnczj7h90wn8ds7ht2ljn2l80000gn/T/pip-install-7dve8tcz/pyscipopt_d6deb81abfa54b778aab0b28d10bb306/lib>.
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-11.1-x86_64-3.7
    creating build/lib.macosx-11.1-x86_64-3.7/pyscipopt
    copying src/pyscipopt/Multidict.py -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
    copying src/pyscipopt/__init__.py -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
    copying src/pyscipopt/scip.pyx -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
    copying src/pyscipopt/scip.pxd -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
    copying src/pyscipopt/propagator.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
    copying src/pyscipopt/heuristic.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
    copying src/pyscipopt/event.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
    copying src/pyscipopt/lp.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
    copying src/pyscipopt/relax.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
    copying src/pyscipopt/benders.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
    copying src/pyscipopt/conshdlr.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
    copying src/pyscipopt/benderscut.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
    copying src/pyscipopt/nodesel.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
    copying src/pyscipopt/expr.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
    copying src/pyscipopt/branchrule.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
    copying src/pyscipopt/sepa.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
    copying src/pyscipopt/presol.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
    copying src/pyscipopt/pricer.pxi -> build/lib.macosx-11.1-x86_64-3.7/pyscipopt
    running build_ext
    building 'pyscipopt.scip' extension
    creating build/temp.macosx-11.1-x86_64-3.7
    creating build/temp.macosx-11.1-x86_64-3.7/src
    creating build/temp.macosx-11.1-x86_64-3.7/src/pyscipopt
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/bzip2/include -I/usr/local/opt/readline/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/bzip2/include -I/usr/local/opt/readline/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/zlib/include -I/usr/local/opt/bzip2/include -I/private/var/folders/b7/nnczj7h90wn8ds7ht2ljn2l80000gn/T/pip-install-7dve8tcz/pyscipopt_d6deb81abfa54b778aab0b28d10bb306/src -I/Users/chiennifer/.pyenv/versions/3.7.7/include/python3.7m -c src/pyscipopt/scip.c -o build/temp.macosx-11.1-x86_64-3.7/src/pyscipopt/scip.o
    In file included from src/pyscipopt/scip.c:635:
    In file included from /usr/local/include/scip/scip.h:35:
    /usr/local/include/scip/def.h:43:10: fatal error: 'scip/config.h' file not found
    #include "scip/config.h"
             ^~~~~~~~~~~~~~~
    1 error generated.
    error: command 'clang' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/chiennifer/.pyenv/versions/3.7.7/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/b7/nnczj7h90wn8ds7ht2ljn2l80000gn/T/pip-install-7dve8tcz/pyscipopt_d6deb81abfa54b778aab0b28d10bb306/setup.py'"'"'; __file__='"'"'/private/var/folders/b7/nnczj7h90wn8ds7ht2ljn2l80000gn/T/pip-install-7dve8tcz/pyscipopt_d6deb81abfa54b778aab0b28d10bb306/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/b7/nnczj7h90wn8ds7ht2ljn2l80000gn/T/pip-record-uyujqy4v/install-record.txt --single-version-externally-managed --compile --install-headers /Users/chiennifer/.pyenv/versions/3.7.7/include/python3.7m/pyscipopt Check the logs for full command output.

1 个答案:

答案 0 :(得分:0)

PySCIPOpt 不适用于 SCIP 的 Makefile 系统 - 您需要使用 PySCIPOpt installation guide 中提到的 CMake 构建 SCIP。这将生成一个共享库和缺少的 config.h 标头。

您是否已经尝试将预构建的 conda packages 用于 PySCIPOpt 和 SCIP?