jd-boyd/python-lzo

Unable to execute pip install python-lzo on Ubuntu 16.04 virtualenv

francotestori opened this issue · 6 comments

I am trying to install the python-lzo package on a virtualenv, yet it keeps on failing with the following error log

Collecting python-lzo
  Using cached python-lzo-1.11.tar.gz
Building wheels for collected packages: python-lzo
  Running setup.py bdist_wheel for python-lzo ... error
  Complete output from command /home/franco/mediamath/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-r8fUs1/python-lzo/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpDHdkKvpip-wheel- --python-tag cp27:
  /usr/lib/python2.7/distutils/dist.py:251: UserWarning: 'licence' distribution option is deprecated; use 'license'
    warnings.warn(msg)
  running bdist_wheel
  running build
  running build_ext
  building 'lzo' extension
  creating build
  creating build/temp.linux-x86_64-2.7
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/lzo -I/usr/include/python2.7 -c lzomodule.c -o build/temp.linux-x86_64-2.7/lzomodule.o
  lzomodule.c:35:19: fatal error: lzo1x.h: No such file or directory
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for python-lzo
  Running setup.py clean for python-lzo
Failed to build python-lzo
Installing collected packages: python-lzo
  Running setup.py install for python-lzo ... error
    Complete output from command /home/franco/mediamath/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-r8fUs1/python-lzo/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-OqMkzP-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/franco/mediamath/include/site/python2.7/python-lzo:
    /usr/lib/python2.7/distutils/dist.py:251: UserWarning: 'licence' distribution option is deprecated; use 'license'
      warnings.warn(msg)
    running install
    running build
    running build_ext
    building 'lzo' extension
    creating build
    creating build/temp.linux-x86_64-2.7
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/lzo -I/usr/include/python2.7 -c lzomodule.c -o build/temp.linux-x86_64-2.7/lzomodule.o
    lzomodule.c:35:19: fatal error: lzo1x.h: No such file or directory
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    
    ----------------------------------------
Command "/home/franco/mediamath/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-r8fUs1/python-lzo/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-OqMkzP-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/franco/mediamath/include/site/python2.7/python-lzo" failed with error code 1 in /tmp/pip-build-r8fUs1/python-lzo/

I have looked up for the file lzo1x.h and it looks like it doesn't exist.
Any idea what might be going wrong?

Do you have zlib1g-dev installed? apt install zlib1g-dev. That is a C library, not a python one, and it provides that actual LZO implementation that python-lzo wraps around.

Yes, I already have zlib1g-dev package installed; and the error that appears is the one I have already posted. This happens while trying to perform pip install python-lzo

this is because lzo1x.h is actually located in lzo/lzo1x.h. A workaround is to download the package, untar, modify the .c-file, tar and install the local file. I'll try to create a pull request.

@francotestori, I merged @jdonners pull request. Can you confirm that it also fixes your issue? THank you very much.

Extra package that was required to get this working on Ubuntu 16.04: liblzo2-dev
This packages includes the lzo1x.h file located at: /usr/include/lzo/lzo1x.h

OK, stupidly I never outline what packages needed installed on ubuntu before trying to install python-lzo. I've now updated the README with that here: #34

I'm going to close this now since the original person never confirmed if it worked for them or not. Additional comments should be in new issues.

Thank you all