robertmartin8 / PyPortfolioOpt

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

Error installing on Windows 10 #415

Closed TheoTheTank closed 2 years ago

TheoTheTank commented 2 years ago

I tried to install PyPortfolioOpt using pip install pyportfolioopt Also tried to install PyPortfolio manually. But I have a problem installing gdldl.

Error message

Collecting qdldl
  Using cached qdldl-0.1.5.post0.tar.gz (69 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: six>=1.5 in c:\users\leomi\appdata\local\programs\python\python310\lib\site-packages (from python-dateutil>=2.8.1->pandas>=0.19->PyPortfolioOpt) (1.16.0)
Building wheels for collected packages: qdldl
  Building wheel for qdldl (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [48 lines of output]
      running bdist_wheel
      running build
      running build_ext
      -- Selecting Windows SDK version  to target Windows 10.0.19043.
      CMake Error at CMakeLists.txt:4 (project):
        Failed to run MSBuild command:

          MSBuild.exe

        to get the value of VCTargetsPath:

          Microsoft (R) Build Engine version 4.8.4084.0
          [Microsoft .NET Framework, version 4.0.30319.42000]
          Copyright (C) Microsoft Corporation. All rights reserved.

          Der Buildvorgang wurde am 04.02.2022 20:35:59 gestartet.
          Projekt "C:\Users\LeoMi\AppData\Local\Temp\pip-install-3retqlk1\qdldl_ecf2dd5d81ad423b9e7153197bc54575\c\build\CMakeFiles\3.22.2\VCTargetsPath.vcxproj" auf Knoten "1" (Standardziele).
          C:\Users\LeoMi\AppData\Local\Temp\pip-install-3retqlk1\qdldl_ecf2dd5d81ad423b9e7153197bc54575\c\build\CMakeFiles\3.22.2\VCTargetsPath.vcxproj(14,2): error MSB4019: Das importierte Projekt "C:\Microsoft.Cpp.Default.props" wurde nicht gefunden. Vergewissern Sie sich, dass der Pfad in der <Import>-Deklaration korrekt und die Datei auf dem Datenträger vorhanden ist.
          Die Erstellung des Projekts "C:\Users\LeoMi\AppData\Local\Temp\pip-install-3retqlk1\qdldl_ecf2dd5d81ad423b9e7153197bc54575\c\build\CMakeFiles\3.22.2\VCTargetsPath.vcxproj" ist abgeschlossen (Standardziele) -- FEHLER.

          Fehler beim Buildvorgang.

          "C:\Users\LeoMi\AppData\Local\Temp\pip-install-3retqlk1\qdldl_ecf2dd5d81ad423b9e7153197bc54575\c\build\CMakeFiles\3.22.2\VCTargetsPath.vcxproj" (Standardziel) (1) ->
            C:\Users\LeoMi\AppData\Local\Temp\pip-install-3retqlk1\qdldl_ecf2dd5d81ad423b9e7153197bc54575\c\build\CMakeFiles\3.22.2\VCTargetsPath.vcxproj(14,2): error MSB4019: Das importierte Projekt "C:\Microsoft.Cpp.Default.props" wurde nicht gefunden. Vergewissern Sie sich, dass der Pfad in der <Import>-Deklaration korrekt und die Datei auf dem Datenträger vorhanden ist.

              0 Warnung(en)
              1 Fehler

          Verstrichene Zeit 00:00:00.24

        Exit code: 1

      -- Configuring incomplete, errors occurred!
      See also "C:/Users/LeoMi/AppData/Local/Temp/pip-install-3retqlk1/qdldl_ecf2dd5d81ad423b9e7153197bc54575/c/build/CMakeFiles/CMakeOutput.log".
      Microsoft (R) Build Engine version 4.8.4084.0
      [Microsoft .NET Framework, version 4.0.30319.42000]
      Copyright (C) Microsoft Corporation. All rights reserved.

      MSBUILD : error MSB1009: Project file does not exist.
      Switch: qdldlamd.vcxproj
      building 'qdldl' extension
      cl : Befehlszeile warning D9002 : Unbekannte Option "-std=c++11" wird ignoriert.
      qdldl.cpp
      c\qdldl/include/qdldl.h(5): fatal error C1083: Datei (Include) kann nicht ge”ffnet werden: "qdldl_types.h": No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [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: qdldl, ecos, osqp, cvxpy, PyPortfolioOpt
  Running setup.py install for qdldl ... error
  error: subprocess-exited-with-error

  × Running setup.py install for qdldl did not run successfully.
  │ exit code: 1
  ╰─> [50 lines of output]
      running install
      C:\Users\LeoMi\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_ext
      -- Selecting Windows SDK version  to target Windows 10.0.19043.
      CMake Error at CMakeLists.txt:4 (project):
        Failed to run MSBuild command:

          MSBuild.exe

        to get the value of VCTargetsPath:

          Microsoft (R) Build Engine version 4.8.4084.0
          [Microsoft .NET Framework, version 4.0.30319.42000]
          Copyright (C) Microsoft Corporation. All rights reserved.

          Der Buildvorgang wurde am 04.02.2022 20:36:05 gestartet.
          Projekt "C:\Users\LeoMi\AppData\Local\Temp\pip-install-3retqlk1\qdldl_ecf2dd5d81ad423b9e7153197bc54575\c\build\CMakeFiles\3.22.2\VCTargetsPath.vcxproj" auf Knoten "1" (Standardziele).
          C:\Users\LeoMi\AppData\Local\Temp\pip-install-3retqlk1\qdldl_ecf2dd5d81ad423b9e7153197bc54575\c\build\CMakeFiles\3.22.2\VCTargetsPath.vcxproj(14,2): error MSB4019: Das importierte Projekt "C:\Microsoft.Cpp.Default.props" wurde nicht gefunden. Vergewissern Sie sich, dass der Pfad in der <Import>-Deklaration korrekt und die Datei auf dem Datenträger vorhanden ist.
          Die Erstellung des Projekts "C:\Users\LeoMi\AppData\Local\Temp\pip-install-3retqlk1\qdldl_ecf2dd5d81ad423b9e7153197bc54575\c\build\CMakeFiles\3.22.2\VCTargetsPath.vcxproj" ist abgeschlossen (Standardziele) -- FEHLER.

          Fehler beim Buildvorgang.

          "C:\Users\LeoMi\AppData\Local\Temp\pip-install-3retqlk1\qdldl_ecf2dd5d81ad423b9e7153197bc54575\c\build\CMakeFiles\3.22.2\VCTargetsPath.vcxproj" (Standardziel) (1) ->
            C:\Users\LeoMi\AppData\Local\Temp\pip-install-3retqlk1\qdldl_ecf2dd5d81ad423b9e7153197bc54575\c\build\CMakeFiles\3.22.2\VCTargetsPath.vcxproj(14,2): error MSB4019: Das importierte Projekt "C:\Microsoft.Cpp.Default.props" wurde nicht gefunden. Vergewissern Sie sich, dass der Pfad in der <Import>-Deklaration korrekt und die Datei auf dem Datenträger vorhanden ist.

              0 Warnung(en)
              1 Fehler

          Verstrichene Zeit 00:00:00.23

        Exit code: 1

      -- Configuring incomplete, errors occurred!
      See also "C:/Users/LeoMi/AppData/Local/Temp/pip-install-3retqlk1/qdldl_ecf2dd5d81ad423b9e7153197bc54575/c/build/CMakeFiles/CMakeOutput.log".
      Microsoft (R) Build Engine version 4.8.4084.0
      [Microsoft .NET Framework, version 4.0.30319.42000]
      Copyright (C) Microsoft Corporation. All rights reserved.

      MSBUILD : error MSB1009: Project file does not exist.
      Switch: qdldlamd.vcxproj
      building 'qdldl' extension
      cl : Befehlszeile warning D9002 : Unbekannte Option "-std=c++11" wird ignoriert.
      qdldl.cpp
      c\qdldl/include/qdldl.h(5): fatal error C1083: Datei (Include) kann nicht ge”ffnet werden: "qdldl_types.h": No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]
phschiele commented 2 years ago

@TheoTheTank Which Python version are you on? There was a similar issue posted on Python 3.10 here that might help you: https://github.com/cvxpy/cvxpy/issues/1625

TheoTheTank commented 2 years ago

I am on Python 3.10. Already tried this. But still not able to install pyportfolioopt because of the problems with gdldl which seems to be necessary for pyportfolioopt.

phschiele commented 2 years ago

Are you installing using pip? In that case, you can try

pip install cvxpy-base numpy pandas scipy ecos scs
pip install pyportfolioopt --no-dependencies
TheoTheTank commented 2 years ago

@phschiele Thanks a lot, seems to have done the Job. Already tried some functions and seems to work correctly.