-
Notifications
You must be signed in to change notification settings - Fork 279
Troubleshooting
As with most large large python projects, they may have requirements that are old (such as a specific version of numpy), as this is the case with nupic, it is highly recommended that you build and install and run all nupic code within a virtual environment (this also allows you to easily run multiple versions of python on the same machine). pyenv is one such tool that easily allows you to manage these installations, to get started after installing pyenv,
If you get an error that looks like:
ImportError: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by /home/user/.pyenv/versions/htm/lib/python2.7/site-packages/nupic/bindings/_math.so)
This occurs if you're trying to use the nupic.core python bindings on a machine that has an older version of the libstdc++ and/or glibc libraries than those used by the machine that made the python wheel file. You have 2 options:
- If you have admin access on the machine, update your 64 bit
glibc
andlibstdc++
packages. - If you don't have admin access and your sysadmin refuses to update the packages, you'll need to compile. Be sure to run
pip uninstall nupic nupic.bindings
if you want to compile. You also need to build and installnupic.core
python bindings, then the mainnupic
package.
If you've successfully built and installed the C++ core and python bindings but you attempt to use the bindings and get something like this ImportError
:
ImportError: /home/user/.pyenv/versions/htm/lib/python2.7/site-packages/nupic.bindings-0.2.2-py2.7-linux-x86_64.egg/nupic/bindings/_math.so: undefined symbol: _ZN2kj1_5Mutex4lockENS1_11Exclusiv
It means the bindings didn't link to the capnp and kj library properly. To solve this:
- Extract capnproto
- Configure using
./configure --prefix=/path/to/capnproto/build
- Run
make -j4 && make install
- Run
cd $NUPIC_CORE/build/scripts
- Tell
cmake
about where you installedcapnproto
to by running cmake with the following arguments:
cmake $NUPIC_CORE -DCMAKE_INSTALL_PREFIX=../release \
-DCAPNP_INCLUDE_DIRS=/path/to/capnproto/build/include \
-DCAPNP_LIBRARIES='/path/to/capnproto/build/lib/libkj.a;/path/to/capnproto/build/lib/libcapnp.a;/path/to/capnproto/build/lib/libcapnpc.a' \
-DCAPNP_EXECUTABLE=/path/to/capnproto/build/bin/capnp \
-DCAPNPC_CXX_EXECUTABLE=/path/to/capnproto/build/bin/capnpc-c++
- If you're running inside a virtualenv, add:
-DCMAKE_PYTHON_LIBRARY=/home/user/.pyenv/versions/2.7.10/lib/libpython2.7.so \
-DCMAKE_INCLUDE_DIR=/home/user/.pyenv/versions/2.7.10/include/python2.7
- Make sure the python bindings setup.py knows about where your capnp libraries are installed .NB I'm not sure if this is actually necessary
- Edit
$NUPIC_CORE/bindings/py/setup.py
, add an entry tocommonLinkFlags
andcommonCompileFlags
:"-L/path/to/capnp/build/lib"
- Then
make -j5 && make install && cd $NUPIC_CORE && python setup.py install --nupic-core-dir=$NUPIC_CORE/build/release
- Make sure
/path/to/capnproto/build
is in your$LD_LIBRARY_PATH
when you run your code that uses the python bindings