mjszczep / PyStasm

Python wrapper for finding features in faces.
Other
17 stars 6 forks source link

Install on Ubuntu 12.04(VirtualBox) #3

Open mrgloom opened 8 years ago

mrgloom commented 8 years ago

Here is my try to install Pystasm on Ubuntu 12.04

lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 12.04.5 LTS
Release:    12.04
Codename:   precise

gcc --version

gcc (Ubuntu 4.8.1-2ubuntu1~12.04) 4.8.1

sudo pip install PyStasm

Downloading/unpacking PyStasm
  Downloading PyStasm-0.3.1.tar.gz (687kB): 687kB downloaded
  Running setup.py egg_info for package PyStasm

Requirement already satisfied (use --upgrade to upgrade): numpy>=1.7 in /usr/local/lib/python2.7/dist-packages (from PyStasm)
Installing collected packages: PyStasm
  Running setup.py install for PyStasm

    building 'stasm._stasm' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -c src/landmarks.cpp -o build/temp.linux-x86_64-2.7/src/landmarks.o
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -c src/hatdesc.cpp -o build/temp.linux-x86_64-2.7/src/hatdesc.o
    src/hatdesc.cpp:63:0: warning: ignoring #pragma omp critical [-Wunknown-pragmas]
         #pragma omp critical                // prevent OpenMP concurrent access to cache_g
     ^
    src/hatdesc.cpp:76:0: warning: ignoring #pragma omp critical [-Wunknown-pragmas]
             #pragma omp critical            // prevent OpenMP concurrent access to cache_g
     ^
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -c src/shapehacks.cpp -o build/temp.linux-x86_64-2.7/src/shapehacks.o
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -c src/eyedet.cpp -o build/temp.linux-x86_64-2.7/src/eyedet.o
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -c src/stasm.cpp -o build/temp.linux-x86_64-2.7/src/stasm.o
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -c src/convshape.cpp -o build/temp.linux-x86_64-2.7/src/convshape.o
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -c src/err.cpp -o build/temp.linux-x86_64-2.7/src/err.o
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -c src/hat.cpp -o build/temp.linux-x86_64-2.7/src/hat.o
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -c src/shapemod.cpp -o build/temp.linux-x86_64-2.7/src/shapemod.o
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -c src/py_wrapper.cpp -o build/temp.linux-x86_64-2.7/src/py_wrapper.o
    src/py_wrapper.cpp: In function ‘PyObject* landmarks_to_PyArray(float*, int)’:
    src/py_wrapper.cpp:39:48: error: ‘NPY_ARRAY_OWNDATA’ was not declared in this scope
      PyArray_ENABLEFLAGS((PyArrayObject*)retArray, NPY_ARRAY_OWNDATA);
                                                    ^
    src/py_wrapper.cpp:39:65: error: ‘PyArray_ENABLEFLAGS’ was not declared in this scope
      PyArray_ENABLEFLAGS((PyArrayObject*)retArray, NPY_ARRAY_OWNDATA);
                                                                     ^
    In file included from /usr/include/python2.7/numpy/arrayobject.h:14:0,
                     from src/py_wrapper.cpp:12:
    src/py_wrapper.cpp: In function ‘const char* PyArray_to_image(PyObject*, int*, int*)’:
    src/py_wrapper.cpp:60:42: error: ‘NPY_ARRAY_IN_ARRAY’ was not declared in this scope
       PyArray_FROM_OTF(array_obj, NPY_UINT8, NPY_ARRAY_IN_ARRAY);
                                              ^
    /usr/include/python2.7/numpy/ndarrayobject.h:93:28: note: in definition of macro ‘PyArray_FROM_OTF’
                             (((flags) & NPY_ENSURECOPY) ?                         \
                                ^
    src/py_wrapper.cpp: In function ‘PyObject* Py_search_pinned(PyObject*, PyObject*)’:
    src/py_wrapper.cpp:299:32: error: ‘NPY_ARRAY_IN_ARRAY’ was not declared in this scope
             pinned_obj, NPY_FLOAT, NPY_ARRAY_IN_ARRAY);
                                    ^
    /usr/include/python2.7/numpy/ndarrayobject.h:93:28: note: in definition of macro ‘PyArray_FROM_OTF’
                             (((flags) & NPY_ENSURECOPY) ?                         \
                                ^
    src/py_wrapper.cpp: In function ‘PyObject* Py_force_points_into_image(PyObject*, PyObject*)’:
    src/py_wrapper.cpp:360:46: error: ‘NPY_ARRAY_IN_ARRAY’ was not declared in this scope
       PyArray_FROM_OTF(landmarks_obj, NPY_FLOAT, NPY_ARRAY_IN_ARRAY);
                                                  ^
    /usr/include/python2.7/numpy/ndarrayobject.h:93:28: note: in definition of macro ‘PyArray_FROM_OTF’
                             (((flags) & NPY_ENSURECOPY) ?                         \
                                ^
    src/py_wrapper.cpp: In function ‘PyObject* Py_convert_shape(PyObject*, PyObject*)’:
    src/py_wrapper.cpp:418:47: error: ‘NPY_ARRAY_IN_ARRAY’ was not declared in this scope
        PyArray_FROM_OTF(landmarks_obj, NPY_FLOAT, NPY_ARRAY_IN_ARRAY);
                                                   ^
    /usr/include/python2.7/numpy/ndarrayobject.h:93:28: note: in definition of macro ‘PyArray_FROM_OTF’
                             (((flags) & NPY_ENSURECOPY) ?                         \
                                ^
    error: command 'gcc' failed with exit status 1
    Complete output from command /usr/bin/python2.7 -c "import setuptools;__file__='/tmp/pip_build_root/PyStasm/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-a8Sxcs-record/install-record.txt --single-version-externally-managed:
    running install

running build

running build_py

creating build

creating build/lib.linux-x86_64-2.7

creating build/lib.linux-x86_64-2.7/stasm

copying stasm/__init__.py -> build/lib.linux-x86_64-2.7/stasm

running egg_info

writing requirements to PyStasm.egg-info/requires.txt

writing PyStasm.egg-info/PKG-INFO

writing top-level names to PyStasm.egg-info/top_level.txt

writing dependency_links to PyStasm.egg-info/dependency_links.txt

warning: manifest_maker: standard file '-c' not found

reading manifest file 'PyStasm.egg-info/SOURCES.txt'

reading manifest template 'MANIFEST.in'

writing manifest file 'PyStasm.egg-info/SOURCES.txt'

creating build/lib.linux-x86_64-2.7/stasm/data

copying stasm/data/README.txt -> build/lib.linux-x86_64-2.7/stasm/data

copying stasm/data/haarcascade_frontalface_alt2.xml -> build/lib.linux-x86_64-2.7/stasm/data

copying stasm/data/haarcascade_mcs_lefteye.xml -> build/lib.linux-x86_64-2.7/stasm/data

copying stasm/data/haarcascade_mcs_righteye.xml -> build/lib.linux-x86_64-2.7/stasm/data

copying stasm/data/testface.jpg -> build/lib.linux-x86_64-2.7/stasm/data

running build_ext

building 'stasm._stasm' extension

creating build/temp.linux-x86_64-2.7

creating build/temp.linux-x86_64-2.7/src

creating build/temp.linux-x86_64-2.7/src/MOD_1

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -c src/landmarks.cpp -o build/temp.linux-x86_64-2.7/src/landmarks.o

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -c src/hatdesc.cpp -o build/temp.linux-x86_64-2.7/src/hatdesc.o

src/hatdesc.cpp:63:0: warning: ignoring #pragma omp critical [-Wunknown-pragmas]

     #pragma omp critical                // prevent OpenMP concurrent access to cache_g

 ^

src/hatdesc.cpp:76:0: warning: ignoring #pragma omp critical [-Wunknown-pragmas]

         #pragma omp critical            // prevent OpenMP concurrent access to cache_g

 ^

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -c src/shapehacks.cpp -o build/temp.linux-x86_64-2.7/src/shapehacks.o

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -c src/eyedet.cpp -o build/temp.linux-x86_64-2.7/src/eyedet.o

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -c src/stasm.cpp -o build/temp.linux-x86_64-2.7/src/stasm.o

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -c src/convshape.cpp -o build/temp.linux-x86_64-2.7/src/convshape.o

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -c src/err.cpp -o build/temp.linux-x86_64-2.7/src/err.o

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -c src/hat.cpp -o build/temp.linux-x86_64-2.7/src/hat.o

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -c src/shapemod.cpp -o build/temp.linux-x86_64-2.7/src/shapemod.o

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -c src/py_wrapper.cpp -o build/temp.linux-x86_64-2.7/src/py_wrapper.o

src/py_wrapper.cpp: In function ‘PyObject* landmarks_to_PyArray(float*, int)’:

src/py_wrapper.cpp:39:48: error: ‘NPY_ARRAY_OWNDATA’ was not declared in this scope

  PyArray_ENABLEFLAGS((PyArrayObject*)retArray, NPY_ARRAY_OWNDATA);

                                                ^

src/py_wrapper.cpp:39:65: error: ‘PyArray_ENABLEFLAGS’ was not declared in this scope

  PyArray_ENABLEFLAGS((PyArrayObject*)retArray, NPY_ARRAY_OWNDATA);

                                                                 ^

In file included from /usr/include/python2.7/numpy/arrayobject.h:14:0,

                 from src/py_wrapper.cpp:12:

src/py_wrapper.cpp: In function ‘const char* PyArray_to_image(PyObject*, int*, int*)’:

src/py_wrapper.cpp:60:42: error: ‘NPY_ARRAY_IN_ARRAY’ was not declared in this scope

   PyArray_FROM_OTF(array_obj, NPY_UINT8, NPY_ARRAY_IN_ARRAY);

                                          ^

/usr/include/python2.7/numpy/ndarrayobject.h:93:28: note: in definition of macro ‘PyArray_FROM_OTF’

                         (((flags) & NPY_ENSURECOPY) ?                         \

                            ^

src/py_wrapper.cpp: In function ‘PyObject* Py_search_pinned(PyObject*, PyObject*)’:

src/py_wrapper.cpp:299:32: error: ‘NPY_ARRAY_IN_ARRAY’ was not declared in this scope

         pinned_obj, NPY_FLOAT, NPY_ARRAY_IN_ARRAY);

                                ^

/usr/include/python2.7/numpy/ndarrayobject.h:93:28: note: in definition of macro ‘PyArray_FROM_OTF’

                         (((flags) & NPY_ENSURECOPY) ?                         \

                            ^

src/py_wrapper.cpp: In function ‘PyObject* Py_force_points_into_image(PyObject*, PyObject*)’:

src/py_wrapper.cpp:360:46: error: ‘NPY_ARRAY_IN_ARRAY’ was not declared in this scope

   PyArray_FROM_OTF(landmarks_obj, NPY_FLOAT, NPY_ARRAY_IN_ARRAY);

                                              ^

/usr/include/python2.7/numpy/ndarrayobject.h:93:28: note: in definition of macro ‘PyArray_FROM_OTF’

                         (((flags) & NPY_ENSURECOPY) ?                         \

                            ^

src/py_wrapper.cpp: In function ‘PyObject* Py_convert_shape(PyObject*, PyObject*)’:

src/py_wrapper.cpp:418:47: error: ‘NPY_ARRAY_IN_ARRAY’ was not declared in this scope

    PyArray_FROM_OTF(landmarks_obj, NPY_FLOAT, NPY_ARRAY_IN_ARRAY);

                                               ^

/usr/include/python2.7/numpy/ndarrayobject.h:93:28: note: in definition of macro ‘PyArray_FROM_OTF’

                         (((flags) & NPY_ENSURECOPY) ?                         \

                            ^

error: command 'gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python2.7 -c "import setuptools;__file__='/tmp/pip_build_root/PyStasm/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-a8Sxcs-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip_build_root/PyStasm
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 9, in <module>
    load_entry_point('pip==1.4.1', 'console_scripts', 'pip')()
  File "/usr/local/lib/python2.7/dist-packages/pip-1.4.1-py2.7.egg/pip/__init__.py", line 148, in main
    return command.main(args[1:], options)
  File "/usr/local/lib/python2.7/dist-packages/pip-1.4.1-py2.7.egg/pip/basecommand.py", line 169, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 36: ordinal not in range(128)
mjszczep commented 8 years ago

Based on the compiler error, it looks like the numpy include headers it's using are older than 1.7. I know pip said it's up to date, but you can test to see if the macros it's missing are there using $ grep NPY_ARRAY_OWNDATA /usr/local/lib/python2.7/dist-packages/numpy/core/include/*.h. If it turns up empty, try updating numpy yourself.