No python lzma

When debugging via SSH:

ubuntu@box1607:~$ uname -a
Linux box1607.localdomain 3.13.0-100-generic #147-Ubuntu SMP Tue Oct 18 16:48:51 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
ubuntu@box1607:~$ python3.5
Python 3.5.2 (default, Jul 25 2016, 02:11:18) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import lzma
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/circleci/.pyenv/versions/3.5.2/lib/python3.5/lzma.py", line 26, in <module>
    from _lzma import *
ImportError: No module named '_lzma'

I haven’t seen this error before… I have nothing special in circle.yml. How to fix it?

Looks like the CircleCI Python build doesn’t contain _lzma*.so, like the standard Ubuntu/Debian Python distribution does:

ubuntu@box1607:~$ apt-file search _lzma
...
circleci-python-3.5.1=1: /opt/circleci/python/3.5.1/lib/python3.5/test/__pycache__/test_lzma.cpython-35.opt-1.pyc
circleci-python-3.5.1=1: /opt/circleci/python/3.5.1/lib/python3.5/test/__pycache__/test_lzma.cpython-35.opt-2.pyc
circleci-python-3.5.1=1: /opt/circleci/python/3.5.1/lib/python3.5/test/__pycache__/test_lzma.cpython-35.pyc
circleci-python-3.5.1=1: /opt/circleci/python/3.5.1/lib/python3.5/test/test_lzma.py
circleci-python-3.5.2=1: /opt/circleci/python/3.5.2/lib/python3.5/test/__pycache__/test_lzma.cpython-35.opt-1.pyc
circleci-python-3.5.2=1: /opt/circleci/python/3.5.2/lib/python3.5/test/__pycache__/test_lzma.cpython-35.opt-2.pyc
circleci-python-3.5.2=1: /opt/circleci/python/3.5.2/lib/python3.5/test/__pycache__/test_lzma.cpython-35.pyc
circleci-python-3.5.2=1: /opt/circleci/python/3.5.2/lib/python3.5/test/test_lzma.py
libpython3.4-dbg: /usr/lib/python3.4/lib-dynload/_lzma.cpython-34dm-x86_64-linux-gnu.so
libpython3.4-stdlib: /usr/lib/python3.4/lib-dynload/_lzma.cpython-34m-x86_64-linux-gnu.so
libpython3.4-testsuite: /usr/lib/python3.4/test/test_lzma.py
patool: /usr/lib/python2.7/dist-packages/patoolib/programs/py_lzma.py
python3.4-dbg: /usr/lib/debug/usr/lib/python3.4/lib-dynload/_lzma.cpython-34m-x86_64-linux-gnu.so

My solution (temporary I hope): use custom built Python - specify Python version other than that is available on the Ubuntu image. It will be built by pyenv from source code and the lzma module will work.

circle.yml:

machine:
  python:
    version: 3.6.0b3

I am having the same problem on my builds on 3.5.2 and 3.5.3.
A switching to a non-3.5 version of Python is not possible for us at this time.

Has anyone gotten any closer to resolving this issue?

It works in CircleCI 2.0:

Thank you, that did the trick.