pysam-developers / pysam

Pysam is a Python package for reading, manipulating, and writing genomics data such as SAM/BAM/CRAM and VCF/BCF files. It's a lightweight wrapper of the HTSlib API, the same one that powers samtools, bcftools, and tabix.
https://pysam.readthedocs.io/en/latest/
MIT License
774 stars 274 forks source link

pysam build fails for python 3.11 + macOS 12.6.7 #1205

Closed tedil closed 1 year ago

tedil commented 1 year ago

(This is on a github action runner) When installing dependencies in our testing environments, the build for pysam 0.21.0 fails for macOS 12.6.7 with python 3.11, but succeeds for python 3.10, as well as for python 3.11 with an Ubuntu 22.04.2 image.

Even though it finds lzma.h, configure reports that no liblzma development files are found:

  python -m pip install --upgrade pip
  python -m pip install poetry black flake8
  poetry install --no-interaction
  [...]
  # pysam: cython is available - using cythonize if necessary
  # pysam: htslib mode is shared
  # pysam: HTSLIB_CONFIGURE_OPTIONS=None
  # pysam: (sysconfig) CC=clang
  # pysam: (sysconfig) CFLAGS=-Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g 
  # pysam: (sysconfig) LDFLAGS=-arch arm64 -arch x86_64 -g
  [...]
  checking for lzma.h... yes
  checking for lzma_easy_buffer_encode in -llzma... no
  configure: error: liblzma development files not found

  The CRAM format may use LZMA2 compression, which is implemented in HTSlib
  by using compression routines from liblzma <http://tukaani.org/xz/>.

  Building HTSlib requires liblzma development files to be installed on the
  build machine; you may need to ensure a package such as liblzma-dev (on Debian
  or Ubuntu Linux), xz-devel (on RPM-based Linux distributions or Cygwin), or
  xz (via Homebrew on macOS) is installed; or build XZ Utils from source.

  Either configure with --disable-lzma (which will make some CRAM files
  produced elsewhere unreadable) or resolve this error to build HTSlib.
  [...]
  checking for lzma.h... yes
  checking for lzma_easy_buffer_encode in -llzma... no
  configure: error: liblzma development files not found

  The CRAM format may use LZMA2 compression, which is implemented in HTSlib
  by using compression routines from liblzma <http://tukaani.org/xz/>.

  Building HTSlib requires liblzma development files to be installed on the
  build machine; you may need to ensure a package such as liblzma-dev (on Debian
  or Ubuntu Linux), xz-devel (on RPM-based Linux distributions or Cygwin), or
  xz (via Homebrew on macOS) is installed; or build XZ Utils from source.

  Either configure with --disable-lzma (which will make some CRAM files
  produced elsewhere unreadable) or resolve this error to build HTSlib.
  Makefile:137: htscodecs.mk: No such file or directory
  config.mk:2: *** Resolve configure error first.  Stop.
  # pysam: htslib configure options: None
jmarshall commented 1 year ago

This is the problem encountered in https://github.com/pysam-developers/pysam/pull/1142#issuecomment-1295101714 but you are quite right that it is about time we got to the bottom of this problem. Thanks for the reminder.