abbass2 / pyqstrat

A fast, extensible, transparent python library for backtesting quantitative strategies.
BSD 3-Clause "New" or "Revised" License
353 stars 57 forks source link

pyqstrat compilation/installation fails #19

Closed SamoPP closed 3 years ago

SamoPP commented 3 years ago

pyqstrat compilation/installation using pip install pyqstrat fails with the following error although libhdf5-dev is installed on Ubuntu 20.04.1 LTS and Python version is 3.8.

In file included from pyqstrat/cpp/tests.cpp:4:
    pyqstrat/cpp/hdf5_writer.hpp:8:10: fatal error: H5Cpp.h: No such file or directory
        8 | #include <H5Cpp.h>
          |          ^~~~~~~~~
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

EDIT: Some progress... I have added export CPATH=/usr/include/hdf5/serial/ before running pip install pyqstrat

$ export CPATH=/usr/include/hdf5/serial/
$ pip install pyqstrat

And now the error is

    /usr/bin/ld: cannot find -lhdf5
    collect2: error: ld returned 1 exit status
    error: command 'x86_64-linux-gnu-g++' failed with exit status 1

So I guess I need to go down this rabbit hole here https://github.com/ros-industrial-consortium/reuleaux/issues/41#issuecomment-541413209 while it looks like the real solution is https://github.com/ros-industrial-consortium/reuleaux/issues/41#issuecomment-557017517

Will report on the progress.

EDIT 2: I successfully built pyqstrat on Ubuntu (without Conda since Conda breaks all sorts of things):

Successfully built pyqstrat
Installing collected packages: pyqstrat
Successfully installed pyqstrat-0.3.13

by doing:

$ export CPATH=/usr/include/hdf5/serial/
$ sudo cp /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so /usr/lib
$ pip install pyqstrat
uaruss commented 3 years ago

Did you install hdf5 in the appropriate 'environment'?

I'm new to python and running in Windows, but Anaconda worked well for me after a bit of experimentation. I'm now editing code in VSCode, after launching in Anaconda and selecting the appropriate environment.

Below is what I did to get it going:

Now, pyqstrat and all the necessary supporting packages should be installed.

I know you aren't a fan of Anaconda, but it might not be bad to reconsider.

Good luck!

SamoPP commented 3 years ago

Thanks for information.

i am avoiding Anaconda as a plague. Since a couple of times installed/changed several crucial libraries on my Ubuntu machine which are crucial for many R packages to work. And it was a nightmare to debug...

Anyway, I got it working without Anaconda as noted above and I will leave it here for people like myself whoa don't want to use Anaconda but would love to use pyqstrat.