14

On Ubuntu 18.04 with python 3.7.3, I'm attempting to import pandas but this fails because it can't find _lzma.

I've verified that _lzma is installed with dpkg:

/usr/lib/python3.7/lib-dynload/_lzma.cpython-37m-x86_64-linux-gnu.so. Oddly, _lzma is not a dependency of pandas (as specified by pip3).

Dave
  • 5,108
  • 16
  • 30
  • 40

3 Answers3

18

I have the same issue using pyenv. You don't need to rollback pandas.

To fix import errors, I've removed python:

$ pyenv uninstall 3.7.1

Installed dependencies:

$ sudo apt-get install liblzma-dev

and reinstalled version:

$ pyenv install 3.7.1

More on this dependencies here

kiba
  • 1,355
  • 9
  • 7
  • Tried this for version 3.7.4, run into AttributeError: module 'pandas' has no attribute 'compat' – Ben Jul 29 '19 at 06:49
  • @Ben, have you installed all dependencies from [this link](https://github.com/pyenv/pyenv/wiki#suggested-build-environment)? I've no issues with 3.7.4 either. – kiba Jul 30 '19 at 00:00
  • alternative source: https://github.com/pandas-dev/pandas/issues/27532#issuecomment-514044754 – XoXo Jul 30 '19 at 12:11
  • @Jeff Xiao and kiba: Thank you. Actually, I was missing one of the Mint dependencies from the pyenv installation instructions (https://github.com/pyenv/pyenv/wiki#suggested-build-environment). Reinstalling 3.7.4 with pyenv after installing dependencies fixed it. Sorry about that! – Ben Jul 31 '19 at 12:29
  • You have to roll back `pandas` if you don't have `sudo` access. – Eponymous Aug 12 '19 at 23:09
17

I was running into this exact same issue today! I was able to fix it though.

Pandas just put out a new version 0.25.0 on July 18th and changing the version back to 0.24.2 fixed this issue for me.

I hope this works for you too!

link: https://pandas.pydata.org/

alex s
  • 171
  • 2
-1

just upgraded to version 0.25.1 and works well

Gonza Piotti
  • 707
  • 10
  • 10