pmorissette / bt

bt - flexible backtesting for Python
http://pmorissette.github.io/bt
MIT License
2.29k stars 430 forks source link

Installation error on Windows 11 with Python 3.11.2: fatal error C1083: Cannot open include file: 'longintrepr.h': No such file or directory #408

Closed jlchereau closed 1 year ago

jlchereau commented 1 year ago

pip3 install bt raises the following error:

Collecting bt
  Downloading bt-0.2.9.tar.gz (2.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.7/2.7 MB 25.0 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting ffn>=0.3.5
  Downloading ffn-0.3.6-py2.py3-none-any.whl (25 kB)
Collecting pyprind>=2.11
  Downloading PyPrind-2.11.3-py2.py3-none-any.whl (8.4 kB)
Requirement already satisfied: decorator>=4 in c:\users\xxxxx\appdata\roaming\python\python311\site-packages (from ffn>=0.3.5->bt) (5.1.1)
Collecting future>=0.15
  Downloading future-0.18.3.tar.gz (840 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 840.9/840.9 kB 51.9 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Requirement already satisfied: matplotlib>=1 in c:\users\xxxxx\appdata\local\programs\python\python311\lib\site-packages (from ffn>=0.3.5->bt) (3.7.1)
Requirement already satisfied: numpy>=1.5 in c:\users\xxxxx\appdata\local\programs\python\python311\lib\site-packages (from ffn>=0.3.5->bt) (1.24.2)
Requirement already satisfied: pandas>=0.19 in c:\users\xxxxx\appdata\local\programs\python\python311\lib\site-packages (from ffn>=0.3.5->bt) (1.5.3)
Collecting pandas-datareader>=0.2
  Downloading pandas_datareader-0.10.0-py3-none-any.whl (109 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 109.5/109.5 kB ? eta 0:00:00
Requirement already satisfied: scikit-learn>=0.15 in c:\users\xxxxx\appdata\local\programs\python\python311\lib\site-packages (from ffn>=0.3.5->bt) (1.2.1)
Requirement already satisfied: scipy>=0.15 in c:\users\xxxxx\appdata\local\programs\python\python311\lib\site-packages (from ffn>=0.3.5->bt) (1.10.0)
Collecting tabulate>=0.7.5
  Downloading tabulate-0.9.0-py3-none-any.whl (35 kB)
Requirement already satisfied: contourpy>=1.0.1 in c:\users\xxxxx\appdata\local\programs\python\python311\lib\site-packages (from matplotlib>=1->ffn>=0.3.5->bt) (1.0.7)
Requirement already satisfied: cycler>=0.10 in c:\users\xxxxx\appdata\local\programs\python\python311\lib\site-packages (from matplotlib>=1->ffn>=0.3.5->bt) (0.11.0)
Requirement already satisfied: fonttools>=4.22.0 in c:\users\xxxxx\appdata\local\programs\python\python311\lib\site-packages (from matplotlib>=1->ffn>=0.3.5->bt) (4.38.0)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\xxxxx\appdata\local\programs\python\python311\lib\site-packages (from matplotlib>=1->ffn>=0.3.5->bt) (1.4.4)
Requirement already satisfied: packaging>=20.0 in c:\users\xxxxx\appdata\roaming\python\python311\site-packages (from matplotlib>=1->ffn>=0.3.5->bt) (23.0)
Requirement already satisfied: pillow>=6.2.0 in c:\users\xxxxx\appdata\local\programs\python\python311\lib\site-packages (from matplotlib>=1->ffn>=0.3.5->bt) (9.4.0)
Requirement already satisfied: pyparsing>=2.3.1 in c:\users\xxxxx\appdata\local\programs\python\python311\lib\site-packages (from matplotlib>=1->ffn>=0.3.5->bt) (3.0.9)
Requirement already satisfied: python-dateutil>=2.7 in c:\users\xxxxx\appdata\roaming\python\python311\site-packages (from matplotlib>=1->ffn>=0.3.5->bt) (2.8.2)
Requirement already satisfied: pytz>=2020.1 in c:\users\xxxxx\appdata\local\programs\python\python311\lib\site-packages (from pandas>=0.19->ffn>=0.3.5->bt) (2022.7.1)
Requirement already satisfied: lxml in c:\users\xxxxx\appdata\local\programs\python\python311\lib\site-packages (from pandas-datareader>=0.2->ffn>=0.3.5->bt) (4.9.2)
Requirement already satisfied: requests>=2.19.0 in c:\users\xxxxx\appdata\local\programs\python\python311\lib\site-packages (from pandas-datareader>=0.2->ffn>=0.3.5->bt) (2.28.2)
Requirement already satisfied: joblib>=1.1.1 in c:\users\xxxxx\appdata\local\programs\python\python311\lib\site-packages (from scikit-learn>=0.15->ffn>=0.3.5->bt) (1.2.0)
Requirement already satisfied: threadpoolctl>=2.0.0 in c:\users\xxxxx\appdata\local\programs\python\python311\lib\site-packages (from scikit-learn>=0.15->ffn>=0.3.5->bt) (3.1.0)
Requirement already satisfied: six>=1.5 in c:\users\xxxxx\appdata\roaming\python\python311\site-packages (from python-dateutil>=2.7->matplotlib>=1->ffn>=0.3.5->bt) (1.16.0)
Requirement already satisfied: charset-normalizer<4,>=2 in c:\users\xxxxx\appdata\local\programs\python\python311\lib\site-packages (from requests>=2.19.0->pandas-datareader>=0.2->ffn>=0.3.5->bt) (3.0.1)
Requirement already satisfied: idna<4,>=2.5 in c:\users\xxxxx\appdata\local\programs\python\python311\lib\site-packages (from requests>=2.19.0->pandas-datareader>=0.2->ffn>=0.3.5->bt) (3.4)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\xxxxx\appdata\local\programs\python\python311\lib\site-packages (from requests>=2.19.0->pandas-datareader>=0.2->ffn>=0.3.5->bt) (1.26.14)  
Requirement already satisfied: certifi>=2017.4.17 in c:\users\xxxxx\appdata\local\programs\python\python311\lib\site-packages (from requests>=2.19.0->pandas-datareader>=0.2->ffn>=0.3.5->bt) (2022.12.7)   
Building wheels for collected packages: bt
  Building wheel for bt (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for bt (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [19 lines of output]
      running bdist_wheel
      creating build\lib.win-amd64-cpython-311
      creating build\lib.win-amd64-cpython-311\bt
      copying bt\algos.py -> build\lib.win-amd64-cpython-311\bt
      copying bt\backtest.py -> build\lib.win-amd64-cpython-311\bt
      copying bt\core.py -> build\lib.win-amd64-cpython-311\bt
      copying bt\__init__.py -> build\lib.win-amd64-cpython-311\bt
      creating build\lib.win-amd64-cpython-311
      creating build\lib.win-amd64-cpython-311\bt
      copying bt\algos.py -> build\lib.win-amd64-cpython-311\bt
      copying bt\backtest.py -> build\lib.win-amd64-cpython-311\bt
      copying bt\core.py -> build\lib.win-amd64-cpython-311\bt
      copying bt\__init__.py -> build\lib.win-amd64-cpython-311\bt      running build_ext      building 'bt.core' extension      creating build\temp.win-amd64-cpython-311      creating build\temp.win-amd64-cpython-311\Release      creating build\temp.win-amd64-cpython-311\Release\bt      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\xxxxx\AppData\Local\Programs\Python\Python311\include -IC:\Users\xxxxx\AppData\Local\Programs\Python\Python311\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.35.32215\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" /Tcbt/core.c /Fobuild\temp.win-amd64-cpython-311\Release\bt/core.obj   
      core.c
      bt/core.c(210): fatal error C1083: Cannot open include file: 'longintrepr.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.35.32215\\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 bt
Failed to build bt
ERROR: Could not build wheels for bt, which is required to install pyproject.toml-based projects
jlchereau commented 1 year ago

Install works fine with Python 3.10.10 in the same environment.

timkpaine commented 1 year ago

https://github.com/cython/cython/pull/4428

timkpaine commented 1 year ago

the changes are included in https://github.com/pmorissette/bt/pull/392

renanmoretto commented 1 year ago

I'm having the same problem

...
      core.c
      bt/core.c(210): fatal error C1083: Cannot open include file: 'longintrepr.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.35.32215\\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 bt
Failed to build bt
ERROR: Could not build wheels for bt, which is required to install pyproject.toml-based projects

python 3.11, cython 0.29.34