Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.

Troubleshooting

Jonathan Mackenzie edited this page Oct 27, 2015 · 2 revisions

Troubleshooting nupic.core

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,

Can't find GLIBC or LIBSTDC++

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:

  1. If you have admin access on the machine, update your 64 bit glibc and libstdc++ packages.
  2. 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 install nupic.core python bindings, then the main nupic package.

Getting an undefined symbols error

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:

  1. Extract capnproto
  2. Configure using ./configure --prefix=/path/to/capnproto/build
  3. Run make -j4 && make install
  4. Run cd $NUPIC_CORE/build/scripts
  5. Tell cmake about where you installed capnproto 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++ 
  1. 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
  1. 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 to commonLinkFlags and commonCompileFlags: "-L/path/to/capnp/build/lib"
  1. Then make -j5 && make install && cd $NUPIC_CORE && python setup.py install --nupic-core-dir=$NUPIC_CORE/build/release
  2. Make sure /path/to/capnproto/build is in your $LD_LIBRARY_PATH when you run your code that uses the python bindings