convexfi / riskparity.py

Fast and scalable construction of risk parity portfolios
https://mirca.github.io/riskparity.py/
MIT License
287 stars 65 forks source link

[bug] python installation #27

Closed edwardsun closed 8 months ago

edwardsun commented 8 months ago

Problem description

It would be great to support latest python >3.10 When doing "pip3 install riskparityportfolio" in python >= 3.11 in ubuntu (i.e. docker image = python:3.11-slim), there is a compilation error: error: subprocess-exited-with-error

    × Building wheel for quadprog (pyproject.toml) did not run successfully.
    │ exit code: 1
    ╰─> [15 lines of output]
        running bdist_wheel
        running build
        running build_ext
        building 'quadprog' extension
        creating build
        creating build/temp.linux-x86_64-cpython-312
        creating build/temp.linux-x86_64-cpython-312/quadprog
        gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -I/usr/local/include/python3.12 -c quadprog/linear-algebra.c -o build/temp.linux-x86_64-cpython-312/quadprog/linear-algebra.o
        gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -I/usr/local/include/python3.12 -c quadprog/qr-update.c -o build/temp.linux-x86_64-cpython-312/quadprog/qr-update.o
        gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -I/usr/local/include/python3.12 -c quadprog/quadprog.c -o build/temp.linux-x86_64-cpython-312/quadprog/quadprog.o
        quadprog/quadprog.c:198:12: fatal error: longintrepr.h: No such file or directory
          198 |   #include "longintrepr.h"
              |            ^~~~~~~~~~~~~~~
        compilation terminated.
        error: command '/usr/bin/gcc' failed with exit code 1
        [end of output]

The issue does not exist in python 3.10

Environment:

Biszu commented 8 months ago

It's been resolved less than an hour ago by quadprog@0.1.12 (https://github.com/quadprog/quadprog/issues/41#issuecomment-1957873718). After adding this version to project dependencies, riskparityportfolio installs fine — tried with Python 3.11.