pythoninstallationpipcvxpy

Failed building wheel for qdldl (when installing cvxpy)


Independent whether I install using pip or from source, whether I use python2 or python3 I can't install cvxpy. I've tried now over four hours and I still fail. The github pages of cvxpy or qdldl wouldn't give me any solution. I installed the packages which led to other errors with no success. Any hints are appreciated.

user@ion:~ $ sudo pip install cvxpy

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting cvxpy
  Using cached https://files.pythonhosted.org/packages/11/d0/d900870dc2d02ea74961b90c353666c6528a33ea61a10aa59a0d5574ae59/cvxpy-1.0.31.tar.gz
  Installing build dependencies ... done
Collecting osqp>=0.4.1 (from cvxpy)
  Using cached https://files.pythonhosted.org/packages/c0/90/4cf48c200a89e46bcad87e12469ee36fc03d0c3f16b703b747e8c4bf618e/osqp-0.6.2.post0.tar.gz
  Installing build dependencies ... done
    Complete output from command python setup.py egg_info:
      Failed building wheel for qdldl
    ERROR: Failed to build one or more wheels
    Disabling LONG
    Remove long integers for numpy compatibility. See:
     - https://github.com/numpy/numpy/issues/5906
     - https://github.com/ContinuumIO/anaconda-issues/issues/3823
    You can reenable long integers by passing: --osqp --long argument.
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-zEueiK/osqp/setup.py", line 276, in <module>
        ext_modules=[_osqp])
      File "/tmp/pip-build-env-vbB_nz/lib/python2.7/site-packages/setuptools/__init__.py", line 161, in setup
        _install_setup_requires(attrs)
      File "/tmp/pip-build-env-vbB_nz/lib/python2.7/site-packages/setuptools/__init__.py", line 156, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "/tmp/pip-build-env-vbB_nz/lib/python2.7/site-packages/setuptools/dist.py", line 721, in fetch_build_eggs
        replace_conflicting=True,
      File "/tmp/pip-build-env-vbB_nz/lib/python2.7/site-packages/pkg_resources/__init__.py", line 782, in resolve
        replace_conflicting=replace_conflicting
      File "/tmp/pip-build-env-vbB_nz/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1065, in best_match
        return self.obtain(req, installer)
      File "/tmp/pip-build-env-vbB_nz/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1077, in obtain
        return installer(requirement)
      File "/tmp/pip-build-env-vbB_nz/lib/python2.7/site-packages/setuptools/dist.py", line 777, in fetch_build_egg
        return fetch_build_egg(self, req)
      File "/tmp/pip-build-env-vbB_nz/lib/python2.7/site-packages/setuptools/installer.py", line 130, in fetch_build_egg
        raise DistutilsError(str(e))
    distutils.errors.DistutilsError: Command '['/usr/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpsvIroT', '--quiet', 'qdldl']' returned non-zero exit status 1
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-zEueiK/osqp/

Or here installing from sources in python 3

user@ion:~/osqp-python $ sudo python3 setup.py install 
no previously-included directories found matching 'tests/__pycache__/'
no previously-included directories found matching 'c/build/'
no previously-included directories found matching 'c/qdldl/build'
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Floats are OFF
-- Disabling long integers (64bit) on 32bit machine
-- Long integers (64bit) are OFF
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/easy_install-zqykb8_c/qdldl-0.1.5.post0/c/build
Scanning dependencies of target qdldlobject
[  6%] Building C object qdldl/CMakeFiles/qdldlobject.dir/src/qdldl.c.o
[  6%] Built target qdldlobject
Scanning dependencies of target qdldlamd
[ 13%] Building C object CMakeFiles/qdldlamd.dir/amd/src/amd_1.c.o
[ 20%] Building C object CMakeFiles/qdldlamd.dir/amd/src/amd_2.c.o
[ 26%] Building C object CMakeFiles/qdldlamd.dir/amd/src/amd_aat.c.o
[ 33%] Building C object CMakeFiles/qdldlamd.dir/amd/src/amd_control.c.o
[ 40%] Building C object CMakeFiles/qdldlamd.dir/amd/src/amd_defaults.c.o
[ 46%] Building C object CMakeFiles/qdldlamd.dir/amd/src/amd_info.c.o
[ 53%] Building C object CMakeFiles/qdldlamd.dir/amd/src/amd_order.c.o
[ 60%] Building C object CMakeFiles/qdldlamd.dir/amd/src/amd_post_tree.c.o
[ 66%] Building C object CMakeFiles/qdldlamd.dir/amd/src/amd_postorder.c.o
[ 73%] Building C object CMakeFiles/qdldlamd.dir/amd/src/amd_preprocess.c.o
[ 80%] Building C object CMakeFiles/qdldlamd.dir/amd/src/amd_valid.c.o
[ 86%] Building C object CMakeFiles/qdldlamd.dir/amd/src/SuiteSparse_config.c.o
[ 93%] Building C object CMakeFiles/qdldlamd.dir/amd/src/perm.c.o
[100%] Linking C static library out/libqdldlamd.a
[100%] Built target qdldlamd
cpp/qdldl.cpp: In constructor ‘qdldl::Solver::Solver(QDLDL_int, QDLDL_int*, QDLDL_int*, QDLDL_float*)’:
cpp/qdldl.cpp:34:41: error: cannot convert ‘QDLDL_int*’ {aka ‘int*’} to ‘const long long int*’
  QDLDL_int amd_status = amd_l_order(nx, Ap, Ai, P, NULL, NULL);
                                         ^~
