pfultz2 / cget

C++ package retrieval
http://cget.readthedocs.io
Other
453 stars 27 forks source link

global name 'lzma' is not defined #70

Open welchr opened 5 years ago

welchr commented 5 years ago

If I use cget installed in a python 2.7 virtualenv, and then install a package that is contained in a .xz archive, it will fail with:

Downloading http://sourceforge.net/projects/arma/files/armadillo-9.200.7.tar.xz
  [######################################################################]  100%
Extracting archive /home/user/scratch/cget_test/cget/cget/build/tmp-9737299f14b44942b74e65ee781e74c4/armadillo-9.200.7.tar.xz ...
Unexpected error: <type 'exceptions.NameError'>
global name 'lzma' is not defined
Failed to build package .

Test case:

#!/bin/bash
virtualenv -p python2 venv &&
  source venv/bin/activate &&
  pip install cget &&
  echo 'armadillo,http://sourceforge.net/projects/arma/files/armadillo-9.200.7.tar.xz' >> requirements.txt &&
  cget install .

It seems to work just fine in a python 3 environment, however.

pfultz2 commented 5 years ago

Python 2 doesn't support lzma out of the box, but you can install backports.lzma(with pip install backports.lzma) to get support in python 2.

I should add a note about this in the installation section.