Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RuntimeError: module compiled against API version a but this version of numpy is 9 in ubuntu

Tags:

numpy

theano

I just installed theano, but

import numpy
print numpy.version

here is the output

Theano version 0.7.0.dev-30cc6380863b08a3a90ecbe083ddfb629a56161d
theano is installed in /home/sizhexi/theano/Theano/theano
NumPy version 1.8.2
NumPy is installed in /usr/lib/python2.7/dist-packages/numpy
Python version 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2]
nose version 1.3.1
RuntimeError: module compiled against API version a but this version of numpy is 9
terminate called after throwing an instance of 'std::runtime_error'
  what():  numpy failed to initialize
Aborted (core dumped)

how to solve it?

like image 232
user824624 Avatar asked Nov 10 '22 00:11

user824624


1 Answers

Package management in python is sometimes tricky. To avoid these issues, I recommend using Anaconda which is a good python package and environment manager (download here, and 30 minutes guide).

Follow the official instructions to install Anaconda and chose the default values that will add Anaconda to your $PATH and make Anaconda your default python interpreter. Then open your terminal and use the following commands :

  • conda install pip six nose numpy scipy
  • pip install theano

Then try running your script using anaconda.

like image 63
LeCodeDuGui Avatar answered Jan 04 '23 02:01

LeCodeDuGui