In file included from cpp/qdldl.hpp:3,
                 from cpp/qdldl.cpp:1:
c/amd/include/amd.h:63:28: note:   initializing argument 2 of ‘long long int amd_l_order(long long int, const long long int*, const long long int*, long long int*, c_float*, c_float*)’
     const SuiteSparse_long Ap [ ],
     ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
Traceback (most recent call last):
  File "/usr/lib/python3.7/distutils/unixccompiler.py", line 118, in _compile
    extra_postargs)
  File "/usr/lib/python3.7/distutils/ccompiler.py", line 909, in spawn
    spawn(cmd, dry_run=self.dry_run)
  File "/usr/lib/python3.7/distutils/spawn.py", line 36, in spawn
    _spawn_posix(cmd, search_path, dry_run=dry_run)
  File "/usr/lib/python3.7/distutils/spawn.py", line 159, in _spawn_posix
    % (cmd, exit_status))
distutils.errors.DistutilsExecError: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.7/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.7/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 172, in run
    cmd = self.call_command('install_lib', warn_dir=0)
  File "/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py", line 158, in call_command
    self.run_command(cmdname)
  File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/usr/lib/python3/dist-packages/setuptools/command/install_lib.py", line 24, in run
    self.build()
  File "/usr/lib/python3.7/distutils/command/install_lib.py", line 109, in build
    self.run_command('build_ext')
  File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/usr/lib/python3/dist-packages/setuptools/command/build_ext.py", line 78, in run
    _build_ext.run(self)
  File "/usr/lib/python3.7/distutils/command/build_ext.py", line 340, in run
    self.build_extensions()
  File "/tmp/easy_install-zqykb8_c/qdldl-0.1.5.post0/setup.py", line 91, in build_extensions
    # Interface files
  File "/usr/lib/python3.7/distutils/command/build_ext.py", line 449, in build_extensions
    self._build_extensions_serial()
  File "/usr/lib/python3.7/distutils/command/build_ext.py", line 474, in _build_extensions_serial
    self.build_extension(ext)
  File "/usr/lib/python3/dist-packages/setuptools/command/build_ext.py", line 199, in build_extension
    _build_ext.build_extension(self, ext)
  File "/usr/lib/python3.7/distutils/command/build_ext.py", line 534, in build_extension
    depends=ext.depends)
  File "/usr/lib/python3.7/distutils/ccompiler.py", line 574, in compile
    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
  File "/usr/lib/python3.7/distutils/unixccompiler.py", line 120, in _compile
    raise CompileError(msg)
distutils.errors.CompileError: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 154, in save_modules
    yield saved
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 195, in setup_context
    yield
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 250, in run_setup
    _execfile(setup_script, ns)
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 45, in _execfile
    exec(code, globals, locals)
  File "/tmp/easy_install-zqykb8_c/qdldl-0.1.5.post0/setup.py", line 124, in <module>
    # External libraries
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.7/distutils/core.py", line 163, in setup
    raise SystemExit("error: " + str(msg))
SystemExit: error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1169, in run_setup
    run_setup(setup_script, args)
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 253, in run_setup
    raise
  File "/usr/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 195, in setup_context
    yield
  File "/usr/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 166, in save_modules
    saved_exc.resume()
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 141, in resume
    six.reraise(type, exc, self._tb)
  File "/usr/lib/python3/dist-packages/setuptools/_vendor/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 154, in save_modules
    yield saved
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 195, in setup_context
    yield
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 250, in run_setup
    _execfile(setup_script, ns)
  File "/usr/lib/python3/dist-packages/setuptools/sandbox.py", line 45, in _execfile
    exec(code, globals, locals)
  File "/tmp/easy_install-zqykb8_c/qdldl-0.1.5.post0/setup.py", line 124, in <module>
    # External libraries
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.7/distutils/core.py", line 163, in setup
    raise SystemExit("error: " + str(msg))
SystemExit: error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "setup.py", line 276, in <module>
    ext_modules=[_osqp])
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 144, in setup
    _install_setup_requires(attrs)
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 139, in _install_setup_requires
    dist.fetch_build_eggs(dist.setup_requires)
  File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 724, in fetch_build_eggs
    replace_conflicting=True,
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 782, in resolve
    replace_conflicting=replace_conflicting
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1065, in best_match
    return self.obtain(req, installer)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1077, in obtain
    return installer(requirement)
  File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 791, in fetch_build_egg
    return cmd.easy_install(req)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 704, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 730, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 915, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1183, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 1171, in run_setup
    raise DistutilsError("Setup script exited with %s" % (v.args[0],))
distutils.errors.DistutilsError: Setup script exited with error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

Solution

  • You can install a version of osqp < 0.6.2, which does not depend on qdldl-python to install cvxpy.

    pip3 install osqp==0.6.1