mbilyanov
mbilyanov

Reputation: 2511

Pandas Import Fails with Conda on Python 3.7.9

I have installed conda and created a python3.7 environment. Then I have installed pandas and now I'm getting the following error when I try to import pandas.

Traceback (most recent call last):
  File "/me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/__init__.py", line 29, in <module>
  File "/me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/_libs/__init__.py", line 13, in <module>
ImportError: /me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/_libs/interval.cpython-37m-x86_64-linux-gnu.so: invalid ELF header

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/__init__.py", line 37, in <module>
ImportError: C extension: /me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/_libs/interval.cpython-37m-x86_64-linux-gnu.so: invalid ELF header not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --force' to build the C extensions first.Traceback (most recent call last):
  File "/me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/__init__.py", line 29, in <module>
  File "/me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/_libs/__init__.py", line 13, in <module>
ImportError: /me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/_libs/interval.cpython-37m-x86_64-linux-gnu.so: invalid ELF header

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/__init__.py", line 37, in <module>
ImportError: C extension: /me/anaconda3/envs/py37/lib/python3.7/site-packages/pandas/_libs/interval.cpython-37m-x86_64-linux-gnu.so: invalid ELF header not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --force' to build the C extensions first.

Any ideas?

Upvotes: 0

Views: 556

Answers (1)

mbilyanov
mbilyanov

Reputation: 2511

It turns out this is a bug with conda and pandas.

Here is the ticket: BUG: Pandas Import is failing under Conda Python 3.7

Using conda-forge fixed the issue for me.

Upvotes: 3

Related Questions