kcleal / pywfa

Python wrapper for wavefront alignment using WFA2-lib
MIT License
35 stars 3 forks source link

Illegal instruction: 4 #7

Open asylvz opened 1 year ago

asylvz commented 1 year ago

Thanks for this tool, however I have some issues in using this. First I tried

pip install pywfa and I successfully imported the package but when I called a = WavefrontAligner(pattern), I get "Illegal instruction: 4" error.

Then I tried building from source, which failed too. I tried to compile from setup.py, which also failed somewhere with this error: ....

gcc-12 -Wall -g -fPIC -O3 -march=native  -DWFA_PARALLEL -fopenmp -I.. -c wavefront.c -o ../build/wavefront.o
make[2]: Leaving directory '/Users/asoylev/Programs/pywfa/pywfa/WFA2_lib/wavefront'
make --directory=bindings/cpp all
make[2]: Entering directory '/Users/asoylev/Programs/pywfa/pywfa/WFA2_lib'
make[2]: *** bindings/cpp: No such file or directory.  Stop.
make[2]: Leaving directory '/Users/asoylev/Programs/pywfa/pywfa/WFA2_lib'
make[1]: *** [Makefile:93: bindings/cpp] Error 2
make[1]: Leaving directory '/Users/asoylev/Programs/pywfa/pywfa/WFA2_lib'

With conda, I get the following error:

conda install -c bioconda pywfa
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: \ 
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
failed                                                                                                            

UnsatisfiableError:

Note that I'm using mac m1. But I tried conda installation with ubuntu and got the same error.

Thank you

kcleal commented 1 year ago

Hi @asylvz, I think the setup.py error might be happening because an environment variable is not getting set properly during the build. BUILD_MINIMAL=1 should be set which avoids building the bindings directory. This is normally taken care of in the setup with the Build_ext_first class. You can try manually building WFA2lib before running setup.py:

cd pywfa/WFA2_lib; make clean all BUILD_WFA_PARALLEL=0 BUILD_MINIMAL=1; cd ../../
pip install .
asylvz commented 1 year ago

This worked, thank you so much

hugifl commented 2 months ago

I have the same issue (Illegal instruction: 4) when calling WavefrontAligner() using Mac M1. For me the installation works using pip, conda or from source (I used the Build_Minimal = 1 trick) but no matter how I do it, I run into the Illegal instruction 4 error. I also tried running the Terminal in Rosetta mode but that didn't help.

kcleal commented 2 months ago

Hi @asylvz, Does it work if you compile from source?

asylvz commented 2 months ago

No, as far as I remember. I used conda.