0

I've already install pandas from either the terminal and add pandas in pycharm project interpreter. However, every time I run a program which uses pandas it keeps reminding me there's an error.

RuntimeError: module compiled against API version 0xb but this version of numpy is 0xa
Traceback (most recent call last):
  File "/Users/Rabbit/PycharmProjects/NLP/review2vector.py", line 7, in <module>
    from pandas import DataFrame
  File "/Users/Rabbit/Library/Python/2.7/lib/python/site-packages/pandas/__init__.py", line 35, in <module>
    "the C extensions first.".format(module))
ImportError: C extension: numpy.core.multiarray failed to import not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first.

I also followed this question's answer How to solve import error for pandas? But it does not work for me.

Coding_Rabbit
  • 1,287
  • 3
  • 22
  • 44

2 Answers2

2

These issues can be easily avoided if you use a virtual environment to install and maintain your Python packages. Please refer to the link here for more information: LINK

troymyname00
  • 670
  • 1
  • 14
  • 32
1

The error message is telling you that numpy is not fully installed. There isn't enough information there to guess specifically what is wrong, but if I was troubleshooting I would use my package manager (pip probably) to uninstall and then re-install numpy and pandas. I would do numpy separately so that I could watch the messages. The numpy page says that they should have pre-compiled wheels available, so it just seems like a version mismatch.

Pycharm lets you install packages into a virtualenv easily and ensure that env is always activated when you open the pycharm terminal (great!) but it also makes it very hard to notice install errors.

Paul Becotte
  • 9,767
  • 3
  • 34
  • 42