I want to create an environment where theano can be used with pyenv
OS: Ubuntu 16.04.1 LTS
Use pyenv normally
pyenv install 2.7.6
pyenv shell 2.7.6
pip install Theano
python -c "import theano"
If you do
.pyenv/versions/2.7.10/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32S against `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC
.pyenv/versions/2.7.10/lib/libpython2.7.a: error adding symbols: Bad value
Error. .. ..
If you check with stackoverflow,
Error importing Theano - Stack Overflow here,
You didn't build correctly python. It wasn't compiled with the -fPIC parameter. Look at how to compile python with a shared library.
I'm not sure, but there is no shared library.
You have to add the option --enable-shared
when installing python.
The installation method with pyenv was written at the bottom of Home · yyuu / pyenv Wiki · GitHub.
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.5.0
You can change it if you want to install the version.
For the time being, python -c" import theano "
passed.
Then python -c" import theano; theano.test () "
Then, if there is no module called nose and nose_parameterized,
The official Installing Theano --Theano 0.8.2 documentation also stated that these two should be included when testing.
pip install nose nose-parameterized
For the time being, I passed the test. (Although various warnings came out.)
When using pyenv to insert theano
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install x.x.x
pyenv shell x.x.x
pip install nose nose_parameterized theano
python -c "import theano; theano.test()
That's it for the time being. I haven't confirmed the GPU related items yet, so I will add it if there is a problem.
Recommended Posts