Skip to content
This repository has been archived by the owner on Jun 8, 2018. It is now read-only.

installation fails on SMC #12

Open
videlec opened this issue Sep 15, 2016 · 13 comments
Open

installation fails on SMC #12

videlec opened this issue Sep 15, 2016 · 13 comments

Comments

@videlec
Copy link
Owner

videlec commented Sep 15, 2016

Problems on SageMath cloud sagemathinc/cocalc#905

@saliola
Copy link

saliola commented Mar 6, 2017

Has there been any progress on this? It would be good to have this installed on SMC.

I just tried "sage -pip insall pypolymake --user" in a terminal on SMC. The installation process works, but there is still the same ImportError: ... polymake/perl_object.so: undefined symbol...

@videlec
Copy link
Owner Author

videlec commented Mar 6, 2017

Could you try with

$ sage -f polymake
$ sage -pip install git+https://github.com/videlec/pypolymake

And also give access to the full log.

@saliola
Copy link

saliola commented Mar 7, 2017 via email

@haraldschilly
Copy link

Hello, I'm working on a new compute environment for CoCalc (new name for SMC), and now I have such a logfile for Sage 7.6.

Collecting git+https://github.com/videlec/pypolymake
  Cloning https://github.com/videlec/pypolymake to /tmp/pip-gWR7u0-build
    Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info/pypolymake.egg-info
    writing pip-egg-info/pypolymake.egg-info/PKG-INFO
    writing top-level names to pip-egg-info/pypolymake.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/pypolymake.egg-info/dependency_links.txt
    writing manifest file 'pip-egg-info/pypolymake.egg-info/SOURCES.txt'
    warning: polymake/handlers.pyx:80:19: local variable 'ans' referenced before assignment
    warning: polymake/handlers.pyx:81:14: local variable 'ans' referenced before assignment
    warning: polymake/handlers.pyx:84:26: local variable 'ans' referenced before assignment
    warning: polymake/handlers.pyx:85:14: local variable 'ans' referenced before assignment
    warning: polymake/handlers.pyx:89:21: local variable 'ans' referenced before assignment
    warning: polymake/handlers.pyx:90:14: local variable 'ans' referenced before assignment
    warning: polymake/handlers.pyx:93:28: local variable 'ans' referenced before assignment
    warning: polymake/handlers.pyx:94:14: local variable 'ans' referenced before assignment
    
    Error compiling Cython file:
    ------------------------------------------------------------
    ...
    #                  http://www.gnu.org/licenses/
    ###############################################################################
    
    from __future__ import absolute_import
    
    from .number cimport Integer, Rational
    ^
    ------------------------------------------------------------
    
    polymake/sage_conversion.pyx:15:0: 'polymake/number.pxd' not found
    
    Error compiling Cython file:
    ------------------------------------------------------------
    ...
    #                  http://www.gnu.org/licenses/
    ###############################################################################
    
    from __future__ import absolute_import
    
    from .number cimport Integer, Rational
    ^
    ------------------------------------------------------------
    
    polymake/sage_conversion.pyx:15:0: 'polymake/number/Integer.pxd' not found
    
    Error compiling Cython file:
    ------------------------------------------------------------
    ...
    #                  http://www.gnu.org/licenses/
    ###############################################################################
    
    from __future__ import absolute_import
    
    from .number cimport Integer, Rational
    ^
    ------------------------------------------------------------
    
    polymake/sage_conversion.pyx:15:0: 'polymake/number/Rational.pxd' not found
    
    Error compiling Cython file:
    ------------------------------------------------------------
    ...
    
    from __future__ import absolute_import
    
    from .number cimport Integer, Rational
    from .vector cimport VectorInteger, VectorRational
    from .matrix cimport (MatrixInt, MatrixInteger, MatrixRational,
    ^
    ------------------------------------------------------------
    
    polymake/sage_conversion.pyx:17:0: 'polymake/matrix/pm_MatrixInt_get.pxd' not found
    
    Error compiling Cython file:
    ------------------------------------------------------------
    ...
    
    from __future__ import absolute_import
    
    from .number cimport Integer, Rational
    from .vector cimport VectorInteger, VectorRational
    from .matrix cimport (MatrixInt, MatrixInteger, MatrixRational,
    ^
    ------------------------------------------------------------
    
    polymake/sage_conversion.pyx:17:0: 'polymake/matrix/pm_MatrixInteger_get.pxd' not found
    
    Error compiling Cython file:
    ------------------------------------------------------------
    ...
    
    from __future__ import absolute_import
    
    from .number cimport Integer, Rational
    from .vector cimport VectorInteger, VectorRational
    from .matrix cimport (MatrixInt, MatrixInteger, MatrixRational,
    ^
    ------------------------------------------------------------
    
    polymake/sage_conversion.pyx:17:0: 'polymake/matrix/pm_MatrixRational_get.pxd' not found
    
    Error compiling Cython file:
    ------------------------------------------------------------
    ...
    from sage.modules.vector_integer_dense cimport Vector_integer_dense as sage_Vector_integer_dense
    from sage.modules.vector_rational_dense cimport Vector_rational_dense as sage_Vector_rational_dense
    from sage.matrix.matrix_rational_dense cimport Matrix_rational_dense as sage_Matrix_rational_dense
    from sage.matrix.matrix_integer_dense cimport Matrix_integer_dense as sage_Matrix_integer_dense
    
    def Integer_to_sage(Integer n):
                       ^
    ------------------------------------------------------------
    
    polymake/sage_conversion.pyx:40:20: 'Integer' is not a type identifier
    
    Error compiling Cython file:
    ------------------------------------------------------------
    ...
    def Integer_to_sage(Integer n):
        cdef sage_Integer ans = PY_NEW(sage_Integer)
        ans.set_from_mpz(<mpz_t>n.pm_obj.get_rep())
        return ans
    
    def Rational_to_sage(Rational q):
                        ^
    ------------------------------------------------------------
    
    polymake/sage_conversion.pyx:45:21: 'Rational' is not a type identifier
    
    Error compiling Cython file:
    ------------------------------------------------------------
    ...
    from sage.matrix.matrix_rational_dense cimport Matrix_rational_dense as sage_Matrix_rational_dense
    from sage.matrix.matrix_integer_dense cimport Matrix_integer_dense as sage_Matrix_integer_dense
    
    def Integer_to_sage(Integer n):
        cdef sage_Integer ans = PY_NEW(sage_Integer)
        ans.set_from_mpz(<mpz_t>n.pm_obj.get_rep())
                        ^
    ------------------------------------------------------------
    
    polymake/sage_conversion.pyx:42:21: Casting temporary Python object to non-numeric non-Python type
    
    Error compiling Cython file:
    ------------------------------------------------------------
    ...
        ans.set_from_mpz(<mpz_t>n.pm_obj.get_rep())
        return ans
    
    def Rational_to_sage(Rational q):
        cdef sage_Rational ans = sage_Rational.__new__(sage_Rational)
        ans.set_from_mpq(<mpq_t>q.pm_obj.get_rep())
                        ^
    ------------------------------------------------------------
    
    polymake/sage_conversion.pyx:47:21: Casting temporary Python object to non-numeric non-Python type
    
    Error compiling Cython file:
    ------------------------------------------------------------
    ...
        cdef Py_ssize_t ncols = m.pm_obj.cols()
        M = MatrixSpace(ZZ, nrows, ncols)
        cdef sage_Matrix_integer_dense ans = M.zero().__copy__()
        for i in range(nrows):
            for j in range(ncols):
                ans.set_unsafe_si(i, j, pm_MatrixInt_get(m.pm_obj, i, j))
                                                         ^
    ------------------------------------------------------------
    
    polymake/sage_conversion.pyx:77:54: Cannot convert 'pm_MatrixInt' to Python object
    
    Error compiling Cython file:
    ------------------------------------------------------------
    ...
        cdef Py_ssize_t ncols = m.pm_obj.cols()
        M = MatrixSpace(ZZ, nrows, ncols)
        cdef sage_Matrix_integer_dense ans = M.zero().__copy__()
        for i in range(nrows):
            for j in range(ncols):
                ans.set_unsafe_mpz(i, j, <mpz_t> pm_MatrixInteger_get(m.pm_obj, i, j).get_rep())
                                                                      ^
    ------------------------------------------------------------
    
    polymake/sage_conversion.pyx:88:67: Cannot convert 'pm_MatrixInteger' to Python object
    
    Error compiling Cython file:
    ------------------------------------------------------------
    ...
        cdef Py_ssize_t ncols = m.pm_obj.cols()
        M = MatrixSpace(ZZ, nrows, ncols)
        cdef sage_Matrix_integer_dense ans = M.zero().__copy__()
        for i in range(nrows):
            for j in range(ncols):
                ans.set_unsafe_mpz(i, j, <mpz_t> pm_MatrixInteger_get(m.pm_obj, i, j).get_rep())
                                        ^
    ------------------------------------------------------------
    
    polymake/sage_conversion.pyx:88:37: Casting temporary Python object to non-numeric non-Python type
    
    Error compiling Cython file:
    ------------------------------------------------------------
    ...
        cdef Py_ssize_t ncols = m.pm_obj.cols()
        M = MatrixSpace(QQ, nrows, ncols)
        cdef sage_Matrix_rational_dense ans = M.zero().__copy__()
        for i in range(nrows):
            for j in range(ncols):
                mpq_set(ans._matrix[i][j], <mpq_t> pm_MatrixRational_get(m.pm_obj, i, j).get_rep())
                                                                         ^
    ------------------------------------------------------------
    
    polymake/sage_conversion.pyx:99:70: Cannot convert 'pm_MatrixRational' to Python object
    
    Error compiling Cython file:
    ------------------------------------------------------------
    ...
        cdef Py_ssize_t ncols = m.pm_obj.cols()
        M = MatrixSpace(QQ, nrows, ncols)
        cdef sage_Matrix_rational_dense ans = M.zero().__copy__()
        for i in range(nrows):
            for j in range(ncols):
                mpq_set(ans._matrix[i][j], <mpq_t> pm_MatrixRational_get(m.pm_obj, i, j).get_rep())
                                          ^
    ------------------------------------------------------------
    
    polymake/sage_conversion.pyx:99:39: Casting temporary Python object to non-numeric non-Python type
    *** Rebuilding handlers and mappings ***
    Map.h                     -->  map.pxd
    Set.h                     -->  set.pxd
    Matrix.h                  -->  matrix.pxd
    QuadraticExtension.h      -->  quadratic_extension.pxd
    PowerSet.h                -->  power_set.pxd
    Vector.h                  -->  vector.pxd
    Rational.h                -->  rational.pxd
    Polynomial.h              -->  polynomial.pxd
    Integer.h                 -->  integer.pxd
    Array.h                   -->  array.pxd
    RationalFunction.h        -->  rational_function.pxd
    IncidenceMatrix.h         -->  incidence_matrix.pxd
    SparseMatrix.h            -->  sparse_matrix.pxd
    polymake/sage_conversion.pyx: cannot find cimported module '.number'
    Compiling polymake/cygmp/utils.pyx because it changed.
    Compiling polymake/perl_object.pyx because it changed.
    Compiling polymake/main.pyx because it changed.
    Compiling polymake/handlers.pyx because it changed.
    Compiling polymake/big_object.pyx because it changed.
    Compiling polymake/array.pyx because it changed.
    Compiling polymake/incidence_matrix.pyx because it changed.
    Compiling polymake/integer.pyx because it changed.
    Compiling polymake/map.pyx because it changed.
    Compiling polymake/matrix.pyx because it changed.
    Compiling polymake/polynomial.pyx because it changed.
    Compiling polymake/power_set.pyx because it changed.
    Compiling polymake/quadratic_extension.pyx because it changed.
    Compiling polymake/rational.pyx because it changed.
    Compiling polymake/rational_function.pyx because it changed.
    Compiling polymake/set.pyx because it changed.
    Compiling polymake/sparse_matrix.pyx because it changed.
    Compiling polymake/vector.pyx because it changed.
    Compiling polymake/sage_conversion.pyx because it changed.
    [ 1/19] Cythonizing polymake/array.pyx
    [ 2/19] Cythonizing polymake/big_object.pyx
    [ 3/19] Cythonizing polymake/cygmp/utils.pyx
    [ 4/19] Cythonizing polymake/handlers.pyx
    [ 5/19] Cythonizing polymake/incidence_matrix.pyx
    [ 6/19] Cythonizing polymake/integer.pyx
    [ 7/19] Cythonizing polymake/main.pyx
    [ 8/19] Cythonizing polymake/map.pyx
    [ 9/19] Cythonizing polymake/matrix.pyx
    [10/19] Cythonizing polymake/perl_object.pyx
    [11/19] Cythonizing polymake/polynomial.pyx
    [12/19] Cythonizing polymake/power_set.pyx
    [13/19] Cythonizing polymake/quadratic_extension.pyx
    [14/19] Cythonizing polymake/rational.pyx
    [15/19] Cythonizing polymake/rational_function.pyx
    [16/19] Cythonizing polymake/sage_conversion.pyx
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-gWR7u0-build/setup.py", line 141, in <module>
        cmdclass = {'build_ext': build_ext, 'test': TestCommand}
      File "/ext/sage/sage-7.6/local/lib/python/distutils/core.py", line 151, in setup
        dist.run_commands()
      File "/ext/sage/sage-7.6/local/lib/python/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/ext/sage/sage-7.6/local/lib/python/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/ext/sage/sage-7.6/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 279, in run
        self.find_sources()
      File "/ext/sage/sage-7.6/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 294, in find_sources
        mm.run()
      File "/ext/sage/sage-7.6/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 521, in run
        self.add_defaults()
      File "/ext/sage/sage-7.6/local/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 557, in add_defaults
        sdist.add_defaults(self)
      File "/ext/sage/sage-7.6/local/lib/python2.7/site-packages/setuptools/command/py36compat.py", line 36, in add_defaults
        self._add_defaults_ext()
      File "/ext/sage/sage-7.6/local/lib/python2.7/site-packages/setuptools/command/py36compat.py", line 119, in _add_defaults_ext
        build_ext = self.get_finalized_command('build_ext')
      File "/ext/sage/sage-7.6/local/lib/python/distutils/cmd.py", line 312, in get_finalized_command
        cmd_obj.ensure_finalized()
      File "/ext/sage/sage-7.6/local/lib/python/distutils/cmd.py", line 109, in ensure_finalized
        self.finalize_options()
      File "/tmp/pip-gWR7u0-build/setup.py", line 123, in finalize_options
        self.distribution.ext_modules, include_path=sys.path)
      File "/ext/sage/sage-7.6/local/lib/python2.7/site-packages/Cython/Build/Dependencies.py", line 934, in cythonize
        cythonize_one(*args)
      File "/ext/sage/sage-7.6/local/lib/python2.7/site-packages/Cython/Build/Dependencies.py", line 1056, in cythonize_one
        raise CompileError(None, pyx_file)
    Cython.Compiler.Errors.CompileError: polymake/sage_conversion.pyx
    
    ----------------------------------------

@videlec
Copy link
Owner Author

videlec commented Jun 21, 2017

Thanks for the report. There was indeed some import issues could you try again

$ sage -pip install git+https://github.com/videlec/pypolymake

I tried on 8.0.beta9 (which needed an extra hack to take care of a change of datastructure of rational matrices).

@haraldschilly
Copy link

Now it fails right here, and indeed, I don't this this fmpq_mat in sage 7.6. Does it only work in 8.0?

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
    from .cygmp.mpz cimport mpz_set
    from .cygmp.mpq cimport mpq_set
    
    from sage.ext.stdsage cimport PY_NEW
    from sage.libs.flint.fmpq cimport fmpq_set_mpq
    from sage.libs.flint.fmpq_mat cimport fmpq_mat_entry
    ^
    ------------------------------------------------------------
    
    polymake/sage_conversion.pyx:27:0: 'sage/libs/flint/fmpq_mat.pxd' not found
    
    Error compiling Cython file:
    ------------------------------------------------------------
    ...
    from .cygmp.mpz cimport mpz_set
    from .cygmp.mpq cimport mpq_set
    
    from sage.ext.stdsage cimport PY_NEW
    from sage.libs.flint.fmpq cimport fmpq_set_mpq
    from sage.libs.flint.fmpq_mat cimport fmpq_mat_entry
    ^
    ------------------------------------------------------------
    
    polymake/sage_conversion.pyx:27:0: 'sage/libs/flint/fmpq_mat/fmpq_mat_entry.pxd' not found

and

/ext/sage/sage/src/sage/libs/flint$ ls fmpq*
fmpq.pxd  fmpq_poly.pxd

@videlec
Copy link
Owner Author

videlec commented Jun 22, 2017

Thanks for testing again. It was my bad, commit 18e87ea makes the import conditional.

@haraldschilly
Copy link

Better, but I have to bother you again. Now it fails with some gcc compilation error:

    polymake/perl_object.cpp: In function ‘PyObject* __pyx_f_8polymake_11perl_object_get_properties(__pyx_obj_8polymake_11perl_object_PerlObject*, int)’:
    polymake/perl_object.cpp:1600:79: error: ‘call_function’ was not declared in this scope
         __pyx_t_4 = call_function(((std::string)__pyx_t_3), (__pyx_v_p->pm_obj[0]));
                                                                                   ^
    polymake/perl_object.cpp: In function ‘PyObject* __pyx_f_8polymake_11perl_object_get_methods(__pyx_obj_8polymake_11perl_object_PerlObject*, int)’:
    polymake/perl_object.cpp:1888:79: error: ‘call_function’ was not declared in this scope
         __pyx_t_4 = call_function(((std::string)__pyx_t_3), (__pyx_v_p->pm_obj[0]));
                                                                                   ^

Logfile: https://cocalc.com/projects/14eed217-2d3c-4975-a381-b69edcb40e0e/files/scratch/pypolymake-2.log

GCC is gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

@videlec
Copy link
Owner Author

videlec commented Jun 22, 2017

Random try... I added explicitely the namespace polymake::call_function in 39b3af3.

@haraldschilly
Copy link

Sorry, but this leads to almost exactly the same issue:

    /ext/sage/sage-7.6/local/include/polymake/Bitset.h: In member function ‘bool pm::Bitset_iterator::at_end() const’:
    /ext/sage/sage-7.6/local/include/polymake/Bitset.h:78:22: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
                  diff==0 && !(mpz_getlimbn(bits, n) & (mp_limb_t)(-1) << (cur%bits_per_limb));
                          ^
    polymake/perl_object.cpp: In function ‘PyObject* __pyx_f_8polymake_11perl_object_get_properties(__pyx_obj_8polymake_11perl_object_PerlObject*, int)’:
    polymake/perl_object.cpp:1600:17: error: ‘call_function’ is not a member of ‘polymake’
         __pyx_t_4 = polymake::call_function(((std::string)__pyx_t_3), (__pyx_v_p->pm_obj[0]));
                     ^
    polymake/perl_object.cpp: In function ‘PyObject* __pyx_f_8polymake_11perl_object_get_methods(__pyx_obj_8polymake_11perl_object_PerlObject*, int)’:
    polymake/perl_object.cpp:1888:17: error: ‘call_function’ is not a member of ‘polymake’
         __pyx_t_4 = polymake::call_function(((std::string)__pyx_t_3), (__pyx_v_p->pm_obj[0]));
                     ^

@videlec
Copy link
Owner Author

videlec commented Jun 23, 2017

BTW, which polymake do you have?

@haraldschilly
Copy link

Well, I suppose the one in Sage? Let me check, ok, I hope this helps:

salvus@4ea60463b738:/$ sage -sh
[ ... ]
Note: SAGE_ROOT=/ext/sage/sage-7.6

(sage-sh) salvus@4ea60463b738:/$ polymake --version
polymake version 3.0
Copyright (c) 1997-2015
Ewgenij Gawrilow, Michael Joswig (TU Berlin)
http://www.polymake.org

This is free software licensed under GPL; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

(sage-sh) salvus@4ea60463b738:/$ which polymake
/ext/sage/sage-7.6/local/bin/polymake

@videlec
Copy link
Owner Author

videlec commented Jun 23, 2017

That might be the source of the troubles, I have

$ ./sage -polymake --version
polymake version 3.1

It has been upgraded for 8.0.beta0. I am recompiling sage 7.6 to see whether it can be fixed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants