1

I've encountered the error below while attempting to install the convex optimization library CVXPY. I previously encountered this (distinct) error, and was able to rectify it by updating my pip installation with python -m pip install --upgrade pip.

Building wheels for collected packages: cvxpy
  Building wheel for cvxpy (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for cvxpy (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [551 lines of output]
      <string>:225: ResourceWarning: unclosed file <_io.TextIOWrapper name='READ                                     ME.md' mode='r' encoding='UTF-8'>
      ResourceWarning: Enable tracemalloc to get the object allocation traceback
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-39-pydebug
      creating build/lib.linux-x86_64-cpython-39-pydebug/cvxpy
      copying cvxpy/__init__.py -> build/lib.linux-x86_64-cpython-39-pydebug/cvx                                     py

      ...

      
      running build_ext
      building '_cvxcore' extension
      creating build/temp.linux-x86_64-cpython-39-pydebug
      creating build/temp.linux-x86_64-cpython-39-pydebug/cvxpy
      creating build/temp.linux-x86_64-cpython-39-pydebug/cvxpy/cvxcore
      creating build/temp.linux-x86_64-cpython-39-pydebug/cvxpy/cvxcore/python
      creating build/temp.linux-x86_64-cpython-39-pydebug/cvxpy/cvxcore/src
      gcc -pthread -Wno-unused-result -Wsign-compare -g -Og -Wall -fPIC -Icvxpy/                                     cvxcore/src/ -Icvxpy/cvxcore/python/ -Icvxpy/cvxcore/include/ -I/cvmfs/ara.opens                                     ciencegrid.org/trunk/centos7/misc_build/include/python3.9d -I/tmp/pip-build-env-                                     vp2obnop/overlay/lib/python3.9/site-packages/numpy/core/include -c cvxpy/cvxcore                                     /python/cvxcore_wrap.cxx -o build/temp.linux-x86_64-cpython-39-pydebug/cvxpy/cvx                                     core/python/cvxcore_wrap.o -O3 -std=c++11 -Wall -pedantic -Wextra -Wno-unused-pa                                     rameter
      In file included from /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/si                                     te-packages/numpy/core/include/numpy/ndarraytypes.h:1822:0,
                       from /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/si                                     te-packages/numpy/core/include/numpy/ndarrayobject.h:12,
                       from /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/si                                     te-packages/numpy/core/include/numpy/arrayobject.h:4,
                       from cvxpy/cvxcore/python/cvxcore_wrap.cxx:2846:
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning is a GCC extensi                                     on [enabled by default]
       #warning "Using deprecated NumPy API, disable it with " \
        ^
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecate                                     d NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSIO                                     N" [-Wcpp]
      In file included from /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/si                                     te-packages/numpy/core/include/numpy/ndarrayobject.h:21:0,
                       from /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/si                                     te-packages/numpy/core/include/numpy/arrayobject.h:4,
                       from cvxpy/cvxcore/python/cvxcore_wrap.cxx:2846:
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/__multiarray_api.h: In function ‘int _import_array()’:
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/__multiarray_api.h:640:23: warning: ISO C++ forbids casting betwe                                     en pointer-to-function and pointer-to-object [-Wpedantic]
                PyArray_API[0])
                             ^
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/__multiarray_api.h:1492:22: note: in expansion of macro ‘PyArray_                                     GetNDArrayCVersion’
         if (NPY_VERSION != PyArray_GetNDArrayCVersion()) {
                            ^
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/__multiarray_api.h:640:23: warning: ISO C++ forbids casting betwe                                     en pointer-to-function and pointer-to-object [-Wpedantic]
                PyArray_API[0])
                             ^
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/__multiarray_api.h:1495:39: note: in expansion of macro ‘PyArray_                                     GetNDArrayCVersion’
                    (int) NPY_VERSION, (int) PyArray_GetNDArrayCVersion());
                                             ^
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/__multiarray_api.h:1195:25: warning: ISO C++ forbids casting betw                                     een pointer-to-function and pointer-to-object [-Wpedantic]
                PyArray_API[211])
                               ^
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/__multiarray_api.h:1498:29: note: in expansion of macro ‘PyArray_                                     GetNDArrayCFeatureVersion’
         if (NPY_FEATURE_VERSION > PyArray_GetNDArrayCFeatureVersion()) {
                                   ^
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/__multiarray_api.h:1195:25: warning: ISO C++ forbids casting betw                                     een pointer-to-function and pointer-to-object [-Wpedantic]
                PyArray_API[211])
                               ^
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/__multiarray_api.h:1501:47: note: in expansion of macro ‘PyArray_                                     GetNDArrayCFeatureVersion’
                    (int) NPY_FEATURE_VERSION, (int) PyArray_GetNDArrayCFeatureV                                     ersion());
                                                     ^
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/__multiarray_api.h:1192:25: warning: ISO C++ forbids casting betw                                     een pointer-to-function and pointer-to-object [-Wpedantic]
                PyArray_API[210])
                               ^
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/__multiarray_api.h:1509:8: note: in expansion of macro ‘PyArray_G                                     etEndianness’
         st = PyArray_GetEndianness();
              ^
      cvxpy/cvxcore/python/cvxcore_wrap.cxx: In function ‘int type_match(int, in                                     t)’:
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/__multiarray_api.h:1135:25: warning: ISO C++ forbids casting betw                                     een pointer-to-function and pointer-to-object [-Wpedantic]
                PyArray_API[191])
                               ^
      cvxpy/cvxcore/python/cvxcore_wrap.cxx:3443:12: note: in expansion of macro                                      ‘PyArray_EquivTypenums’
           return PyArray_EquivTypenums(actual_type, desired_type);
                  ^
      cvxpy/cvxcore/python/cvxcore_wrap.cxx: In function ‘PyArrayObject* obj_to_                                     array_no_conversion(PyObject*, int)’:
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/__multiarray_api.h:1135:25: warning: ISO C++ forbids casting betw                                     een pointer-to-function and pointer-to-object [-Wpedantic]
                PyArray_API[191])
                               ^
      cvxpy/cvxcore/python/cvxcore_wrap.cxx:3455:29: note: in expansion of macro                                      ‘PyArray_EquivTypenums’
                                   PyArray_EquivTypenums(array_type(input), type                                     code)))
                                   ^
      cvxpy/cvxcore/python/cvxcore_wrap.cxx: In function ‘PyArrayObject* obj_to_                                     array_allow_conversion(PyObject*, int, int*)’:
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/__multiarray_api.h:1135:25: warning: ISO C++ forbids casting betw                                     een pointer-to-function and pointer-to-object [-Wpedantic]
                PyArray_API[191])
                               ^
      cvxpy/cvxcore/python/cvxcore_wrap.cxx:3491:29: note: in expansion of macro                                      ‘PyArray_EquivTypenums’
                                   PyArray_EquivTypenums(array_type(input),typec                                     ode)))
                                   ^
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/__multiarray_api.h:769:24: warning: ISO C++ forbids casting betwe                                     en pointer-to-function and pointer-to-object [-Wpedantic]
                PyArray_API[69])
                              ^
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/ndarrayobject.h:89:9: note: in expansion of macro ‘PyArray_FromAn                                     y’
               PyArray_FromAny(m, PyArray_DescrFromType(type), min, max, \
               ^
      cvxpy/cvxcore/python/cvxcore_wrap.cxx:3498:16: note: in expansion of macro                                      ‘PyArray_FROMANY’
             py_obj = PyArray_FROMANY(input, typecode, 0, 0, NPY_DEFAULT);
                      ^
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/__multiarray_api.h:697:24: warning: ISO C++ forbids casting betwe                                     en pointer-to-function and pointer-to-object [-Wpedantic]
                PyArray_API[45])
                              ^
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/ndarrayobject.h:89:28: note: in expansion of macro ‘PyArray_Descr                                     FromType’
               PyArray_FromAny(m, PyArray_DescrFromType(type), min, max, \
                                  ^
      cvxpy/cvxcore/python/cvxcore_wrap.cxx:3498:16: note: in expansion of macro                                      ‘PyArray_FROMANY’
             py_obj = PyArray_FROMANY(input, typecode, 0, 0, NPY_DEFAULT);
                      ^
      cvxpy/cvxcore/python/cvxcore_wrap.cxx: In function ‘PyArrayObject* make_co                                     ntiguous(PyArrayObject*, int*, int, int)’:
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/__multiarray_api.h:769:24: warning: ISO C++ forbids casting betwe                                     en pointer-to-function and pointer-to-object [-Wpedantic]
                PyArray_API[69])
                              ^
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/ndarrayobject.h:188:9: note: in expansion of macro ‘PyArray_FromA                                     ny’
               PyArray_FromAny(op, PyArray_DescrFromType(type), min_depth, \
               ^
      cvxpy/cvxcore/python/cvxcore_wrap.cxx:3522:33: note: in expansion of macro                                      ‘PyArray_ContiguousFromObject’
             result = (PyArrayObject*) PyArray_ContiguousFromObject((PyObject*)a                                     ry,
                                       ^
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/__multiarray_api.h:697:24: warning: ISO C++ forbids casting betwe                                     en pointer-to-function and pointer-to-object [-Wpedantic]
                PyArray_API[45])
                              ^
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/ndarrayobject.h:188:29: note: in expansion of macro ‘PyArray_Desc                                     rFromType’
               PyArray_FromAny(op, PyArray_DescrFromType(type), min_depth, \
                                   ^
      cvxpy/cvxcore/python/cvxcore_wrap.cxx:3522:33: note: in expansion of macro                                      ‘PyArray_ContiguousFromObject’
             result = (PyArrayObject*) PyArray_ContiguousFromObject((PyObject*)a                                     ry,
                                       ^
      cvxpy/cvxcore/python/cvxcore_wrap.cxx: In function ‘PyArrayObject* make_fo                                     rtran(PyArrayObject*, int*, int, int)’:
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/__multiarray_api.h:889:25: warning: ISO C++ forbids casting betwe                                     en pointer-to-function and pointer-to-object [-Wpedantic]
                PyArray_API[109])
                               ^
      cvxpy/cvxcore/python/cvxcore_wrap.cxx:3549:33: note: in expansion of macro                                      ‘PyArray_FromArray’
             result = (PyArrayObject*) PyArray_FromArray(ary, ary->descr, NPY_FO                                     RTRAN);
                                       ^
      cvxpy/cvxcore/python/cvxcore_wrap.cxx: In function ‘PyObject* _wrap_Proble                                     mData_getV(PyObject*, PyObject*)’:
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/__multiarray_api.h:841:24: warning: ISO C++ forbids casting betwe                                     en pointer-to-function and pointer-to-object [-Wpedantic]
                PyArray_API[93])
                              ^
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/ndarrayobject.h:118:9: note: in expansion of macro ‘PyArray_New’
               PyArray_New(&PyArray_Type, nd, dims, typenum, NULL, NULL, 0, 0, N                                     ULL)
               ^
      cvxpy/cvxcore/python/cvxcore_wrap.cxx:7967:14: note: in expansion of macro                                      ‘PyArray_SimpleNew’
           array2 = PyArray_SimpleNew(1, dims, NPY_DOUBLE);
                    ^
      cvxpy/cvxcore/python/cvxcore_wrap.cxx: In function ‘PyObject* _wrap_Proble                                     mData_getI(PyObject*, PyObject*)’:
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/__multiarray_api.h:841:24: warning: ISO C++ forbids casting betwe                                     en pointer-to-function and pointer-to-object [-Wpedantic]
                PyArray_API[93])
                              ^
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/ndarrayobject.h:118:9: note: in expansion of macro ‘PyArray_New’
               PyArray_New(&PyArray_Type, nd, dims, typenum, NULL, NULL, 0, 0, N                                     ULL)
               ^
      cvxpy/cvxcore/python/cvxcore_wrap.cxx:8010:14: note: in expansion of macro                                      ‘PyArray_SimpleNew’
           array2 = PyArray_SimpleNew(1, dims, NPY_DOUBLE);
                    ^
      cvxpy/cvxcore/python/cvxcore_wrap.cxx: In function ‘PyObject* _wrap_Proble                                     mData_getJ(PyObject*, PyObject*)’:
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/__multiarray_api.h:841:24: warning: ISO C++ forbids casting betwe                                     en pointer-to-function and pointer-to-object [-Wpedantic]
                PyArray_API[93])
                              ^
      /tmp/pip-build-env-vp2obnop/overlay/lib/python3.9/site-packages/numpy/core                                     /include/numpy/ndarrayobject.h:118:9: note: in expansion of macro ‘PyArray_New’
               PyArray_New(&PyArray_Type, nd, dims, typenum, NULL, NULL, 0, 0, N                                     ULL)
               ^
      cvxpy/cvxcore/python/cvxcore_wrap.cxx:8053:14: note: in expansion of macro                                      ‘PyArray_SimpleNew’
           array2 = PyArray_SimpleNew(1, dims, NPY_DOUBLE);
                    ^
      gcc -pthread -Wno-unused-result -Wsign-compare -g -Og -Wall -fPIC -Icvxpy/                                     cvxcore/src/ -Icvxpy/cvxcore/python/ -Icvxpy/cvxcore/include/ -I/cvmfs/ara.opens                                     ciencegrid.org/trunk/centos7/misc_build/include/python3.9d -I/tmp/pip-build-env-                                     vp2obnop/overlay/lib/python3.9/site-packages/numpy/core/include -c cvxpy/cvxcore                                     /src/LinOpOperations.cpp -o build/temp.linux-x86_64-cpython-39-pydebug/cvxpy/cvx                                     core/src/LinOpOperations.o -O3 -std=c++11 -Wall -pedantic -Wextra -Wno-unused-pa                                     rameter
      In file included from /usr/include/c++/4.8.2/cassert:43:0,
                       from cvxpy/cvxcore/src/LinOpOperations.cpp:18:
      cvxpy/cvxcore/src/LinOpOperations.cpp: In function ‘Tensor get_kronl_mat(c                                     onst LinOp&, int)’:
      cvxpy/cvxcore/src/LinOpOperations.cpp:379:25: error: ‘IsRowMajor’ cannot b                                     e used as a function
         assert(!rh.IsRowMajor());
                               ^
      cvxpy/cvxcore/src/LinOpOperations.cpp: In function ‘Tensor get_vstack_mat(                                     const LinOp&, int)’:
      cvxpy/cvxcore/src/LinOpOperations.cpp:430:41: warning: comparison between                                      signed and unsigned integer expressions [-Wsign-compare]
         assert(arg_idx <= lin.get_args().size());
                                               ^
      cvxpy/cvxcore/src/LinOpOperations.cpp: In function ‘Tensor get_hstack_mat(                                     const LinOp&, int)’:
      cvxpy/cvxcore/src/LinOpOperations.cpp:470:41: warning: comparison between                                      signed and unsigned integer expressions [-Wsign-compare]
         assert(arg_idx <= lin.get_args().size());
                                               ^
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem wit                                     h pip.
  ERROR: Failed building wheel for cvxpy
