0
点赞
收藏
分享

微信扫一扫

M1安装cvxpy python3.8.2

互联网码农 2022-03-19 阅读 111
python

python3.8.2

官网installation安装先试一遍 不行再考虑下面的
要先 brew install cmake
https://www.cvxpy.org/install/index.html

Apple M1 users have had trouble installing CVXPY using the commands above. That trouble stemmed partly from a configuration error in CVXPY’s pyproject.toml, which has been fixed in CVXPY 1.1.19 and 1.2.0. If you have those versions (or newer) then the above commands should work provided (1) you have cmake installed via Homebrew and (2) you have an ECOS 2.0.5 wheel. The cmake requirement stems from OSQP and there appear to be problems building more recent versions of ECOS on M1 machines. See this comment on the CVXPY repo and this issue on the ECOS repo for more information.

指定安装ecos的版本
ecos==2.0.5
pip安装cvxpy还是出错



  clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
            clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
            clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
            clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
            clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
            error: Command "clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -DNPY_INTERNAL_BUILD=1 -DHAVE_NPY_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -DNO_ATLAS_INFO=3 -DHAVE_CBLAS -Ibuild/src.macosx-10.14.6-arm64-3.8/numpy/core/src/umath -Ibuild/src.macosx-10.14.6-arm64-3.8/numpy/core/src/npymath -Ibuild/src.macosx-10.14.6-arm64-3.8/numpy/core/src/common -Inumpy/core/include -Ibuild/src.macosx-10.14.6-arm64-3.8/numpy/core/include/numpy -Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/Users/jiali/Desktop/multitask/FedEM-main/venv/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -Ibuild/src.macosx-10.14.6-arm64-3.8/numpy/core/src/common -Ibuild/src.macosx-10.14.6-arm64-3.8/numpy/core/src/npymath -Ibuild/src.macosx-10.14.6-arm64-3.8/numpy/core/src/common -Ibuild/src.macosx-10.14.6-arm64-3.8/numpy/core/src/npymath -c numpy/core/src/multiarray/alloc.c -o build/temp.macosx-10.14.6-arm64-3.8/numpy/core/src/multiarray/alloc.o -MMD -MF build/temp.macosx-10.14.6-arm64-3.8/numpy/core/src/multiarray/alloc.o.d -faltivec -I/System/Library/Frameworks/vecLib.framework/Headers" failed with exit status 1
            [end of output]
      
        note: This error originates from a subprocess, and is likely not a problem with pip.
      error: legacy-install-failure
      
      × Encountered error while trying to install package.
      ╰─> numpy
      
      note: This is an issue with the package mentioned above, not pip.
      hint: See above for output from the failure.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

我的方法:

  1. 依赖库要全部先安装好
  2. 下载源码 source code 安装
If you want to use CVXPY with editable source code, run

pip install -e .
otherwise, run

pip install .

输入命令:arch -x86_64 pip install -e .

arch -x86_64 pip install -e .
Obtaining file:///Users/jiali/Downloads/cvxpy-1.2.0
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: scipy>=1.1.0 in /Users/jiali/Desktop/multitask/FedEM-main/venv/lib/python3.8/site-packages (from cvxpy==1.2.0) (1.8.0)
Requirement already satisfied: ecos>=2 in /Users/jiali/Desktop/multitask/FedEM-main/venv/lib/python3.8/site-packages (from cvxpy==1.2.0) (2.0.5)
Requirement already satisfied: scs>=1.1.6 in /Users/jiali/Desktop/multitask/FedEM-main/venv/lib/python3.8/site-packages (from cvxpy==1.2.0) (3.2.0)
Requirement already satisfied: numpy>=1.15 in /Users/jiali/Desktop/multitask/FedEM-main/venv/lib/python3.8/site-packages (from cvxpy==1.2.0) (1.22.3)
Requirement already satisfied: osqp>=0.4.1 in /Users/jiali/Desktop/multitask/FedEM-main/venv/lib/python3.8/site-packages (from cvxpy==1.2.0) (0.6.2.post5)
Requirement already satisfied: qdldl in /Users/jiali/Desktop/multitask/FedEM-main/venv/lib/python3.8/site-packages (from osqp>=0.4.1->cvxpy==1.2.0) (0.1.5.post0)
Installing collected packages: cvxpy
  Running setup.py develop for cvxpy
Successfully installed cvxpy-1.2.0

举报

相关推荐

0 条评论