pandas: Problem with lzma module
/usr/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.
I get this error when I run the code and I don’t know how to fix it
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (3 by maintainers)
I was getting this warning:
/Users/usr/.pyenv/versions/3.9.5/lib/python3.9/site-packages/pandas/compat/__init__.py:97: UserWarning: Could not import the lzma module. Your installed Python is incomplete. Attempting to use lzma compression will result in a RuntimeError.
I was finally able to get rid of it with this command:
CPPFLAGS="-I$(brew --prefix xz)/include" pyenv install [your version]
Just thought I’d drop this here for anyone with my same problem.
See also:
OS: Big Sur M1 chip pyenv python 3.9.5
When you’re getting above warning and building Python from source, make sure to
sudo apt-get install liblzma-dev
configure && make
andsudo make install
These steps removed the warning for my Python 3.7.3. See also this Stack Overflow question
@corbinday’s solution worked for me.
OS: Monterey M1 chip pyenv python 3.9.7
I had this problem recently … but here, upgrading from Python 3.7.3 to Python 3.7.4 solved the problem!