Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UserWarning: Could not import the lzma module. Your installed Python is incomplete

After Installing Google Cloud Bigquery Module, if I import the module into python code. I see this warning message. Happening to me in python 3.7.3 Virtualenv.

Tried to reinstall GCP bigquery module Expectation-in python code if we write" from google.cloud import bigquery ".Should not result in any error or messege.

import os import sys import logging from datetime import datetime from google.cloud import bigquery 
/home/informatica/.local/lib/python3.7/site-packages/pandas/compat/__init__.py:84: UserWarning: Could not import the lzma module. Your installed Python is incomplete. Attempting to use lzma compression will result in a RuntimeError.   warnings.warn(msg)  exit() 
like image 740
Sreekanth Avatar asked Sep 01 '19 04:09

Sreekanth


2 Answers

If you compile Python from source, you must have the lzma-dev package installed, or it will not be built into python.

For ubuntu: sudo apt-get install liblzma-dev

For centos: yum install -y xz-devel

Then configure && make && make install

like image 106
Chenglu Avatar answered Sep 27 '22 20:09

Chenglu


I used other good answers from here and didn't solve the problem (Ubuntu 18.04, Python3.8), still get this warning. Actually there is one more package is needed to be installed to solve the problem:

sudo apt-get install lzma 

So the whole pipeline (run in the python source code folder):

sudo apt-get install liblzma-dev sudo apt-get install lzma ./configure --enable-optimizations sudo make sudo make altinstall 
like image 26
Mikhail_Sam Avatar answered Sep 27 '22 21:09

Mikhail_Sam