Trouble compiling nupic.core

I get many errors but the first one is #error Must use Python with unicode enabled.
subsequent ones all point to the same npy_common.h file with error xxxxx does not name a type
Any help would be appreciated.
Compiling on RedHat 7.3

29%] [ 29%] Building CXX object src/CMakeFiles/nupic_core_solo.dir/nupic/py_support/NumpyArrayObject.cpp.o
Building CXX object src/CMakeFiles/nupic_core_solo.dir/nupic/bindings/PySparseTensor.cpp.o
[ 30%] In file included from /usr/lib64/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:7:0,
from /usr/lib64/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17,
from /usr/lib64/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:15,
from /home/here/nupic.core/src/nupic/py_support/NumpyArrayObject.hpp:42,
from /home/here/nupic.core/src/nupic/py_support/NumpyArrayObject.cpp:28:
/usr/lib64/python2.7/site-packages/numpy/core/include/numpy/npy_common.h:188:2: error: #error Must use Python with unicode enabled.
#error Must use Python with unicode enabled.

1 Like

Are you using Anaconda?

No, was using RH7 default python7 installation.
But I seem to have gotten by this and was able to build nupic_core
If I can ask another question
When installing nupic I get the following error
Any ideas

acnvm017 98:pip install --user .
Processing /home/here/nupic
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-zrOvnR-build/setup.py", line 126, in <module>
        requirements = findRequirements()
      File "/tmp/pip-zrOvnR-build/setup.py", line 113, in findRequirements
        if nupicBindingsPrereleaseInstalled():
      File "/tmp/pip-zrOvnR-build/setup.py", line 55, in nupicBindingsPrereleaseInstalled
        if pkg_resources.parse_version(nupicDistribution.version).is_prerelease:
    AttributeError: 'tuple' object has no attribute 'is_prerelease'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-zrOvnR-build/
acnvm017 99:pip install -r bindings/py/requirements.txt --user
Could not open requirements file: [Errno 2] No such file or directory: 'bindings/py/requirements.txt'

You are running pip install --user? That doesn’t seem right. Are you trying to install from nupic source code or from pypi? It looks like you’re in a local checkout directory of NuPIC, in which case you should install with python setup.py install --user.

I dont see that in instr on web GitHub - numenta/nupic-legacy: Numenta Platform for Intelligent Computing is an implementation of Hierarchical Temporal Memory (HTM), a theory of intelligence based strictly on the neuroscience of the neocortex.
but I get the same when I try it

acnvm017 129:cd $NUPIC
/home/here/nupic
acnvm017 130:python setup.py install --user
Traceback (most recent call last):
File “setup.py”, line 126, in
requirements = findRequirements()
File “setup.py”, line 113, in findRequirements
if nupicBindingsPrereleaseInstalled():
File “setup.py”, line 55, in nupicBindingsPrereleaseInstalled
if pkg_resources.parse_version(nupicDistribution.version).is_prerelease:
AttributeError: ‘tuple’ object has no attribute ‘is_prerelease’

No, that is what you pasted in your comment. It is not the right command, that’s why I said it doesn’t seem right. Sorry for the confusion.

Do you have the right dependencies? Especially pip and setuptools versions?

I am going to start over and see what happens

just to clarify when building nupic-core from source
I installed Numpy 1.12.1 then pycapnp 0.5.8
then I also run pip install -r bindings/py/requirements.txt ??
I ask because then it indicates its downloading pycapnp 0.5.12 ?

First, uninstall nupic completely.

Looks like the README is wrong, pycapnp 0.5.12 is fine. So yes it seems like you’re doing it right. You don’t even need to manually install numpy or pycapnp, they will install when you run pip install -r bindings/py/requirements.txt.

Then hopefully you can just run python setup.py install [--user] to run the cmake build.

So starting from scratch with nupic.core below are the commands I used and the results
Can you verify, it looks simply and yet …
cd $NUPIC_CORE
pip install -r bindings/py/requirements.txt
mkdir -p $NUPIC_CORE/build/scripts
cmake $NUPIC_CORE -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=…/release -DPY_EXTENSIONS_DIR=$NUPIC_CORE/bindings/py/src/nupic/bindings
make -j3
Now I get a lot of these
" rm: cannot remove ‘conftest’: Is a directory" not sure if significant

At then end of make I get
        [  7%] Completed 'CapnProto'
        [  7%] Built target CapnProto
        make: *** [all] Error 2
Not sure what Error 2 means

make install

I see this, is it an error ?
            grep: /home/here/nupic.core/ThirdParty/Build/Apr1StaticLib/libtool: No such file or director

Still get a lit of these ...
            " rm: cannot remove 'conftest': Is a directory"

At the end I see this

checking for /dev/zero... yes
/home/here/nupic.core/ThirdParty/Source/Apr1StaticLib/configure:Error: decision on anonymous shared memory allocation method failed
make[2]: *** [ThirdParty/Stamp/Apr1StaticLib/Apr1StaticLib-configure] Error 1
make[1]: *** [external/CMakeFiles/Apr1StaticLib.dir/all] Error 2
make: *** [all] Error 2

