forcedotcom / distributions

Low-level primitives for collapsed Gibbs sampling in python and C++
BSD 3-Clause "New" or "Revised" License
33 stars 25 forks source link

Installation and compilation errors #48

Closed twiecki closed 10 years ago

twiecki commented 10 years ago
pip install distributions

Downloading/unpacking distributions
  Downloading distributions-2.0.0.tar.gz (67kB): 67kB downloaded
  Running setup.py egg_info for package distributions
    building cython extensions
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/home/wiecki/envs/pymc3/build/distributions/setup.py", line 48, in <module>
        with open('README.md') as f:
    IOError: [Errno 2] No such file or directory: 'README.md'
    Complete output from command python setup.py egg_info:
    building cython extensions

Traceback (most recent call last):

  File "<string>", line 16, in <module>

  File "/home/wiecki/envs/pymc3/build/distributions/setup.py", line 48, in <module>

    with open('README.md') as f:

IOError: [Errno 2] No such file or directory: 'README.md'

I then tried to pip install directly from the github repo but got:

building 'distributions.hp.random' extension

x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Iinclude -Idistributions -I/home/wiecki/envs/pymc3/local/lib/python2.7/site-packages/numpy/core/include -I/usr/include/python2.7 -c distributions/hp/random.cpp -o build/temp.linux-x86_64-2.7/distributions/hp/random.o -DDIST_DEBUG_LEVEL=3 -DDIST_THROW_ON_ERROR=1 -std=c++0x -Wall -Werror -Wno-unused-function -Wno-sign-compare -Wno-strict-aliasing -O3 -ffast-math -funsafe-math-optimizations -mfpmath=sse -msse4.1 -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION

cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]

distributions/hp/random.cpp: In function ‘int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject*, Py_buffer*, int)’:

distributions/hp/random.cpp:2044:52: error: ‘NPY_C_CONTIGUOUS’ was not declared in this scope

     __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0);

                                                    ^

distributions/hp/random.cpp:2082:52: error: ‘NPY_F_CONTIGUOUS’ was not declared in this scope

     __pyx_t_1 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0);

                                                    ^

distributions/hp/random.cpp:2245:42: error: ‘PyArrayObject’ has no member named ‘descr’

   __pyx_t_4 = ((PyObject *)__pyx_v_self->descr);

                                          ^

In file included from /usr/include/python2.7/Python.h:80:0,

                 from distributions/hp/random.cpp:16:

distributions/hp/random.cpp: In function ‘void __pyx_f_5numpy_set_array_base(PyArrayObject*, PyObject*)’:

distributions/hp/random.cpp:3797:27: error: ‘PyArrayObject’ has no member named ‘base’

   Py_XDECREF(__pyx_v_arr->base);

                           ^

/usr/include/python2.7/object.h:823:34: note: in definition of macro ‘Py_XDECREF’

 #define Py_XDECREF(op) do { if ((op) == NULL) ; else Py_DECREF(op); } while (0)

                                  ^

distributions/hp/random.cpp:3797:27: error: ‘PyArrayObject’ has no member named ‘base’

   Py_XDECREF(__pyx_v_arr->base);

                           ^

/usr/include/python2.7/object.h:772:24: note: in definition of macro ‘Py_DECREF’

         --((PyObject*)(op))->ob_refcnt != 0)            \

                        ^

distributions/hp/random.cpp:3797:3: note: in expansion of macro ‘Py_XDECREF’

   Py_XDECREF(__pyx_v_arr->base);

   ^

distributions/hp/random.cpp:3797:27: error: ‘PyArrayObject’ has no member named ‘base’

   Py_XDECREF(__pyx_v_arr->base);

                           ^

/usr/include/python2.7/object.h:115:47: note: in definition of macro ‘Py_TYPE’

 #define Py_TYPE(ob)             (((PyObject*)(ob))->ob_type)

                                               ^

/usr/include/python2.7/object.h:775:9: note: in expansion of macro ‘_Py_Dealloc’

         _Py_Dealloc((PyObject *)(op));                  \

         ^

/usr/include/python2.7/object.h:823:54: note: in expansion of macro ‘Py_DECREF’

 #define Py_XDECREF(op) do { if ((op) == NULL) ; else Py_DECREF(op); } while (0)

                                                      ^

distributions/hp/random.cpp:3797:3: note: in expansion of macro ‘Py_XDECREF’

   Py_XDECREF(__pyx_v_arr->base);

   ^

distributions/hp/random.cpp:3797:27: error: ‘PyArrayObject’ has no member named ‘base’

   Py_XDECREF(__pyx_v_arr->base);

                           ^

/usr/include/python2.7/object.h:762:45: note: in definition of macro ‘_Py_Dealloc’

     (*Py_TYPE(op)->tp_dealloc)((PyObject *)(op)))

                                             ^

/usr/include/python2.7/object.h:823:54: note: in expansion of macro ‘Py_DECREF’

 #define Py_XDECREF(op) do { if ((op) == NULL) ; else Py_DECREF(op); } while (0)

                                                      ^

distributions/hp/random.cpp:3797:3: note: in expansion of macro ‘Py_XDECREF’

   Py_XDECREF(__pyx_v_arr->base);

   ^

distributions/hp/random.cpp:3806:16: error: ‘PyArrayObject’ has no member named ‘base’

   __pyx_v_arr->base = __pyx_v_baseptr;

                ^

distributions/hp/random.cpp: In function ‘PyObject* __pyx_f_5numpy_get_array_base(PyArrayObject*)’:

distributions/hp/random.cpp:3841:30: error: ‘PyArrayObject’ has no member named ‘base’

   __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);

                              ^

In file included from /usr/include/python2.7/Python.h:80:0,

                 from distributions/hp/random.cpp:16:

distributions/hp/random.cpp:3864:44: error: ‘PyArrayObject’ has no member named ‘base’

     __Pyx_INCREF(((PyObject *)__pyx_v_arr->base));

                                            ^

/usr/include/python2.7/object.h:767:18: note: in definition of macro ‘Py_INCREF’

     ((PyObject*)(op))->ob_refcnt++)

                  ^

distributions/hp/random.cpp:3864:5: note: in expansion of macro ‘__Pyx_INCREF’

     __Pyx_INCREF(((PyObject *)__pyx_v_arr->base));

     ^

distributions/hp/random.cpp:3865:41: error: ‘PyArrayObject’ has no member named ‘base’

     __pyx_r = ((PyObject *)__pyx_v_arr->base);

                                         ^

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

This is with most recent cython and numpy 1.8.1.

fritzo commented 10 years ago

Hi Thomas, I just loaded the latest version 2.0.7 to pypi. Let me know if pip install distributions works for you now. -Fritz

twiecki commented 10 years ago

Now I'm getting the error I got when installing via git.

fritzo commented 10 years ago

I've seen similar errors due to an old cython ( < 0.20.1). What is your cython --version? Would you mind trying pip install --upgrade cython && pip install distributions? And what is your platform? I can try installing on a fresh instance.

twiecki commented 10 years ago

That was my first thought, but:

>>cython --version                                                                                                       
Cython version 0.20.1 

This is kubuntu 14.04 64-bit.

I can get it to work by removing '-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION' from setup.py.

fritzo commented 10 years ago

OK, So I got distributions to build on 14.04 by adding -Wno-error=cpp to setup.py (now pushed to master).

twiecki commented 10 years ago

Yep, works for me too now.