mcmtroffaes / pycddlib

A Python wrapper for Komei Fukuda's cddlib.
http://packages.python.org/pycddlib/
GNU General Public License v2.0
59 stars 9 forks source link

pip install on Ubuntu 22.04 #54

Closed anagorko closed 2 years ago

anagorko commented 2 years ago

After upgrade to Ubuntu 22.04 pip install fails:

python -m venv .venv
source .venv/bin/activate
python -m pip install pycddlib
Collecting pycddlib
  Using cached pycddlib-2.1.4.tar.gz (265 kB)
  Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for pycddlib, since package 'wheel' is not installed.
Installing collected packages: pycddlib
  Running setup.py install for pycddlib ... error
  error: subprocess-exited-with-error

  × Running setup.py install for pycddlib did not run successfully.
  │ exit code: 1
  ╰─> [189 lines of output]
      /home/amn/reps/tst/.venv/lib/python3.10/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
        warnings.warn(
      WARNING: The wheel package is not available.
      running install
      /home/amn/reps/tst/.venv/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_ext
      skipping 'cdd.c' Cython extension (up-to-date)
      building 'cdd' extension
      creating build
      creating build/temp.linux-x86_64-3.10
      creating build/temp.linux-x86_64-3.10/cddlib
      creating build/temp.linux-x86_64-3.10/cddlib/lib-src
      x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DGMPRATIONAL -Icddlib/lib-src -I/home/amn/reps/tst/.venv/include -I/usr/include/python3.10 -c cdd.c -o build/temp.linux-x86_64-3.10/cdd.o
      cdd.c: In function ‘__pyx_f_3cdd_libc_stdio_tmpfile’:
      cdd.c:2425:3: warning: label ‘__pyx_L1_error’ defined but not used [-Wunused-label]
       2425 |   __pyx_L1_error:;
            |   ^~~~~~~~~~~~~~
      cdd.c:2307:7: warning: unused variable ‘__pyx_t_1’ [-Wunused-variable]
       2307 |   int __pyx_t_1;
            |       ^~~~~~~~~
      cdd.c:2304:9: warning: unused variable ‘__pyx_v_name’ [-Wunused-variable]
       2304 |   char *__pyx_v_name;
            |         ^~~~~~~~~~~~
      cdd.c: In function ‘__pyx_f_3cdd__get_set’:
      cdd.c:2768:69: warning: comparison of integer expressions of different signedness: ‘long int’ and ‘long unsigned int’ [-Wsign-compare]
       2768 |     for (__pyx_7genexpr__pyx_v_elem = 1; __pyx_7genexpr__pyx_v_elem <= __pyx_t_2; __pyx_7genexpr__pyx_v_elem++) {
            |                                                                     ^~
      cdd.c: In function ‘__pyx_f_3cdd__set_set’:
      cdd.c:2863:39: warning: comparison of integer expressions of different signedness: ‘long int’ and ‘long unsigned int’ [-Wsign-compare]
       2863 |   for (__pyx_v_elem = 1; __pyx_v_elem <= __pyx_t_1; __pyx_v_elem++) {
            |                                       ^~
      cdd.c: In function ‘__pyx_tp_dealloc_3cdd_Matrix’:
      cdd.c:20463:5: error: lvalue required as increment operand
      20463 |     ++Py_REFCNT(o);
            |     ^~
      cdd.c:20465:5: error: lvalue required as decrement operand
      20465 |     --Py_REFCNT(o);
            |     ^~
      cdd.c: In function ‘__pyx_tp_dealloc_3cdd_LinProg’:
      cdd.c:20668:5: error: lvalue required as increment operand
      20668 |     ++Py_REFCNT(o);
            |     ^~
      cdd.c:20670:5: error: lvalue required as decrement operand
      20670 |     --Py_REFCNT(o);
            |     ^~
      cdd.c: In function ‘__pyx_tp_dealloc_3cdd_Polyhedron’:
      cdd.c:20815:5: error: lvalue required as increment operand
      20815 |     ++Py_REFCNT(o);
            |     ^~
      cdd.c:20817:5: error: lvalue required as decrement operand
      20817 |     --Py_REFCNT(o);
            |     ^~
      cdd.c: In function ‘__Pyx_decode_c_bytes’:
      cdd.c:23923:9: warning: ‘PyUnicode_FromUnicode’ is deprecated [-Wdeprecated-declarations]
      23923 |         return PyUnicode_FromUnicode(NULL, 0);
            |         ^~~~~~
      In file included from /usr/include/python3.10/unicodeobject.h:1046,
                       from /usr/include/python3.10/Python.h:83,
                       from cdd.c:4:
      /usr/include/python3.10/cpython/unicodeobject.h:551:42: note: declared here
        551 | Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode(
            |                                          ^~~~~~~~~~~~~~~~~~~~~
      cdd.c: In function ‘__Pyx_ParseOptionalKeywords’:
      cdd.c:24309:21: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
      24309 |                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
            |                     ^
      In file included from /usr/include/python3.10/unicodeobject.h:1046,
                       from /usr/include/python3.10/Python.h:83,
                       from cdd.c:4:
      /usr/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
        446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
            |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
      cdd.c:24309:21: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
      24309 |                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
            |                     ^
      In file included from /usr/include/python3.10/unicodeobject.h:1046,
                       from /usr/include/python3.10/Python.h:83,
                       from cdd.c:4:
      /usr/include/python3.10/cpython/unicodeobject.h:580:45: note: declared here
        580 | Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
            |                                             ^~~~~~~~~~~~~~~~~~~
      cdd.c:24309:21: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
      24309 |                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
            |                     ^
      In file included from /usr/include/python3.10/unicodeobject.h:1046,
                       from /usr/include/python3.10/Python.h:83,
                       from cdd.c:4:
      /usr/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
        446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
            |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
      cdd.c:24309:21: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
      24309 |                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
            |                     ^
      In file included from /usr/include/python3.10/unicodeobject.h:1046,
                       from /usr/include/python3.10/Python.h:83,
                       from cdd.c:4:
      /usr/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
        446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
            |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
      cdd.c:24309:21: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
      24309 |                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
            |                     ^
      In file included from /usr/include/python3.10/unicodeobject.h:1046,
                       from /usr/include/python3.10/Python.h:83,
                       from cdd.c:4:
      /usr/include/python3.10/cpython/unicodeobject.h:580:45: note: declared here
        580 | Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
            |                                             ^~~~~~~~~~~~~~~~~~~
      cdd.c:24309:21: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
      24309 |                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
            |                     ^
      In file included from /usr/include/python3.10/unicodeobject.h:1046,
                       from /usr/include/python3.10/Python.h:83,
                       from cdd.c:4:
      /usr/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
        446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
            |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
      cdd.c:24325:25: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
      24325 |                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
            |                         ^
      In file included from /usr/include/python3.10/unicodeobject.h:1046,
                       from /usr/include/python3.10/Python.h:83,
                       from cdd.c:4:
      /usr/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
        446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
            |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
      cdd.c:24325:25: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
      24325 |                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
            |                         ^
      In file included from /usr/include/python3.10/unicodeobject.h:1046,
                       from /usr/include/python3.10/Python.h:83,
                       from cdd.c:4:
      /usr/include/python3.10/cpython/unicodeobject.h:580:45: note: declared here
        580 | Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
            |                                             ^~~~~~~~~~~~~~~~~~~
      cdd.c:24325:25: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
      24325 |                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
            |                         ^
      In file included from /usr/include/python3.10/unicodeobject.h:1046,
                       from /usr/include/python3.10/Python.h:83,
                       from cdd.c:4:
      /usr/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
        446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
            |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
      cdd.c:24325:25: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
      24325 |                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
            |                         ^
      In file included from /usr/include/python3.10/unicodeobject.h:1046,
                       from /usr/include/python3.10/Python.h:83,
                       from cdd.c:4:
      /usr/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
        446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
            |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
      cdd.c:24325:25: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
      24325 |                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
            |                         ^
      In file included from /usr/include/python3.10/unicodeobject.h:1046,
                       from /usr/include/python3.10/Python.h:83,
                       from cdd.c:4:
      /usr/include/python3.10/cpython/unicodeobject.h:580:45: note: declared here
        580 | Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
            |                                             ^~~~~~~~~~~~~~~~~~~
      cdd.c:24325:25: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
      24325 |                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
            |                         ^
      In file included from /usr/include/python3.10/unicodeobject.h:1046,
                       from /usr/include/python3.10/Python.h:83,
                       from cdd.c:4:
      /usr/include/python3.10/cpython/unicodeobject.h:446:26: note: declared here
        446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
            |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
      cdd.c: In function ‘__Pyx_Coroutine_Send’:
      cdd.c:27868:19: warning: implicit declaration of function ‘_PyGen_Send’; did you mean ‘_PyGen_yf’? [-Wimplicit-function-declaration]
      27868 |             ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
            |                   ^~~~~~~~~~~
            |                   _PyGen_yf
      cdd.c:27868:17: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      27868 |             ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
            |                 ^
      cdd.c:27873:17: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      27873 |             ret = _PyGen_Send((PyGenObject*)yf, value == Py_None ? NULL : value);
            |                 ^
      cdd.c: In function ‘__Pyx_Generator_Next’:
      cdd.c:27957:17: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
      27957 |             ret = _PyGen_Send((PyGenObject*)yf, NULL);
            |                 ^
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pycddlib

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

I managed to install everything from source. I'm including steps below for others that may have similar issue.

  1. I cloned this repository
  2. I ran "git submodule update --init", which failed. Had to run
echo -e '[url "https://github.com/"]\n  insteadOf = "git://github.com/"' >> ~/.gitconfig

first.

3.

cd cddlib/
./bootstrap
./configure
make
cd ..
  1. And
    python setup.py build build_ext
    python setup.py install

    finally worked

mcmtroffaes commented 2 years ago

Thanks for reporting. I don't have Ubuntu 22.04 for testing myself. In my quick testing, it does work on Ubuntu 20.04 for Python 3.8 on Windows under WSL2. It also works for Python 3.10 under Windows. I'll see if I can set up regression testing with github actions to get more comprehensive testing against a more recent Ubuntu with more recent versions of Python.

Do you have any clue yourself as to what is triggering the error?

mcmtroffaes commented 2 years ago

Looking closer at the error messages, this seems like a duplicate of #53.

mcmtroffaes commented 2 years ago

2. I ran "git submodule update --init", which failed. Had to run

echo -e '[url "https://github.com/"]\n  insteadOf = "git://github.com/"' >> ~/.gitconfig

first.

This should now be fixed with https://github.com/mcmtroffaes/pycddlib/commit/9ae7f38c448e9bb848cfc28f89ed3952058ff79e

mcmtroffaes commented 2 years ago

Closing as duplicate... I think I got a fix, will discuss in #53.

anagorko commented 2 years ago

Thank you for such a quick response! I can confirm that the problem is fixed.

mcmtroffaes commented 2 years ago

Awesome, thanks for testing it out and confirming!