cd $NUPIC_CORE/build/release/bin
bash: cd: /home/here/nupic.core/build/release/bin: No such file or direct

Hi - Still running into issues
The previous results were obtained when I went to a totally new machine and tried to build nupic.core
As you see I ran into a lot of errors, which I had not previously encountered. Not sure why?
But ignore those.

Since that failed miserably ?? I went back to the original machine, uninstalled nupic and tried again.
With the same results as those I originally posted . I am including all the steps here.
But in the end I get the same 3 errors reported when in the test python setup.py test after nupic.core built
and get exact same error when doing the nupic install regarding AttributeError: ‘tuple’ object has no attribute ‘is_prerelease’

I also tried the simple source installation route i.e. python setup.py install
I get the exact same 3 errors in the nupic.core build and get the same error

I did a git clone of nupic and nupic.core then …

cd $NUPIC_CORE
pip install -r bindings/py/requirements.txt
cd $NUPIC_CORE/build/scripts
cmake $NUPIC_CORE -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=…/release -DPY_EXTENSIONS_DIR=$NUPIC_CORE/bindings/py/src/nupic/bindings
make -j3
make install
cd $NUPIC_CORE/build/release/bin
./cpp_region_test
./unit_tests

root@acnvm017 nupic]# pwd
/home/here/nupic
[root@acnvm017 nupic]# python setup.py install
Traceback (most recent call last):
File “setup.py”, line 126, in
requirements = findRequirements()
File “setup.py”, line 113, in findRequirements
if nupicBindingsPrereleaseInstalled():
File “setup.py”, line 55, in nupicBindingsPrereleaseInstalled
if pkg_resources.parse_version(nupicDistribution.version).is_prerelease:
AttributeError: ‘tuple’ object has no attribute ‘is_prerelease’

I also got 3 errors when testing after building nupic.core
python setup.py test
collected 200 items / 3 errors

network_test.py:36: in
from nupic.bindings.tools.serialization_test_py_region import
/usr/lib64/python2.7/site-packages/nupic/bindings/tools/serialization_test_py_region.py:34: in
from nupic.bindings.tools.SerializationTestPyRegionProto_capnp import
capnp/lib/capnp.pyx:3949: in capnp.lib.capnp._Loader.load_module (capnp/lib/capnp.cpp:75559)
???
capnp/lib/capnp.pyx:3928: in capnp.lib.capnp.load (capnp/lib/capnp.cpp:75047)
???
capnp/lib/capnp.pyx:3251: in capnp.lib.capnp.SchemaParser.load (capnp/lib/capnp.cpp:65948)
???
E KjException: /home/here/nupic.core/bindings/py/src/nupic/proto/RandomProto.capnp:0: failed: Duplicate ID @0x88eaee6db8e1f67c.
E stack: 0x7fe518853988 0x7fe518776569 0x7fe5187760aa 0x7fe51879bc6a 0x7fe51879c1a2 0x7fe5187a0596 0x7fe5187a068b 0x7fe5187a074c 0x7fe5187a0794 0x7fe5187aead1 0x7fe5187add56 0x7fe5187b1f13 0x7fe518798c28 0x7fe5187a051e 0x7fe51879982e 0x7fe518799b17
________________________________________________________ ERROR collecting bindings/py/tests/algorithms/cells4_test.py _________________________________________________________
algorithms/cells4_test.py:31: in
from nupic.bindings.algorithms import Cells4
/usr/lib64/python2.7/site-packages/nupic/bindings/algorithms.py:119: in
from nupic.proto.Cells4_capnp import Cells4Proto
capnp/lib/capnp.pyx:3949: in capnp.lib.capnp._Loader.load_module (capnp/lib/capnp.cpp:75559)
???
capnp/lib/capnp.pyx:3928: in capnp.lib.capnp.load (capnp/lib/capnp.cpp:75047)
???
capnp/lib/capnp.pyx:3251: in capnp.lib.capnp.SchemaParser.load (capnp/lib/capnp.cpp:65948)
???
E KjException: /home/here/nupic.core/bindings/py/src/nupic/proto/RandomProto.capnp:0: failed: Duplicate ID @0x88eaee6db8e1f67c.
E stack: 0x7fe518853988 0x7fe518776569 0x7fe5187760aa 0x7fe51879bc6a 0x7fe51879c1a2 0x7fe5187a0596 0x7fe5187a068b 0x7fe5187a074c 0x7fe5187a0794 0x7fe5187aead1 0x7fe5187add56 0x7fe5187b1f13 0x7fe518798c28 0x7fe5187a051e 0x7fe51879982e 0x7fe518799b17
__________________________________________________________ ERROR collecting bindings/py/tests/algorithms/svm_test.py __________________________________________________________
algorithms/svm_test.py:31: in
from nupic.bindings.algorithms import svm_dense, svm_01
/usr/lib64/python2.7/site-packages/nupic/bindings/algorithms.py:119: in
from nupic.proto.Cells4_capnp import Cells4Proto
capnp/lib/capnp.pyx:3949: in capnp.lib.capnp._Loader.load_module (capnp/lib/capnp.cpp:75559)
???
capnp/lib/capnp.pyx:3928: in capnp.lib.capnp.load (capnp/lib/capnp.cpp:75047)
???
capnp/lib/capnp.pyx:3251: in capnp.lib.capnp.SchemaParser.load (capnp/lib/capnp.cpp:65948)
???
E KjException: /home/here/nupic.core/bindings/py/src/nupic/proto/RandomProto.capnp:0: failed: Duplicate ID @0x88eaee6db8e1f67c.
E stack: 0x7fe518853988 0x7fe518776569 0x7fe5187760aa 0x7fe51879bc6a 0x7fe51879c1a2 0x7fe5187a0596 0x7fe5187a068b 0x7fe5187a074c 0x7fe5187a0794 0x7fe5187aead1 0x7fe5187add56 0x7fe5187b1f13 0x7fe518798c28 0x7fe5187a051e 0x7fe51879982e 0x7fe518799b17
=========================================================================== pytest-warning summary ============================================================================
WC1 None [pytest] section in setup.cfg files is deprecated, use [tool:pytest] instead.
!!! Interrupted: 3 errors during collection !!!
================================================================= 1 pytest-warnings, 3 error in 2.04 seconds ==================================================================

