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.
http://numenta.org/
GNU Affero General Public License v3.0
6.34k stars 1.56k forks source link

Syntax error within swigtype.swg? #1504

Closed enchy closed 9 years ago

enchy commented 9 years ago

Hi, here's a problem from a new user. I was trying with "sudo python setup.py install", and it showed to me this error

[ 29%] Swig source
/home/dennis/shared/nupic/nupic/external/common/share/swig/3.0.2/typemaps/swigtype.swg:71: Error: Syntax error in input(1).
make[2]: *** [../../temp/extensions/bindings/py/algorithms/AlgorithmsPyPYTHON_wrap.cxx] Error 1
make[1]: *** [CMakeFiles/_algorithms.dir/all] Error 2
make: *** [all] Error 2
Unable to build the library!

Does anyone know what it means? I'm quite poor at building... Please help. :) Thanks.

rhyolight commented 9 years ago

Some questions:

enchy commented 9 years ago

Thank you for your reply. :)

I'm building on Ubuntu 12.04. The gcc version is 4.8.1. I didn't have clang installed. The python version is 2.7.3. The NuPIC checkout SHA is 9452effcbd4a7e5a269dc41ad3fd48b25ab0eac8. It happened the same when I installed with "--user" added.

And thanks for the detailed instructions.

rhyolight commented 9 years ago

Ok, I will try to set up an Ubuntu 12.04 VM today and see what I can find out.

rhyolight commented 9 years ago

@enchy I just realized that I wrote https://github.com/numenta/nupic/wiki/Installing-NuPIC-on-Ubuntu using Ubuntu 12.04.3. Did you follow that wiki page when you installed?

rhyolight commented 9 years ago

@enchy Ok I'm getting a SWIG error:

matt@matt-VirtualBox:~/nupic$ python setup.py install --user
-- The CXX compiler identification is GNU
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Checking platform...
-- Platform: linux32
-- Platform-specific flags:
--   Libraries:  -lm -lpthread -ldl -lutil
--   CXX flags: -fPIC -DPIC -ffloat-store
--   Debug flags: -g
--   LD flags:  -Wl,--no-as-needed -static-libgcc
--   Python extension link flags: -pthread -shared
--   Python embedding link flags: -Wl,--export-dynamic
-- Checking software tools...
Python 2.7.3
-- Found PythonLibs: /usr/lib/libpython2.7.so (Required is at least version "2.7")
CMake Error at CMakeLists.txt:570 (message):
  NuPIC requires Swig version 3.0.2, but
  /home/matt/nupic/external/linux32/bin/swig is 1.3.36

-- Configuring incomplete, errors occurred!
Unable to generate build scripts!

I'm looking into it.

oxtopus commented 9 years ago

We recently bumped the version of swig required in nupic, but only updated the binaries in darwin64 and linux64, excluding the 32-bit linux version. However, as of https://github.com/numenta/nupic/pull/1499, you can specify your own swig binary with -DSWIG_EXECUTABLE argument to cmake. You'd need to install the right version of swig (3.0.2) using either apt or pip, and then the call to python setup.py install ought to be amended to specify the swig binary:

python setup.py install --cmake_options="-DSWIG_EXECUTABLE=`which swig`"
rhyolight commented 9 years ago

@enchy I assume you have a 32bit system, right?

rhyolight commented 9 years ago

@enchy I've updated the wiki and testing the new instructions for both 32bit and 64bit: https://github.com/numenta/nupic/wiki/Installing-NuPIC-on-Ubuntu.

The installation is considerably more complicated now because you need to manage installing gcc-4.7 and swig3.0 (for 32b) manually. Please give the new instructions a try and tell me what happens.

enchy commented 9 years ago

@rhyolight yes I have a 32bit system. Sorry I forgot to mention it.

I installed gcc-4.7.3 and swig 3.0.2 following the wiki. But I guess I am not correctly passing the swig executive to the command. Because in the output, the Swig version is still 1.3.36. Could you have a look?

python setup.py install --cmake_options="-DSWIG_EXECUTABLE=`/usr/local/bin/swig`" --user

I also tried something like

python setup.py install --cmake_options="-DSWIG_EXECUTABLE=/usr/local/bin/swig" --user

I suppose I am making some horrible mistakes here. Should be ashamed of that. But I want to make this work. So please tolerate my silly questions. :)

Thanks.

rhyolight commented 9 years ago

@enchy When you type which swig and swig --version what do you get? Try something like this to clean up before you attempt to install again:

cd $NUPIC
git clean -dfx # this will remove all locally-added files and directories not in source control
pip uninstall nupic # may or may not do anything, but just in case
python setup.py install --cmake_options="-DSWIG_EXECUTABLE=`which swig`" --user
enchy commented 9 years ago

@rhyolight I got /usr/local/bin/swig from which swig, and

SWIG Version 3.0.2
Compiled with g++ [i686-pc-linux-gnu]
Configured options: +pcre

from swig -version.

I tried the cleaning up. pip uninstall nupic didn't work as you expected. And the problem was still there. I'm a bit concerned about the first few lines of the output of the installation. Do you think they are normal?

Must specify an input file. Use -help for available options.
Python 2.7.3
You should logoff your system in order to some environment variables are changed permanently. If the problem persists, consider set manually the variables above in your 'bashrc' file

Is there anything that I can provide to make the situation clearer?

Thanks.

rhyolight commented 9 years ago

@enchy

Must specify an input file. Use -help for available options.
Python 2.7.3
You should logoff your system in order to some environment variables are changed permanently. If the problem persists, consider set manually the variables above in your 'bashrc' file

This concerns me, too. What command outputs this warning? Please copy and paste both the command and the complete console output to pastebin.com or something so I can see the whole thing.

Thanks!

enchy commented 9 years ago

@rhyolight

I found what's wrong with this output... I doubt that you'd ever expect this ignorance from a user... I didn't know that the back quotes indicate executing the command in between. And I didn't realize what the "which swig" means until I read all your replies again. So I mistook the which swig for something that I should replace with the real path, and as a result the swig executable was called, thus the "Must specify...." output. (facepalm...)

Realizing this, I finally strictly followed your line of python setup.py install --cmake_options="-DSWIG_EXECUTABLE=which swig" --user. But the swig was still pointed to the old version in linux32/bin. And when I deleted it, the program simply couldn't find the swig. Somehow the additional argument was not working. So I tried replacing the old version of swig in linux32/bin with my own swig executable. And ta-da! It finally worked. :)

Thank you for your patience with me. I might have given up on this were it not for your being there for me. It has been fun and educational (new knowledge! better later than never...).

One last note, though, do you think it would be better to update the swig version in the installation package for linux 32, making it easier for other users (hopefully not so ignorant of Linux commands as me)?

rhyolight commented 9 years ago

You got it working, great!

One last note, though, do you think it would be better to update the swig version in the installation package for linux 32, making it easier for other users (hopefully not so ignorant of Linux commands as me)?

We actually don't support 32b linux, so... :confused: