Install Nupic on Mac OS

Hi,

I am trying to install nupic on Mac OS,

I tried to install with

python setup.py install

and

ARCHFLAGS="-arch x86_64" python setup.py install

but in both cases the following error showed up:

Reading https://pypi.python.org/simple/nupic.bindings/
No local packages or download links found for nupic.bindings==0.4.5.dev0
error: Could not find suitable distribution for Requirement.parse(‘nupic.bindings==0.4.5.dev0’)

I checked the link, and there’s no 0.4.5

Can someone help me ?

Thanks!

Po-Hsuan

1 Like

If you are going to manually install NuPIC, you must compile nupic.core locally as well. This should still be pretty much valid:

Hi,

When I tried to use make -j3 to build a software, the system complained :

– The CXX compiler identification is unknown
– Check for working CXX compiler: /opt/local/bin/c++
– Check for working CXX compiler: /opt/local/bin/c++ – broken
CMake Error at /opt/local/share/cmake-3.3/Modules/CMakeTestCXXCompiler.cmake:54 (message):
The C++ compiler “/opt/local/bin/c++” is not able to compile a simple test
program.

So I used

make -j3 CXX=‘PATH_TO_G++’

The complier is still the same.

Check for working CXX compiler: /Users/pohsuanhuang/miniconda/envs/nupic/bin/c++
– Check for working CXX compiler: /Users/pohsuanhuang/miniconda/envs/nupic/bin/c++ – broken

Is it because the makefile doesn’t use $CXX and $CC as compiler variables ?

How can I specify my CXX and C compiler ?

Thanks !

Po-Hsuan

@lets.lincredible What version of OS X are you using? My c++ executable is in /usr/bin/.

> which c++
/usr/bin/c++

Hi, Matt,

My Mac is in 10.11.3
My c++ in in/opt/local/bin/c++ because I used MacPort to install gcc

pohsuanhuang$ c++ -v
Using built-in specs.
COLLECT_GCC=c++
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin15/4.9.3/lto-wrapper
Target: x86_64-apple-darwin15
Configured with: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc49/gcc49/work/gcc-4.9.3/configure --prefix=/opt/local --build=x86_64-apple-darwin15 --enable-languages=c,c++,objc,obj-c++,lto,fortran,java --libdir=/opt/local/lib/gcc49 --includedir=/opt/local/include/gcc49 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-4.9 --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-4.9 --with-gxx-include-dir=/opt/local/include/gcc49/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-isl=/opt/local --disable-isl-version-check --with-cloog=/opt/local --disable-cloog-version-check --enable-stage1-checking --disable-multilib --enable-lto --enable-libstdcxx-time --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --with-pkgversion=‘MacPorts gcc49 4.9.3_0’ --with-build-config=bootstrap-debug
Thread model: posix

gcc version 4.9.3 (MacPorts gcc49 4.9.3_0)

You can specify your compiler by setting the appropriate CMake variables via command line:

-DCMAKE_C_COMPILER="/path/to/your/c/compiler/executable"
-DCMAKE_CXX_COMPILER="/path/to/your/c++/compiler/executable"

So in case you’re compiling nupic.core, your CMake call should look like this (make sure to wipe your build/release directory before running cmake):

cmake $NUPIC_CORE -DCMAKE_INSTALL_PREFIX=../release -DPY_EXTENSIONS_DIR=$NUPIC_CORE/bindings/py/nupic/bindings -DCMAKE_CXX_COMPILER="/opt/local/bin/c++"

Since not all externals in nupic.core use CMake, you additionally have to set the environment variable before running make:

CXX=/opt/local/bin/c++ make -j3

1 Like

Hi, Helge,
Thanks for reply.
I tried it already, and I don’t know why it didn’t help.

I have several sets of compilers.
one in > usr/bin, one in > opt/local/bin , and one in Conda

/Users/pohsuanhuang/miniconda/envs/nupic/bin/c++

Does it matter with one to use ?

No, it shouldn’t.

Could you please copy the whole build output to a gist/to pastebin and copy the link in this thread? Maybe there’s another error we can’t see right now.

1 Like

Hi, Helge,

Thanks for the help.

This is the link :

http://pastebin.com/t5YKmqs7

:slight_smile:

Thank you. So the real cause is:

      c++: error: unrecognized command line option ‘-stdlib=libc++’
     
      make[4]: *** [CMakeFiles/cmTC_31902.dir/testCXXCompiler.cxx.o] Error 1
     
      make[3]: *** [cmTC_31902/fast] Error 2

The c++ binary doesn’t know this option. I’m not sure if nupic fully supports gcc on osx.
Did you try to use clang instead of gcc (-DCMAKE_CXX_COMPILER=clang++)?

1 Like

Hi, Helge,

Thanks for the help.

Following your suggestions, I tried

CXX=’/usr/bin/clang++7’ make -j3

http://pastebin.com/M5cijxFB

And I removed the build folder, and tried to generate the build file all over again with -DCMAKE_CXX_COMPILER=clang++, but it failed.

http://pastebin.com/G1Ay7J8j

Your output shows the following error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named capnp

You could try to install pycapnp before running cmake (pip install pycapnp).

1 Like

Hi, Helge,

Thanks for the help.

I somehow managed to make it work.

It seemed I have to assigne the path to the correct PYTHONPATH to let cmake find pycapnp.

I am not sure if that’s the reason it didn’t succeed in building the file before.

http://pastebin.com/dxQLuv6D

However, now I have new problems.

I got to ./nupic where I git clone nupic.

and I run

./script/run_nupi_tests -u

as suggests in the video, and I saw the the following error message
Traceback (most recent call last): File "./scripts/run_nupic_tests.py", line 263, in <module> os.chdir(os.getenv('NUPIC')) TypeError: coercing to Unicode: need string or buffer, NoneType found

The required py.test is in the path variable

(nupic) Pohsuans-MacBook-Pro:nupic pohsuanhuang$ which py.test /Users/pohsuanhuang/miniconda/envs/nupic/bin/py.test (nupic) Pohsuans-MacBook-Pro:nupic pohsuanhuang$ echo $PATH /Users/pohsuanhuang/miniconda/envs/nupic/bin:/usr/local/bin:/opt/local/bin:/opt/local/sbin:/Users/pohsuanhuang/miniconda/bin:/Users/pohsuanhuang/miniconda/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Library/TeX/texbin
Can you help me ? Thanks!

Seems you don’t have the $NUPIC environment variable defined.

export NUPIC=<path-to-your-nupic-directory>/nupic

(see https://github.com/numenta/nupic/wiki/Compiling-NuPIC-on-Ubuntu-15#set-some-environment-vars)

1 Like

Thanks for your help with this @helge while I was AFK.

1 Like

Hi Helge,

Thank you for the help. I have haven’t solved the problem. I will come back in a few days.

Best,

Po-Husan