Also as a desperation move instead of installing nupic from source I installed nupic with pip install nupic
It was successful but I see it unistalls 1.0.2 and installs 1.0.0
Am I having version issues between nupic and nupic.core ?

Installing collected packages: nupic.bindings, nupic
Found existing installation: nupic.bindings 1.0.2
Uninstalling nupic.bindings-1.0.2:
Successfully uninstalled nupic.bindings-1.0.2
Successfully installed nupic-1.0.0 nupic.bindings-1.0.0

When I look at the versions for what I have cloned I see these versions
NUPIC_CORE 1.0.2
NUOIC 1.01.1.dev0

Are these the correct versions ??

The easiest way to install is certainly to run pip install nupic like you did in your last attempt. The only reason you’d want to manually compile nupic.core is if you were planning on updating the C++ code. So if that works for you, I would suggest you use it.

Yep, that’s perfect.

We did want to try to interface with our C++ code.
Can you let me know about the version issue mentioned earlier, is there a mismatch ?

Also. from the source repo there are examples to run
Can I still I run them if I installed by pip install nupic
When I try to run the taxi example it prints out the comment at the start then stops and takes possession of mouse ?
i.e cursor turns into cross-hair and then if I click anywhere I ger this

./nyctaxi_anomaly.py: line 26: $'\nA simple client to create a HTM anomaly detection model for nyctaxi dataset.\nThe script prints out all records that have an abnormally high anomaly\nscore.\n': command not found
i**mport: unable to grab mouse `': Resource temporarily unavailable @ error/xwindow.c/XSelectWindow/9047.**
./nyctaxi_anomaly.py: line 32: from: command not found
./nyctaxi_anomaly.py: line 34: from: command not found
./nyctaxi_anomaly.py: line 38: syntax error near unexpected token `('
./nyctaxi_anomaly.py: line 38: `_LOGGER = logging.getLogger(__name__)'

You can use nupic.core from your C++ code without compiling it locally.

That error you are getting from the nyctaxi example is strange. It seems like the file is not being processed as a python file. How are you running it?

Just like ./nyctaxi_anomaly.py
whoops forgot the python part
Im getting deliroius with nupic

python ./nyctaxi_anomaly.py
Traceback (most recent call last):
File “./nyctaxi_anomaly.py”, line 103, in
runNYCTaxiAnomaly()
File “./nyctaxi_anomaly.py”, line 81, in runNYCTaxiAnomaly
with open (_INPUT_DATA_FILE) as fin:
IOError: [Errno 2] No such file or directory: ‘/usr/lib/python2.7/site-packages/nupic/datafiles/extra/nyctaxi/nyc_taxi.csv’

but I see it
ls /usr/lib/python2.7/site-packages/nupic/datafiles/extra/nycTaxi/
nyc_taxi.csv

It just cannot find the data file (./src/nupic/datafiles/extra/nycTaxi/nyc_taxi.csv). Look for that file in your nupic checkout and just update the script to get it right (easiest fix).

Ahh, needed to change …nyctaxi/ in python script to …nycTaxi

Thanks, filed:

You mentioned earlier that I did not have to recompile nupic.core
I was doing that as I thought it was need as we are running on a RedHat 7 system
But just to confirm you are saying thats not the case

The only reason you’d need to recompile nupic.core is if you needed to change the code in nupic.core. You would only need to do that if you were planning on change how the algorithms worked or something.