robertmartin8 / PyPortfolioOpt

Financial portfolio optimisation in python, including classical efficient frontier, Black-Litterman, Hierarchical Risk Parity
https://pyportfolioopt.readthedocs.io/
MIT License
4.25k stars 928 forks source link

Problem install on macOs Monterey #525

Closed vandelouw closed 7 months ago

vandelouw commented 1 year ago

Hello, I'm running on macOs Monterey, Python 3.9.6 I'm trying to install PyPortfolioOpt, managed to install cvxpy and cvxopt, but running now in a problem, it seems to be linked to CMake and qdldl :

Collecting osqp>=0.4.1
  Using cached osqp-0.6.2.post8.tar.gz (227 kB)
  Installing build dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [156 lines of output]
      Collecting oldest-supported-numpy
        Using cached oldest_supported_numpy-2022.11.19-py3-none-any.whl (4.9 kB)
      Collecting setuptools>=40.8.0
        Using cached setuptools-67.6.0-py3-none-any.whl (1.1 MB)
      Collecting wheel
        Using cached wheel-0.40.0-py3-none-any.whl (64 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.5.post3.tar.gz (69 kB)
        Preparing metadata (setup.py): started
        Preparing metadata (setup.py): finished with status 'done'
      Collecting numpy==1.21.0
        Using cached numpy-1.21.0-cp39-cp39-macosx_11_0_arm64.whl (12.1 MB)
      Collecting tomli>=1.0.0
        Using cached tomli-2.0.1-py3-none-any.whl (12 kB)
      Collecting typing-extensions
        Using cached typing_extensions-4.5.0-py3-none-any.whl (27 kB)
      Collecting packaging>=20.0
        Using cached packaging-23.0-py3-none-any.whl (42 kB)
      Collecting scipy>=0.13.2
        Using cached scipy-1.10.1-cp39-cp39-macosx_12_0_arm64.whl (28.9 MB)
      Building wheels for collected packages: qdldl
        Building wheel for qdldl (setup.py): started
        Building wheel for qdldl (setup.py): finished with status 'error'
        error: subprocess-exited-with-error

        × python setup.py bdist_wheel did not run successfully.
        │ exit code: 1
        ╰─> [50 lines of output]
            running bdist_wheel
            running build
            running build_ext
            Traceback (most recent call last):
              File "/private/var/folders/gn/sd8hz76j17l47t6f3qcw19080000gn/T/pip-install-yoancfsg/qdldl_904eb7c6bd2a485ab56192affafec6e0/setup.py", line 81, in build_extensions
                check_output(['cmake', '--version'])
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/subprocess.py", line 424, in check_output
                return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/subprocess.py", line 505, in run
                with Popen(*popenargs, **kwargs) as process:
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/subprocess.py", line 951, in __init__
                self._execute_child(args, executable, preexec_fn, close_fds,
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1821, in _execute_child
                raise child_exception_type(errno_num, err_msg, err_filename)
            FileNotFoundError: [Errno 2] No such file or directory: 'cmake'

            During handling of the above exception, another exception occurred:

            Traceback (most recent call last):
              File "<string>", line 2, in <module>
              File "<pip-setuptools-caller>", line 34, in <module>
              File "/private/var/folders/gn/sd8hz76j17l47t6f3qcw19080000gn/T/pip-install-yoancfsg/qdldl_904eb7c6bd2a485ab56192affafec6e0/setup.py", line 113, in <module>
                setup(name='qdldl',
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
                return distutils.core.setup(**attrs)
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/distutils/core.py", line 148, in setup
                dist.run_commands()
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 966, in run_commands
                self.run_command(cmd)
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
                cmd_obj.run()
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 299, in run
                self.run_command('build')
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 313, in run_command
                self.distribution.run_command(command)
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
                cmd_obj.run()
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/distutils/command/build.py", line 135, in run
                self.run_command(cmd_name)
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 313, in run_command
                self.distribution.run_command(command)
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
                cmd_obj.run()
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 79, in run
                _build_ext.run(self)
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/distutils/command/build_ext.py", line 340, in run
                self.build_extensions()
              File "/private/var/folders/gn/sd8hz76j17l47t6f3qcw19080000gn/T/pip-install-yoancfsg/qdldl_904eb7c6bd2a485ab56192affafec6e0/setup.py", line 83, in build_extensions
                raise RuntimeError("CMake must be installed to build qdldl")
            RuntimeError: CMake must be installed to build qdldl
            [end of output]

        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for qdldl
        Running setup.py clean for qdldl
      Failed to build qdldl
      Installing collected packages: wheel, typing-extensions, tomli, setuptools, packaging, numpy, setuptools_scm, scipy, oldest-supported-numpy, qdldl
        Running setup.py install for qdldl: started
        Running setup.py install for qdldl: finished with status 'error'
        error: subprocess-exited-with-error

        × Running setup.py install for qdldl did not run successfully.
        │ exit code: 1
        ╰─> [52 lines of output]
            running install
            running build
            running build_ext
            Traceback (most recent call last):
              File "/private/var/folders/gn/sd8hz76j17l47t6f3qcw19080000gn/T/pip-install-yoancfsg/qdldl_904eb7c6bd2a485ab56192affafec6e0/setup.py", line 81, in build_extensions
                check_output(['cmake', '--version'])
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/subprocess.py", line 424, in check_output
                return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/subprocess.py", line 505, in run
                with Popen(*popenargs, **kwargs) as process:
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/subprocess.py", line 951, in __init__
                self._execute_child(args, executable, preexec_fn, close_fds,
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1821, in _execute_child
                raise child_exception_type(errno_num, err_msg, err_filename)
            FileNotFoundError: [Errno 2] No such file or directory: 'cmake'

            During handling of the above exception, another exception occurred:

            Traceback (most recent call last):
              File "<string>", line 2, in <module>
              File "<pip-setuptools-caller>", line 34, in <module>
              File "/private/var/folders/gn/sd8hz76j17l47t6f3qcw19080000gn/T/pip-install-yoancfsg/qdldl_904eb7c6bd2a485ab56192affafec6e0/setup.py", line 113, in <module>
                setup(name='qdldl',
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
                return distutils.core.setup(**attrs)
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/distutils/core.py", line 148, in setup
                dist.run_commands()
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 966, in run_commands
                self.run_command(cmd)
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
                cmd_obj.run()
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/command/install.py", line 61, in run
                return orig.install.run(self)
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/distutils/command/install.py", line 562, in run
                self.run_command('build')
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 313, in run_command
                self.distribution.run_command(command)
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
                cmd_obj.run()
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/distutils/command/build.py", line 135, in run
                self.run_command(cmd_name)
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 313, in run_command
                self.distribution.run_command(command)
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
                cmd_obj.run()
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 79, in run
                _build_ext.run(self)
              File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/distutils/command/build_ext.py", line 340, in run
                self.build_extensions()
              File "/private/var/folders/gn/sd8hz76j17l47t6f3qcw19080000gn/T/pip-install-yoancfsg/qdldl_904eb7c6bd2a485ab56192affafec6e0/setup.py", line 83, in build_extensions
                raise RuntimeError("CMake must be installed to build qdldl")
            RuntimeError: CMake must be installed to build qdldl
            [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.
      ╰─> qdldl

is there a way to solve this ? Thanks !

88d52bdba0366127fffca9dfa93895 commented 1 year ago

I guess this issue relate to https://github.com/robertmartin8/PyPortfolioOpt/issues/426, it is a problem of cmake on macos. Please check that and confirm the issue. Many thanks.