osqp / osqp-python

Python interface for OSQP

Home Page:https://osqp.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot install osqp on MacOSX

semolas opened this issue · comments

I am trying to install osqp on MacOSX (v12.5.1).

1 - Trying pip install osqp==0.6.2.post5, fails, here are a few relevant lines from all the output:

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

running build_ext
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/bin/cmake", line 5, in
from cmake import cmake
ModuleNotFoundError: No module named 'cmake'

However cmake is installed with cmake --version of 3.24.3

2 - Following the installation procedure (python3 setup.py install), manages running build_ext but fails later; steps from: https://osqp.org/docs/get_started/python.html

Installed /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/osqp-0.0.0-py3.10-macosx-10.9-universal2.egg
Processing dependencies for osqp==0.0.0
Searching for osqp==0.0.0
Reading https://pypi.org/simple/osqp/
Download error on https://pypi.org/simple/osqp/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997) -- Some packages may not be found!
Couldn't find index page for 'osqp' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.org/simple/
Download error on https://pypi.org/simple/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997) -- Some packages may not be found!
No local packages or working download links found for osqp==0.0.0

What should I do?

Additional infos:
python3 -V -> 3.10.4

Experiencing the same error when cmake is installed from pip

root@36d9bc0932ad:/# cmake --version
cmake version 3.24.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).

Tried to install in a python:3.9 docker container (architecture:arm64) and in an python 3.9 macOS arm64 conda environment

It seems that the installation process has problems specifically with cmake installed from pip as it works correctly on when cmake is installed from brew (macos) or apt (debian/ubuntu)

@vineetbansal do you think this can be mitigated by providing a full path to cmake in the call call in the setup.py? Let me know if I can assist solving this issue

@semolas, @piiq - I'd suggest doing a pip install --upgrade pip to upgrade to the latest pip first (which is capable of building osqp in a containerized environment with cmake automatically installed in it). python setup.py install is not the recommended way going forward. Once you do this, then try pip install osqp==0.6.2.post5 or pip install . (from inside the repository cloned using git clone --recurse-submodules git@...

commented

I have this problem with osqp==0.6.3 too. Here is my env:

MacOS Ventura 13.3
pip==23.2.1
setuptools==68.1.2
wheel==0.41.1
cmake==(I tried from 3.25.0 to the latest version)

I run it in a Python virtual env. I install cmake first, and then osqp. I don't install them in a same requirements.txt.
Before installing osqp, I run which cmake and see it is available here:

/Users/someone/git/an-application/venv/bin/cmake

When installing osqp, I got this error:

Collecting osqp==0.6.3
  Downloading osqp-0.6.3.tar.gz (228 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 228.4/228.4 kB 2.7 MB/s eta 0:00:00
  Installing build dependencies ... error
  error: subprocess-exited-with-error
  
  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [111 lines of output]
      Collecting oldest-supported-numpy
        Obtaining dependency information for oldest-supported-numpy from https://files.pythonhosted.org/packages/94/9a/756fef9346e5ca2289cb70d73990b4c9f25446a885c1186cfb93a85e7da0/oldest_supported_numpy-2023.8.3-py3-none-any.whl.metadata
        Using cached oldest_supported_numpy-2023.8.3-py3-none-any.whl.metadata (9.5 kB)
      Collecting setuptools>=40.8.0
        Obtaining dependency information for setuptools>=40.8.0 from https://files.pythonhosted.org/packages/4f/ab/0bcfebdfc3bfa8554b2b2c97a555569c4c1ebc74ea288741ea8326c51906/setuptools-68.1.2-py3-none-any.whl.metadata
        Using cached setuptools-68.1.2-py3-none-any.whl.metadata (6.2 kB)
      Collecting wheel
        Obtaining dependency information for wheel from https://files.pythonhosted.org/packages/28/f5/6955d7b3a5d71ce6bac104f9cf98c1b0513ad656cdaca8ea7d579196f771/wheel-0.41.1-py3-none-any.whl.metadata
        Using cached wheel-0.41.1-py3-none-any.whl.metadata (2.2 kB)
      Collecting setuptools_scm>=6.2
        Using cached setuptools_scm-7.1.0-py3-none-any.whl (43 kB)
      Collecting qdldl
        Using cached qdldl-0.1.7.post0.tar.gz (70 kB)
        Installing build dependencies: started
        Installing build dependencies: finished with status 'done'
        Getting requirements to build wheel: started
        Getting requirements to build wheel: finished with status 'done'
        Installing backend dependencies: started
        Installing backend dependencies: finished with status 'done'
        Preparing metadata (pyproject.toml): started
        Preparing metadata (pyproject.toml): finished with status 'done'
      Collecting numpy==1.21.6 (from oldest-supported-numpy)
        Using cached numpy-1.21.6-cp310-cp310-macosx_11_0_arm64.whl (12.4 MB)
      Collecting packaging>=20.0 (from setuptools_scm>=6.2)
        Using cached packaging-23.1-py3-none-any.whl (48 kB)
      Collecting typing-extensions (from setuptools_scm>=6.2)
        Obtaining dependency information for typing-extensions from https://files.pythonhosted.org/packages/ec/6b/63cc3df74987c36fe26157ee12e09e8f9db4de771e0f3404263117e75b95/typing_extensions-4.7.1-py3-none-any.whl.metadata
        Using cached typing_extensions-4.7.1-py3-none-any.whl.metadata (3.1 kB)
      Collecting tomli>=1.0.0 (from setuptools_scm>=6.2)
        Using cached tomli-2.0.1-py3-none-any.whl (12 kB)
      Collecting scipy>=0.13.2 (from qdldl)
        Obtaining dependency information for scipy>=0.13.2 from https://files.pythonhosted.org/packages/63/b9/0344b60e7c577eb637785841222fde8ef7928ec4797be1a34ca39bfe31dc/scipy-1.11.2-cp310-cp310-macosx_12_0_arm64.whl.metadata
        Using cached scipy-1.11.2-cp310-cp310-macosx_12_0_arm64.whl.metadata (100 kB)
      Using cached oldest_supported_numpy-2023.8.3-py3-none-any.whl (4.8 kB)
      Using cached setuptools-68.1.2-py3-none-any.whl (805 kB)
      Using cached wheel-0.41.1-py3-none-any.whl (64 kB)
      Using cached scipy-1.11.2-cp310-cp310-macosx_12_0_arm64.whl (29.6 MB)
      Using cached typing_extensions-4.7.1-py3-none-any.whl (33 kB)
      Building wheels for collected packages: qdldl
        Building wheel for qdldl (pyproject.toml): started
        Building wheel for qdldl (pyproject.toml): finished with status 'error'
        error: subprocess-exited-with-error
      
        × Building wheel for qdldl (pyproject.toml) did not run successfully.
        │ exit code: 1
        ╰─> [59 lines of output]
            running bdist_wheel
            running build
            running build_ext
            Traceback (most recent call last):
              File "/Users/someone/git/an-application/venv/bin/cmake", line 5, in <module>
                from cmake import cmake
            ModuleNotFoundError: No module named 'cmake'
            Traceback (most recent call last):
              File "/Users/someone/git/an-application/venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
                main()
              File "/Users/someone/git/an-application/venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
                json_out['return_val'] = hook(**hook_input['kwargs'])
              File "/Users/someone/git/an-application/venv/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
                return _build_backend().build_wheel(wheel_directory, config_settings,
              File "/private/var/folders/y_/ncmm55ls1zzg41kl5w5z64t80000gp/T/pip-build-env-1qqembnf/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 434, in build_wheel
                return self._build_with_temp_dir(
              File "/private/var/folders/y_/ncmm55ls1zzg41kl5w5z64t80000gp/T/pip-build-env-1qqembnf/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 419, in _build_with_temp_dir
                self.run_setup()
              File "/private/var/folders/y_/ncmm55ls1zzg41kl5w5z64t80000gp/T/pip-build-env-1qqembnf/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 341, in run_setup
                exec(code, locals())
              File "<string>", line 113, in <module>
              File "/private/var/folders/y_/ncmm55ls1zzg41kl5w5z64t80000gp/T/pip-build-env-1qqembnf/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 107, in setup
                return distutils.core.setup(**attrs)
              File "/private/var/folders/y_/ncmm55ls1zzg41kl5w5z64t80000gp/T/pip-build-env-1qqembnf/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
                return run_commands(dist)
              File "/private/var/folders/y_/ncmm55ls1zzg41kl5w5z64t80000gp/T/pip-build-env-1qqembnf/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
                dist.run_commands()
              File "/private/var/folders/y_/ncmm55ls1zzg41kl5w5z64t80000gp/T/pip-build-env-1qqembnf/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
                self.run_command(cmd)
              File "/private/var/folders/y_/ncmm55ls1zzg41kl5w5z64t80000gp/T/pip-build-env-1qqembnf/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1233, in run_command
                super().run_command(command)
              File "/private/var/folders/y_/ncmm55ls1zzg41kl5w5z64t80000gp/T/pip-build-env-1qqembnf/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
                cmd_obj.run()
              File "/private/var/folders/y_/ncmm55ls1zzg41kl5w5z64t80000gp/T/pip-build-env-1qqembnf/normal/lib/python3.10/site-packages/wheel/bdist_wheel.py", line 349, in run
                self.run_command("build")
              File "/private/var/folders/y_/ncmm55ls1zzg41kl5w5z64t80000gp/T/pip-build-env-1qqembnf/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
                self.distribution.run_command(command)
              File "/private/var/folders/y_/ncmm55ls1zzg41kl5w5z64t80000gp/T/pip-build-env-1qqembnf/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1233, in run_command
                super().run_command(command)
              File "/private/var/folders/y_/ncmm55ls1zzg41kl5w5z64t80000gp/T/pip-build-env-1qqembnf/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
                cmd_obj.run()
              File "/private/var/folders/y_/ncmm55ls1zzg41kl5w5z64t80000gp/T/pip-build-env-1qqembnf/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build.py", line 131, in run
                self.run_command(cmd_name)
              File "/private/var/folders/y_/ncmm55ls1zzg41kl5w5z64t80000gp/T/pip-build-env-1qqembnf/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
                self.distribution.run_command(command)
              File "/private/var/folders/y_/ncmm55ls1zzg41kl5w5z64t80000gp/T/pip-build-env-1qqembnf/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1233, in run_command
                super().run_command(command)
              File "/private/var/folders/y_/ncmm55ls1zzg41kl5w5z64t80000gp/T/pip-build-env-1qqembnf/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
                cmd_obj.run()
              File "/private/var/folders/y_/ncmm55ls1zzg41kl5w5z64t80000gp/T/pip-build-env-1qqembnf/overlay/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 88, in run
                _build_ext.run(self)
              File "/private/var/folders/y_/ncmm55ls1zzg41kl5w5z64t80000gp/T/pip-build-env-1qqembnf/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
                self.build_extensions()
              File "<string>", line 81, in build_extensions
              File "/opt/homebrew/Cellar/python@3.10/3.10.12/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 421, in check_output
                return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
              File "/opt/homebrew/Cellar/python@3.10/3.10.12/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 526, in run
                raise CalledProcessError(retcode, process.args,
            subprocess.CalledProcessError: Command '['cmake', '--version']' returned non-zero exit status 1.
            [end of output]
      
        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for qdldl
      Failed to build qdldl
      ERROR: Could not build wheels for qdldl, which is required to install pyproject.toml-based projects
      [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.

note: This error originates from a subprocess, and is likely not a problem with pip.

However, with exactly the same env and steps, I can install osqp==0.6.1 successfully.