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).
The most frequent source of this error is that you haven't installed Pandas explicitly with pip install pandas . Alternatively, you may have different Python versions on your computer, and Pandas is not installed for the particular version you're using.
Enter the command “pip install pandas” on the terminal. This should launch the pip installer. The required files will be downloaded, and Pandas will be ready to run on your computer. After the installation is complete, you will be able to use Pandas in your Python programs.
The easiest way to install pandas is to install it as part of the Anaconda distribution, a cross platform distribution for data analysis and scientific computing. This is the recommended installation method for most users.
The import pandas portion of the code tells Python to bring the pandas data analysis library into your current environment. The as pd portion of the code then tells Python to give pandas the alias of pd. This allows you to use pandas functions by simply typing pd. function_name rather than pandas.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With