jd-boyd / python-lzo

Python bindings for the LZO data compression library
GNU General Public License v2.0
74 stars 41 forks source link

"lzomodule.c:38:10: fatal error: lzo/lzo1.h: No such file or directory" on Ubuntu / missing wheels #85

Open mxmlnkn opened 5 months ago

mxmlnkn commented 5 months ago

It seems that only wheels for MacOS and Windows are available on PyPI. This results in the following error on pip install python-lzo:

Defaulting to user installation because normal site-packages is not writeable
Collecting python-lzo
  Downloading python-lzo-1.15.tar.gz (17 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: python-lzo
  Building wheel for python-lzo (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for python-lzo (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [5 lines of output]
      lzomodule.c:38:10: fatal error: lzo/lzo1.h: No such file or directory
         38 | #include <lzo/lzo1.h>
            |          ^~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for python-lzo
Failed to build python-lzo
ERROR: Could not build wheels for python-lzo, which is required to install pyproject.toml-based projects

After installing the missing dependencies with sudo apt install liblzo2-dev, it builds fine.

jd-boyd commented 5 months ago

I thought the apt install part was mentioned in the readme, but I just double checked before saying that and I'm wrong. So I guess that will need to be fixed. Unless I'm behind on the times, binary wheels for Linux are not particularly portable across all versions of Linux. Those I believe The goal is to have binary wheels for windows and Mac OS, but only source for Linux.

mxmlnkn commented 5 months ago

As far as I know, manylinux solved the wheels-for-Linux problem. Most Python packages publish manylinux wheels to avoid additional manual user installation steps such as the one I had to do. I saw cibuildwheel mentioned, which I am also using for my packages. Normally, it should build all (manylinux) wheels automatically.