Tag Archives: Python import pandastime Error

[Solved] Python import pandastime Error: Could not import the lzma module

# Install xz-devel in centos and recompile it

yum install xz-devel

./configure --enable-optimizations

#install backports.lzma package

pip install backports.lzma

Modify python file

# /usr/local/python3.x/lib/lzma.py

Original:

from _lzma import * 
    
from _lzma import _encode_filter_properties, _decode_filter_properties 

to:

 try: 

     from _lzma import * 
    
     from _lzma import _encode_filter_properties, _decode_filter_properties 

 except ImportError: 

     from backports.lzma import * 

     from backports.lzma import _encode_filter_properties, _decode_filter_properties