Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
    
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. –  mtmiller Jun 16 at 21:44

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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