Search code examples
pythonpython-3.xpipanacondacvxpy

How do I fix error installing Python package cvxpy


I'm using Windows 10 and Anaconda and trying to install the Python package 'cvxpy' using the command prompt. I keep getting the same error message. I tried installing the package using conda, re-installing Anaconda and trying checking/unchecking the two checkbox options during Anaconda install about path and making it the default.

I'm new and have resisted using a virtual environment and/or setting up a virtual Linux machine, but I'll try this next right now.

C:\Users\john>py -m pip install cvxpy
Collecting cvxpy
  Using cached cvxpy-1.1.7.tar.gz (1.0 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... - ** On entry to DGEBAL parameter number  3 had an illegal value
 ** On entry to DGEHRD  parameter number  2 had an illegal value
 ** On entry to DORGHR DORGQR parameter number  2 had an illegal value
 ** On entry to DHSEQR parameter number  4 had an illegal value
error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\john\anaconda3\python.exe' 'C:\Users\john\anaconda3\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\john\AppData\Local\Temp\tmp9owx0jay'
         cwd: C:\Users\john\AppData\Local\Temp\pip-install-vjri9n__\cvxpy
    Complete output (55 lines):
    running dist_info
    creating C:\Users\john\AppData\Local\Temp\pip-modern-metadata-r0nwvhtg\cvxpy.egg-info
    writing C:\Users\john\AppData\Local\Temp\pip-modern-metadata-r0nwvhtg\cvxpy.egg-info\PKG-INFO
    writing dependency_links to C:\Users\john\AppData\Local\Temp\pip-modern-metadata-r0nwvhtg\cvxpy.egg-info\dependency_links.txt
    writing requirements to C:\Users\john\AppData\Local\Temp\pip-modern-metadata-r0nwvhtg\cvxpy.egg-info\requires.txt
    writing top-level names to C:\Users\john\AppData\Local\Temp\pip-modern-metadata-r0nwvhtg\cvxpy.egg-info\top_level.txt
    writing manifest file 'C:\Users\john\AppData\Local\Temp\pip-modern-metadata-r0nwvhtg\cvxpy.egg-info\SOURCES.txt'
    Traceback (most recent call last):
      File "C:\Users\john\anaconda3\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 280, in <module>
        main()
      File "C:\Users\john\anaconda3\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 263, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "C:\Users\john\anaconda3\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 133, in prepare_metadata_for_build_wheel
        return hook(metadata_directory, config_settings)
      File "C:\Users\john\AppData\Local\Temp\pip-build-env-j8ppb3ya\overlay\Lib\site-packages\setuptools\build_meta.py", line 161, in prepare_metadata_for_build_wheel
        self.run_setup()
      File "C:\Users\john\AppData\Local\Temp\pip-build-env-j8ppb3ya\overlay\Lib\site-packages\setuptools\build_meta.py", line 253, in run_setup
        super(_BuildMetaLegacyBackend,
      File "C:\Users\john\AppData\Local\Temp\pip-build-env-j8ppb3ya\overlay\Lib\site-packages\setuptools\build_meta.py", line 145, in run_setup
        exec(compile(code, __file__, 'exec'), locals())
      File "setup.py", line 57, in <module>
        setup(
      File "C:\Users\john\AppData\Local\Temp\pip-build-env-j8ppb3ya\overlay\Lib\site-packages\setuptools\__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "C:\Users\john\anaconda3\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "C:\Users\john\anaconda3\lib\distutils\dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "C:\Users\john\anaconda3\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\john\AppData\Local\Temp\pip-build-env-j8ppb3ya\overlay\Lib\site-packages\setuptools\command\dist_info.py", line 31, in run
        egg_info.run()
      File "C:\Users\john\AppData\Local\Temp\pip-build-env-j8ppb3ya\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 298, in run
        self.find_sources()
      File "C:\Users\john\AppData\Local\Temp\pip-build-env-j8ppb3ya\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 305, in find_sources
        mm.run()
      File "C:\Users\john\AppData\Local\Temp\pip-build-env-j8ppb3ya\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 536, in run
        self.add_defaults()
      File "C:\Users\john\AppData\Local\Temp\pip-build-env-j8ppb3ya\overlay\Lib\site-packages\setuptools\command\egg_info.py", line 572, in add_defaults
        sdist.add_defaults(self)
      File "C:\Users\john\anaconda3\lib\distutils\command\sdist.py", line 228, in add_defaults
        self._add_defaults_ext()
      File "C:\Users\john\anaconda3\lib\distutils\command\sdist.py", line 311, in _add_defaults_ext
        build_ext = self.get_finalized_command('build_ext')
      File "C:\Users\john\anaconda3\lib\distutils\cmd.py", line 299, in get_finalized_command
        cmd_obj.ensure_finalized()
      File "C:\Users\john\anaconda3\lib\distutils\cmd.py", line 107, in ensure_finalized
        self.finalize_options()
      File "setup.py", line 23, in finalize_options
        import numpy
      File "C:\Users\john\AppData\Local\Temp\pip-build-env-j8ppb3ya\overlay\Lib\site-packages\numpy\__init__.py", line 305, in <module>
        _win_os_check()
      File "C:\Users\john\AppData\Local\Temp\pip-build-env-j8ppb3ya\overlay\Lib\site-packages\numpy\__init__.py", line 302, in _win_os_check
        raise RuntimeError(msg.format(__file__)) from None
    RuntimeError: The current Numpy installation ('C:\\Users\\john\\AppData\\Local\\Temp\\pip-build-env-j8ppb3ya\\overlay\\Lib\\site-packages\\numpy\\__init__.py') fails to pass a sanity check due to a bug in the windows runtime. See this issue for more information: https://developercommunity.visualstudio.com/content/problem/1207405/fmod-after-an-update-to-windows-2004-is-causing-a.html
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\john\anaconda3\python.exe' 'C:\Users\john\anaconda3\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\john\AppData\Local\Temp\tmp9owx0jay' Check the logs for full command output.

Solution

  • Install cvxpy from conda-forge

    conda install -c conda-forge cvxpy