kcleal / pywfa

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

issue with ubuntu 20 installation #3

Closed wongs2 closed 1 year ago

wongs2 commented 2 years ago

Anyone has issue with ubuntu 20.04 installation with pip. Python version 3.8.

The error running the test case after installation:

~/.local/lib/python3.8/site-packages/pywfa/tests$ python3 test.py Traceback (most recent call last): File "test.py", line 7, in from pywfa.align import WavefrontAligner, clip_cigartuples, cigartuples_to_str, elide_mismatches_from_cigar File "/home/ice/.local/lib/python3.8/site-packages/pywfa/init.py", line 2, in from .align import WavefrontAligner, clip_cigartuples, cigartuples_to_str, elide_mismatches_from_cigar ImportError: /home/ice/.local/lib/python3.8/site-packages/pywfa/align.cpython-38-x86_64-linux-gnu.so: undefined symbol: wavefront_align

kcleal commented 2 years ago

Hi @wongs2, Did you install from source or download from pypi? Thanks

wongs2 commented 2 years ago

from pypi. Installing from source has issue with the wfa2-lib, I think it failed to create the libwfa.a file.

Installing from source gives error, here is some part of the message:

      cc -c /tmp/tmpcx3_y5j9.c -o tmp/tmpcx3_y5j9.o -fopenmp
      building 'pywfa.align' extension
      x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I. -I/home/ice/pywfa -I/home/ice/pywfa/pywfa/WFA2_lib -I/home/ice/pywfa/pywfa/WFA2_lib/lib -I/home/ice/pywfa/pywfa/WFA2_lib/utils -I/home/ice/pywfa/pywfa/WFA2_lib/wavefront -I/home/ice/pywfa/pywfa/WFA2_lib/bindings/cpp -I/home/ice/pywfa/pywfa/WFA2_lib/system -I/home/ice/pywfa/pywfa/WFA2_lib/alignment -I/home/ice/pywfa/pywfa -I/usr/include/python3.8 -c pywfa/align.c -o build/temp.linux-x86_64-3.8/pywfa/align.o -Wno-unused-function -Wno-unused-result -Wno-ignored-qualifiers -Wno-deprecated-declarations
      warning: no library file corresponding to '/home/ice/pywfa/pywfa/WFA2_lib/lib' found (skipping)
      x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2 -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.8/pywfa/align.o /home/ice/pywfa/pywfa/WFA2_lib/lib/libwfa.a -L/home/ice/pywfa/pywfa/WFA2_lib/lib -o build/lib.linux-x86_64-3.8/pywfa/align.cpython-38-x86_64-linux-gnu.so
      x86_64-linux-gnu-gcc: error: /home/ice/pywfa/pywfa/WFA2_lib/lib/libwfa.a: No such file or directory
      error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pywfa
  Running setup.py clean for pywfa
Failed to build pywfa
Installing collected packages: pywfa
  Running setup.py install for pywfa ... error
  error: subprocess-exited-with-error

  �~W Running setup.py install for pywfa did not run successfully.
  �~T~B exit code: 1
  �~U��~T~@> [130 lines of output]
      Libs ['/home/ice/pywfa/pywfa/WFA2_lib/lib']
      Library dirs ['/home/ice/pywfa/pywfa/WFA2_lib/lib']
Midnighter commented 1 year ago

I get the same error, also Python 3.8 on ubuntu 20.04 installing the 0.3.0 wheel from PyPI.

Midnighter commented 1 year ago

Building pywfa from the source distribution on PyPI succeeds but then leads to the same error. I will try checking out the repo next.

Midnighter commented 1 year ago

Okay, I installed from the repo. First I ran into the same error as above where pywfa/WFA2_lib/lib/libwfa.a doesn't exist. So I built that manually using the make command from setup.py. After that installation succeeds and I can import the package without error.

kcleal commented 1 year ago

Thanks for sharing how you solved this. I think i should try and get pywfa on conda which might fix this problem

tobiasmarschall commented 1 year ago

Thanks for making this package. FWIW, I observed the same error when trying to install pywfa using pip, which I installed into a conda environment (versions below). Getting pywfa up on bioconda would be wonderful.

$ conda env export
name: pywfa
channels:
  - conda-forge
  - bioconda
  - defaults
dependencies:
  - _libgcc_mutex=0.1=conda_forge
  - _openmp_mutex=4.5=2_gnu
  - bzip2=1.0.8=h7f98852_4
  - ca-certificates=2022.12.7=ha878542_0
  - cython=0.29.33=py311hcafe171_0
  - ld_impl_linux-64=2.40=h41732ed_0
  - libffi=3.4.2=h7f98852_5
  - libgcc-ng=12.2.0=h65d4601_19
  - libgomp=12.2.0=h65d4601_19
  - libnsl=2.0.0=h7f98852_0
  - libsqlite=3.40.0=h753d276_0
  - libstdcxx-ng=12.2.0=h46fd767_19
  - libuuid=2.32.1=h7f98852_1000
  - libzlib=1.2.13=h166bdaf_4
  - ncurses=6.3=h27087fc_1
  - openssl=3.0.8=h0b41bf4_0
  - pip=23.0.1=pyhd8ed1ab_0
  - python=3.11.0=he550d4f_1_cpython
  - python_abi=3.11=3_cp311
  - readline=8.1.2=h0f457ee_0
  - setuptools=67.6.0=pyhd8ed1ab_0
  - tk=8.6.12=h27826a3_0
  - tzdata=2022g=h191b570_0
  - wheel=0.40.0=pyhd8ed1ab_0
  - xz=5.2.6=h166bdaf_0
  - pip:
    - pywfa==0.4.1
prefix: /home/tobi/miniconda3/envs/pywfa
kcleal commented 1 year ago

Thanks @tobiasmarschall, I will try and get this on conda soon.

kcleal commented 1 year ago

pywfa is now on conda I believe. https://anaconda.org/bioconda/pywfa

Closing this for now.

tobiasmarschall commented 1 year ago

Thanks, much appreciated. I just successfully used the Bioconda version.