X-DataInitiative / tick

Module for statistical learning, with a particular emphasis on time-dependent modelling
https://x-datainitiative.github.io/tick/
BSD 3-Clause "New" or "Revised" License
480 stars 105 forks source link

from .build import array #492

Closed claudio-ICL closed 1 year ago

claudio-ICL commented 1 year ago

I am installing tick on Ubuntu 22.04 with pip install tick. Installation was successful (but it required swig). Unfortunately, importing from tick.hawkes does not seem to work, because in the __init__ of tick.array we try to import array from .build and this is not found. Please see attached. Could you please adise how to resolve the issue?

error.txt

PhilipDeegan commented 1 year ago

Hey @claudio-ICL

the error you're getting seems to be

_array.cpython-39-x86_64-linux-gnu.so: undefined symbol: _ZSt28__throw_bad_array_new_lengthv

If you have swig installed on your system you can try building it from source, which possibly will resolve your linking issue (I can't really say for certain sadly)

you can try building from source like this

git clone https://github.com/X-DataInitiative/tick
cd tick
python3 setup.py build_ext --inplace

I should add if you're using python3.10 or higher you might have an issue which is resolved in an open PR

claudio-ICL commented 1 year ago

Hi @PhilipDeegan

Thanks for helping!

I am indeed trying to build from source. I do have SWIG and I am using Python 3.6.

Re-building with python setup.py build_ext --inplace gives: Error executing check_mkl.py - mkl not found running build_ext copying build/lib.linux-x86_64-3.6/tick/array/build/_array.cpython-36m-x86_64-linux-gnu.so -> tick/array/build copying build/lib.linux-x86_64-3.6/tick/base/build/_base.cpython-36m-x86_64-linux-gnu.so -> tick/base/build copying build/lib.linux-x86_64-3.6/tick/array_test/build/_array_test.cpython-36m-x86_64-linux-gnu.so -> tick/array_test/build copying build/lib.linux-x86_64-3.6/tick/random/build/_crandom.cpython-36m-x86_64-linux-gnu.so -> tick/random/build copying build/lib.linux-x86_64-3.6/tick/base_model/build/_base_model.cpython-36m-x86_64-linux-gnu.so -> tick/base_model/build copying build/lib.linux-x86_64-3.6/tick/linear_model/build/_linear_model.cpython-36m-x86_64-linux-gnu.so -> tick/linear_model/build copying build/lib.linux-x86_64-3.6/tick/hawkes/simulation/build/_hawkes_simulation.cpython-36m-x86_64-linux-gnu.so -> tick/hawkes/simulation/build copying build/lib.linux-x86_64-3.6/tick/hawkes/model/build/_hawkes_model.cpython-36m-x86_64-linux-gnu.so -> tick/hawkes/model/build copying build/lib.linux-x86_64-3.6/tick/hawkes/inference/build/_hawkes_inference.cpython-36m-x86_64-linux-gnu.so -> tick/hawkes/inference/build copying build/lib.linux-x86_64-3.6/tick/prox/build/_prox.cpython-36m-x86_64-linux-gnu.so -> tick/prox/build copying build/lib.linux-x86_64-3.6/tick/preprocessing/build/_preprocessing.cpython-36m-x86_64-linux-gnu.so -> tick/preprocessing/build copying build/lib.linux-x86_64-3.6/tick/robust/build/_robust.cpython-36m-x86_64-linux-gnu.so -> tick/robust/build copying build/lib.linux-x86_64-3.6/tick/survival/build/_survival.cpython-36m-x86_64-linux-gnu.so -> tick/survival/build copying build/lib.linux-x86_64-3.6/tick/solver/build/_solver.cpython-36m-x86_64-linux-gnu.so -> tick/solver/build

It seems that the check for mkl fails. Can this be the reason? Can you help with that?

PhilipDeegan commented 1 year ago

The MKL error is ignorable I think, you seem to have all the libraries built

PhilipDeegan commented 1 year ago

cereal is a submodule in the repo

you can get it with

git submodule update --init

alternatively you can get things like this when cloning with

git clone $URL --recursive

claudio-ICL commented 1 year ago

Thanks @PhilipDeegan! All solved now :)

claudio-ICL commented 1 year ago

To sum up,

This is what worked on my Ubuntu 22.04.1 LTS, where the yml file file is attached: tick.yml.txt

  1. git clone git@github.com:X-DataInitiative/tick.git

  2. This is required for cereal!

    git submodule update --init

  3. conda env create -f ./tick.yml

  4. conda develop -n tick .

  5. conda activate tick

  6. sudo apt-get install swig

  7. sudo apt-get install -y autotools-dev automake gawk bison flex

  8. Test: python -c "import dill;"

  9. python setup.py build_ext --inplace

  10. Test: python -c "import tick;"

I believe we can close this issue.