• Register
0 votes

Problem :

I want to learn the Machine Learning but I am unabe to resolve below error.

My Specs :

·         Mac High Sierra 10.13.2

·         Python3.4.5

·         Numpy1.13.3


Used below Command:

$ python3 -c "import jupyter, matplotlib, numpy, pandas, scipy, sklearn"


I am facing below Error:

RuntimeError: module compiled against API version 0xc but this version of numpy is 0xb

Traceback (most recent call last):

File "/Users/uekyo/ml/env/lib/python3.4/site-packages/pandas/__init__.py", line 36, in <module>

from pandas._libs import (hashtable as _hashtable,

File "/Users/uekyo/ml/env/lib/python3.4/site-packages/pandas/_libs/__init__.py", line 8, in <module>

from .tslib import iNaT, NaT, Timestamp, Timedelta, OutOfBoundsDatetime

File "pandas/_libs/tslib.pyx", line 2, in init pandas._libs.tslib

ImportError: numpy.core.multiarray failed to import

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "<string>", line 2, in <module>

File "/Users/uekyo/ml/env/lib/python3.4/site-packages/pandas/__init__.py", line 40, 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.

6 5 3
7,540 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

The reson behind your error is most likely due to the version of numpy too low; below code solved my problem:

pip3 install "numpy == 1.15.0" --user 

conda install couldnt solve it because currently it only have the numpy version 1.13.1, but is may be due to the my mirror site choosen is not the latest.

9 7 4
38,600 points

Related questions

0 votes
1 answer 374 views
Problem : I am trying to execute below commands. import numpy as np import cv But I am getting following error on my console: >>> runfile('/Users/isaiahnields/.spyder2/temp.py', wdir='/Users/isaiahnields/.spyder2') RuntimeError: module compiled against API version a but this ... it is not working. I had added cv.py to the python2.7 folder in Spyder-Py2 is there anything else I need to add?
asked Dec 4, 2019 alecxe 7.5k points
0 votes
1 answer 86 views
Problem : I have recently installed the opencv 2.4.8 . I am also using python 2.7. I have tried to add my opencv lib to the python according to the tutorial however when I wanted to import my opencv I encountered below error: import cv2 RuntimeError: module compiled ... above error. How can I fix above problem? I researched on still I am unable to find the solutions. Currently I use Windows 7.
asked Dec 21, 2019 alecxe 7.5k points
0 votes
1 answer 29 views
1 vote
2 answers 554 views
Problem : I am beginner to Ancaconda3 and Tensorflow. I have also recently installed Ancaconda3 and Tensorflow. But if I try to import the Tensorflow in the python shell then I often face the below error: ModuleNotFoundError: No module named 'numpy.core._multiarray_umath ... also installed on my box and it can be very successfully imported in the python. Please note currently I am using Windows10.
asked Apr 22, 2020 stewart 4k points
1 vote
1 answer 414 views
Problem : I am new to the Python programming. I am facing below error while trying to execute my code. File "C:\Users\Anaconda3\lib\site-packages\keras\engine\training_arrays.py", line 217, in fit_loop callbacks.on_epoch_end(epoch, epoch_logs) File "C:\Users\Anaconda3\ ... trying to fix this error since yesterday but I am unable to fix it. Can somebody help me in fixing the above mentioned error?
asked Mar 26, 2020 morrisBson 3.2k points
0 votes
1 answer 256 views
Problem: I have currently started learning about using the pandas in ipython notebook: import pandas as pd But I have encountered the below error on my above line of code: AttributeError  Traceback (most recent call last) <ipython-input-17-c7ecb2b0a99d> in <module>() ----> 1 from ... ' I have no knowledge on how to fix the above error, what is a problem here? My python's version is currently 3.6
asked Aug 10, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 4.4K views
Problem : I have the pandas data frame with some of the categorical predictors or variables as 0 & 1, and some of the numeric variables. When I fit that to a stasmodel like below : est = sm.OLS(y, X).fit() It throws the below error : Pandas data ... hundreds of variables. For that I have concatenated the 3 pandas DataFrames to come up with the final DataFrame to be used in the model building.
asked Dec 18, 2019 alecxe 7.5k points
0 votes
2 answers 303 views
Problem : Currently I have installed Python version 3.5 and 3.6 and anaconda on my box. The following error comes up while trying to install tensorflow below are the steps https://www.tensorflow.org/install/install_windows using the anaconda (tensorflow) C:> pip install --ignore- ... . As I am very much new to Python, I am unable to resolve this problem. I am using the Windows 10 with 64bit.
asked Dec 11, 2019 alecxe 7.5k points