Failed to build cvxpy
ERROR: Could not build wheels for cvxpy, which is required to install pyproject.                                     toml-based projects

I've redacted some of the output (some copying ... lines), which I believe to be irrelevant. You can find the full output here.

It seems that pip is attempting to build from source using the .tar.gz file, and not one of the available whl files. I've attempted to download the manylinux wheel, and install it with pip instal XXX.whl, but get the error XXX.whl is not a supported wheel on this platform. The cluster is running CentOS 7 (Core).

Note that the target machine (an academic computing cluster) does not have Conda installed, and I am unable to install it. I'm attempting to run software which has a CVXPY dependency, and which requires access to data stored on this machine (which cannot be moved off of it). GCC is installed, fully functional, and exists at /usr/bin/gcc.

10GeV
  • 453
  • 2
  • 14
  • `does not have Conda installed, and I am unable to install it` <- are you aware that you don't need any sudo rights to install conda? – FlyingTeller Aug 25 '22 at 06:18
  • Which version of cvxpy are you trying to install? Which version of numpy do you have and what is your gcc version? – FlyingTeller Aug 25 '22 at 06:22
  • @FlyingTeller I'm attempting to install the latest version (`cvxpy 1.2`). It looks like `gcc 4.8.5` and `numpy 1.20.2` are installed. – 10GeV Aug 25 '22 at 06:57
  • It is a bit odd that it is not picking up one of the available [whl files](https://pypi.org/project/cvxpy/1.2.1/#files) then. It is missing from your posted output, but is `pip` actually attempting to install `cvxpy-1.2.1.tar.gz` – FlyingTeller Aug 25 '22 at 07:01
  • @FlyingTeller Yes, it looks like `pip` is trying to build from source, for some reason. I've tried downloading the Linux `whl` file directly from the attached link, and installing with `pip install xxx.whl`, but get the error `xxx.whl is not a supported wheel on this platform`. The machine is running `CentOS 7 (Core)`. – 10GeV Aug 25 '22 at 07:20
  • I just tried on a centos system with `ecos==2.0.10 numpy==1.23.2 osqp==0.6.2 qdldl==0.1.5 scipy==1.9.0 scs==3.2.0 pip==22.1.2` and it worked. Try to `pip install` those dependencies first and then install cvxpy – FlyingTeller Aug 25 '22 at 07:30
  • @FlyingTeller Unfortunately, it looks like I'm getting the same error. – 10GeV Aug 25 '22 at 17:13

0 Answers0