heal-research / pyoperon

Python bindings and scikit-learn interface for the Operon library for symbolic regression.
MIT License
34 stars 10 forks source link

`double free or corruption (out)` #11

Closed romanovzky closed 4 months ago

romanovzky commented 5 months ago

Hi there,

I get double free or corruption (out) every time I run pyoperon installed using wheels from the actions page. I don't get this error using the released packaged here on github, but that one is considerably outdated.

I've tried on two different linux machines (CentOS7 and arch-based Endeavour OS), with different python versions (3.9 and 3.11).

Any way I can help debug further?

Best, M

PS: I can't access any artefact on the actions page older than November as they have expired.

foolnotion commented 4 months ago

Hi,

Could you share a small snippet of code to help reproduce this issue? What CPU are you running it on?

Also, is it possible to try building it yourself? For example,

micromamba env create -f environment.yml
micromamba activate pyoperon

export CC=clang
export CXX=clang++
bash script/dependencies.sh # install dependencies
python setup.py bdist_wheel -- --preset build-linux # build the wheel
romanovzky commented 4 months ago

Hi there,

The code is simple

from pyoperon.sklearn import SymbolicRegressor

so it has to do with the libraries and maybe compiler versions? I've tried on two different linux machines. One is an HPC workstation (CentOS7) with Intel Xeon Gold 5220, the other is my laptop (Endeavour up-to-date) with Ryzen 7 6800H. Both with very different environments.

I'm not using anaconda, could it be the issue? I'm trying to run the code on an HPC cluster without conda, and in general I don't use conda as it's a pain to transfer code across machines without it.

The problem does not occur with the wheels provided in the releases page of the repository.

I'll try to compile according to the instructions and get back with the result.

foolnotion commented 4 months ago

I am fairly certain this is a problem with conflicting assumptions about memory alignment (presumably because of a difference in compile flags) between our dll and one of its dependencies (probably operon itself).

I've always tested under conda or nix and have not encountered this issue.

I made a small change to the CI, can you try the new wheels? We are using x86-64-v3 on linux, which should be widely supported.

romanovzky commented 4 months ago

I've tried the new wheels (I hadn't had the time to try to compile from scratch yet) I get a new error, which seems unrelated to the previous one

$ python run.py                                          
Traceback (most recent call last):
  File "/home/mcromao/tmp/pyoperon-version-test/run.py", line 7, in <module>
    from pyoperon.sklearn import SymbolicRegressor
  File "/home/mcromao/tmp/pyoperon-version-test/venv/lib/python3.11/site-packages/pyoperon/__init__.py", line 4, in <module>
    from .pyoperon import *
ImportError: generic_type: cannot initialize type "GaussianLikelihoodEvaluator": an object with that name is already defined
foolnotion commented 4 months ago

Sorry, that was just a typo in the source code, fixed now. Can you try the latest wheel?

romanovzky commented 4 months ago

Hi again,

It seems like that was not the only case!

$ python run.py                                          
Traceback (most recent call last):
  File "/home/mcromao/tmp/pyoperon-version-test/run.py", line 7, in <module>
    from pyoperon.sklearn import SymbolicRegressor
  File "/home/mcromao/tmp/pyoperon-version-test/venv/lib/python3.11/site-packages/pyoperon/__init__.py", line 4, in <module>
    from .pyoperon import *
ImportError: generic_type: type "PoissonLikelihoodEvaluator" is already registered!
foolnotion commented 4 months ago

Should be fixed now in 7bab9701bea64438cb87e3c867dd2f8cca3bc09d, thanks for the patience.

romanovzky commented 4 months ago

It's running! Nothing to apologise for, thank YOU for the patience :)