Error importing Theano

You didn't build correctly python. It wasn't compiled with the -fPIC parameter. Look at how to compile python with a shared library.

EDIT: You need to compile python like this:

./configure --enable-shared
make
make install

I used a virtualenv on Ubuntu 16.04, and before installing python with pyenv install 3.6.1 I ran the following command to ensure python is built with the fPIC flag:

export CONFIGURE_OPTS="OPT=\"-fPIC\""

Then I was able to install and run theano properly.


In case you are using pyenv you can do that with

CONFIGURE_OPTS=--enable-shared pyenv install 3.6.5

Tags:

Python

Theano