I have installed the latest version of Pandas by using the following:

sudo apt-get install python-pandas

but I keep getting the following error message when i try to import into Python:

ImportError: /usr/local/lib/python2.7/dist-packages/pandas-0.7.3-py2.7-linux-i686.egg/pandas/_tseries.so: wrong ELF class: ELFCLASS32

Any suggestions on how to fix this? Do I need to reinstall something? If so how do I do it? I have tried to find how to uninstall Pandas but I cant find it.

  • Did you try to install it from source or with pip or some other way also? Any files under /usr/local/lib/python2.7 are not installed by Ubuntu packages. – Mike Miller Jun 16 '14 at 21:44

Some of the Pandas source code is written in Cython. The Cython pyx files are turned into .c files and compiled in .so libraries. The error you are seeing,

ImportError: /usr/local/lib/python2.7/dist-packages/pandas-0.7.3-py2.7-linux-i686.egg/pandas/_tseries.so: wrong ELF class: ELFCLASS32

says that _tseries.so was compiled as an ELF 32-bit binary, while your system (probably) needs an ELF 64-bit binary.

The proper way to fix this depends on how you've arrived at this situation. For example, if you have the full pandas source code in ~/src/pandas, then

cd ~/src/pandas/pandas
/bin/rm *.{c,cpp,so}   # <-- remove the 32-bit binaries
/bin/rm -rf ~/src/pandas/{build,dist}
cd /usr/local/lib/python2.7/dist-packages/
/bin/rm -rf pandas*    # <-- remove the egg file
cd ~/src/pandas
python setup.py build_ext --inplace && python setup.py install   # <-- will build 64-bit binaries on a 64-bit system.

will recompile the cython code and then attempt to install pandas.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.