I'm trying to execute this code:
import matplotlib.pyplot as plt
import numpy as np
from keras.models import Sequential
from keras.layers import Dense
x = np.linspace(-3, 3, 1000).reshape(-1, 1)
def f(x):
return 2 * x + 5
f = np.vectorize(f)
y = f(x)
def baseline_model():
model = Sequential()
model.add(Dense(1, input_dim=1, activation='linear'))
model.compile(loss='mean_squared_error', optimizer='sgd')
return model
model = baseline_model()
model.fit(x, y, nb_epoch=100, verbose = 0)
But on last line it throws this error: ImportError: /home/puck/.theano/compiledir_Linux-4.4--MANJARO-x86_64-with-glibc2.2.5--3.6.0-64/tmpgk36rmkt/mf0c860ada3decf909d2c7248bdfcff39.so: undefined symbol: _ZdlPvm
Here is full traceback. This is my first experience with keras and theano, so I have no idea what to do.
Some info about software versions:
Linux 4.4.52-1-MANJARO
GCC 6.3.1
Anaconda 4.3.0
Python 3.6.0
IPython 5.1.0
Theano 0.8.2
Keras 1.2.2
To fix problem I installed gcc 4.9.3 and added in ~/.theanorc
these lines:
[global]
cxx = /usr/bin/g++-4.9.3
As you have installed pre-built theano package in your machine it is expecting certain gcc and dependent libs to be in the machine to make the call. The solution provided in the github link is still valid for you however because you are not building the code, that solution will not work for you because theano is still accessing the preinstalled libs.
Here is what you can try:
I believe this help you to get your theano working.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With