spectralDNS / shenfun

High performance computational platform in Python for the spectral Galerkin method
http://shenfun.readthedocs.org
BSD 2-Clause "Simplified" License
204 stars 42 forks source link

Installation problem: error in "cimport fastgl_wrap" #82

Open yesint opened 3 years ago

yesint commented 3 years ago

I'm trying to install shenfun using pip on Ubuntu 18.04. I've installed openmpi and fftw3 from repositories and then getting the following:

$ pip3 install  --no-cache-dir shenfun
Collecting shenfun
  Downloading https://files.pythonhosted.org/packages/11/5f/c02c93b27d4fac8e2fa027d32c5c07b02e11f875d1eb48d1fe158954bd2d/shenfun-3.2.2.tar.gz (172kB)
    100% |████████████████████████████████| 174kB 7.4MB/s 
Collecting cython (from shenfun)
  Downloading https://files.pythonhosted.org/packages/d7/04/5890b30102782a3ec9970df3c10f024298803d89624ee23cf75d09bd2548/Cython-0.29.24-cp36-cp36m-manylinux1_x86_64.whl (2.0MB)
    100% |████████████████████████████████| 2.0MB 23.3MB/s 
Collecting mpi4py (from shenfun)
  Downloading https://files.pythonhosted.org/packages/bd/d3/b1e686fcf2fe1677fa010f0a29a1b8a8cd3fd56161aacd59c5be252fe382/mpi4py-3.1.1.tar.gz (2.4MB)
    100% |████████████████████████████████| 2.5MB 16.8MB/s 
Collecting mpi4py-fft (from shenfun)
  Downloading https://files.pythonhosted.org/packages/81/83/686c0a0476b2a17414daf458afaca65441313b034cadd6f80290aff6b5b7/mpi4py-fft-2.0.4.tar.gz
Collecting numpy (from shenfun)
  Downloading https://files.pythonhosted.org/packages/45/b2/6c7545bb7a38754d63048c7696804a0d947328125d81bf12beaa692c3ae3/numpy-1.19.5-cp36-cp36m-manylinux1_x86_64.whl (13.4MB)
    100% |████████████████████████████████| 13.4MB 28.9MB/s 
Collecting scipy (from shenfun)
  Downloading https://files.pythonhosted.org/packages/c8/89/63171228d5ced148f5ced50305c89e8576ffc695a90b58fe5bb602b910c2/scipy-1.5.4-cp36-cp36m-manylinux1_x86_64.whl (25.9MB)
    100% |████████████████████████████████| 25.9MB 29.9MB/s 
Installing collected packages: cython, mpi4py, numpy, mpi4py-fft, scipy, shenfun
  Running setup.py install for mpi4py ... done
  Running setup.py install for mpi4py-fft ... done
  Running setup.py install for shenfun ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-p53fo13v/shenfun/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-wnm8nwgd-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/shenfun
    copying shenfun/__init__.py -> build/lib.linux-x86_64-3.6/shenfun
    copying shenfun/coordinates.py -> build/lib.linux-x86_64-3.6/shenfun
    copying shenfun/tensorproductspace.py -> build/lib.linux-x86_64-3.6/shenfun
    copying shenfun/matrixbase.py -> build/lib.linux-x86_64-3.6/shenfun
    copying shenfun/la.py -> build/lib.linux-x86_64-3.6/shenfun
    copying shenfun/spectralbase.py -> build/lib.linux-x86_64-3.6/shenfun
    copying shenfun/config.py -> build/lib.linux-x86_64-3.6/shenfun
    creating build/lib.linux-x86_64-3.6/shenfun/optimization
    copying shenfun/optimization/__init__.py -> build/lib.linux-x86_64-3.6/shenfun/optimization
    creating build/lib.linux-x86_64-3.6/shenfun/optimization/cython
    copying shenfun/optimization/cython/__init__.py -> build/lib.linux-x86_64-3.6/shenfun/optimization/cython
    creating build/lib.linux-x86_64-3.6/shenfun/optimization/numba
    copying shenfun/optimization/numba/pdma.py -> build/lib.linux-x86_64-3.6/shenfun/optimization/numba
    copying shenfun/optimization/numba/diagma.py -> build/lib.linux-x86_64-3.6/shenfun/optimization/numba
    copying shenfun/optimization/numba/chebyshev.py -> build/lib.linux-x86_64-3.6/shenfun/optimization/numba
    copying shenfun/optimization/numba/__init__.py -> build/lib.linux-x86_64-3.6/shenfun/optimization/numba
    copying shenfun/optimization/numba/fdma.py -> build/lib.linux-x86_64-3.6/shenfun/optimization/numba
    copying shenfun/optimization/numba/helmholtz.py -> build/lib.linux-x86_64-3.6/shenfun/optimization/numba
    copying shenfun/optimization/numba/biharmonic.py -> build/lib.linux-x86_64-3.6/shenfun/optimization/numba
    copying shenfun/optimization/numba/legendre.py -> build/lib.linux-x86_64-3.6/shenfun/optimization/numba
    copying shenfun/optimization/numba/tdma.py -> build/lib.linux-x86_64-3.6/shenfun/optimization/numba
    copying shenfun/optimization/numba/la.py -> build/lib.linux-x86_64-3.6/shenfun/optimization/numba
    copying shenfun/optimization/numba/twodma.py -> build/lib.linux-x86_64-3.6/shenfun/optimization/numba
    creating build/lib.linux-x86_64-3.6/shenfun/legendre
    copying shenfun/legendre/__init__.py -> build/lib.linux-x86_64-3.6/shenfun/legendre
    copying shenfun/legendre/matrices.py -> build/lib.linux-x86_64-3.6/shenfun/legendre
    copying shenfun/legendre/la.py -> build/lib.linux-x86_64-3.6/shenfun/legendre
    copying shenfun/legendre/bases.py -> build/lib.linux-x86_64-3.6/shenfun/legendre
    copying shenfun/legendre/lobatto.py -> build/lib.linux-x86_64-3.6/shenfun/legendre
    creating build/lib.linux-x86_64-3.6/shenfun/legendre/fastgl
    copying shenfun/legendre/fastgl/__init__.py -> build/lib.linux-x86_64-3.6/shenfun/legendre/fastgl
    creating build/lib.linux-x86_64-3.6/shenfun/laguerre
    copying shenfun/laguerre/__init__.py -> build/lib.linux-x86_64-3.6/shenfun/laguerre
    copying shenfun/laguerre/matrices.py -> build/lib.linux-x86_64-3.6/shenfun/laguerre
    copying shenfun/laguerre/bases.py -> build/lib.linux-x86_64-3.6/shenfun/laguerre
    creating build/lib.linux-x86_64-3.6/shenfun/hermite
    copying shenfun/hermite/__init__.py -> build/lib.linux-x86_64-3.6/shenfun/hermite
    copying shenfun/hermite/matrices.py -> build/lib.linux-x86_64-3.6/shenfun/hermite
    copying shenfun/hermite/bases.py -> build/lib.linux-x86_64-3.6/shenfun/hermite
    creating build/lib.linux-x86_64-3.6/shenfun/chebyshev
    copying shenfun/chebyshev/__init__.py -> build/lib.linux-x86_64-3.6/shenfun/chebyshev
    copying shenfun/chebyshev/quasi.py -> build/lib.linux-x86_64-3.6/shenfun/chebyshev
    copying shenfun/chebyshev/heinrichsbiharmonic.py -> build/lib.linux-x86_64-3.6/shenfun/chebyshev
    copying shenfun/chebyshev/matrices.py -> build/lib.linux-x86_64-3.6/shenfun/chebyshev
    copying shenfun/chebyshev/la.py -> build/lib.linux-x86_64-3.6/shenfun/chebyshev
    copying shenfun/chebyshev/bases.py -> build/lib.linux-x86_64-3.6/shenfun/chebyshev
    creating build/lib.linux-x86_64-3.6/shenfun/fourier
    copying shenfun/fourier/__init__.py -> build/lib.linux-x86_64-3.6/shenfun/fourier
    copying shenfun/fourier/matrices.py -> build/lib.linux-x86_64-3.6/shenfun/fourier
    copying shenfun/fourier/bases.py -> build/lib.linux-x86_64-3.6/shenfun/fourier
    creating build/lib.linux-x86_64-3.6/shenfun/jacobi
    copying shenfun/jacobi/__init__.py -> build/lib.linux-x86_64-3.6/shenfun/jacobi
    copying shenfun/jacobi/matrices.py -> build/lib.linux-x86_64-3.6/shenfun/jacobi
    copying shenfun/jacobi/bases.py -> build/lib.linux-x86_64-3.6/shenfun/jacobi
    creating build/lib.linux-x86_64-3.6/shenfun/forms
    copying shenfun/forms/__init__.py -> build/lib.linux-x86_64-3.6/shenfun/forms
    copying shenfun/forms/operators.py -> build/lib.linux-x86_64-3.6/shenfun/forms
    copying shenfun/forms/project.py -> build/lib.linux-x86_64-3.6/shenfun/forms
    copying shenfun/forms/arguments.py -> build/lib.linux-x86_64-3.6/shenfun/forms
    copying shenfun/forms/inner.py -> build/lib.linux-x86_64-3.6/shenfun/forms
    creating build/lib.linux-x86_64-3.6/shenfun/utilities
    copying shenfun/utilities/__init__.py -> build/lib.linux-x86_64-3.6/shenfun/utilities
    copying shenfun/utilities/lagrangian_particles.py -> build/lib.linux-x86_64-3.6/shenfun/utilities
    copying shenfun/utilities/integrators.py -> build/lib.linux-x86_64-3.6/shenfun/utilities
    creating build/lib.linux-x86_64-3.6/shenfun/io
    copying shenfun/io/__init__.py -> build/lib.linux-x86_64-3.6/shenfun/io
    running build_ext
    cythoning /tmp/pip-build-p53fo13v/shenfun/shenfun/optimization/cython/Matvec.pyx to /tmp/pip-build-p53fo13v/shenfun/shenfun/optimization/cython/Matvec.cpp
    warning: shenfun/optimization/cython/Matvec.pyx:1657:14: the result of using negative indices inside of code sections marked as 'wraparound=False' is undefined
    warning: shenfun/optimization/cython/Matvec.pyx:1657:22: the result of using negative indices inside of code sections marked as 'wraparound=False' is undefined
    cythoning /tmp/pip-build-p53fo13v/shenfun/shenfun/optimization/cython/la.pyx to /tmp/pip-build-p53fo13v/shenfun/shenfun/optimization/cython/la.cpp
    cythoning /tmp/pip-build-p53fo13v/shenfun/shenfun/optimization/cython/evaluate.pyx to /tmp/pip-build-p53fo13v/shenfun/shenfun/optimization/cython/evaluate.cpp
    cythoning /tmp/pip-build-p53fo13v/shenfun/shenfun/legendre/fastgl/fastgl_wrap.pyx to /tmp/pip-build-p53fo13v/shenfun/shenfun/legendre/fastgl/fastgl_wrap.cpp
    /home/semen/.local/lib/python3.6/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-build-p53fo13v/shenfun/shenfun/legendre/fastgl/fastgl_wrap.pyx
      tree = Parsing.p_module(s, pxd, full_module_name)

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
    cimport fastgl_wrap
           ^
    ------------------------------------------------------------

    shenfun/legendre/fastgl/fastgl_wrap.pyx:1:8: 'shenfun/legendre/fastgl/fastgl_wrap.pxd' not found

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
        N : int
            The total number of quadrature points
        k : int
            The k'th point in the N-point quadrature rule
        """
        f = fastgl_wrap.GLPair(N, k)
                      ^
    ------------------------------------------------------------

    shenfun/legendre/fastgl/fastgl_wrap.pyx:19:19: cimported module has no attribute 'GLPair'

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
        N : int
            The total number of quadrature points
        k : int
            The k'th point in the N-point quadrature rule
        """
        f = fastgl_wrap.GLPair(N, k)
                      ^
    ------------------------------------------------------------

    shenfun/legendre/fastgl/fastgl_wrap.pyx:19:19: Compiler crash in AnalyseExpressionsTransform

    ModuleNode.body = StatListNode(fastgl_wrap.pyx:1:0)
    StatListNode.stats[2] = StatListNode(fastgl_wrap.pyx:9:0)
    StatListNode.stats[0] = DefNode(fastgl_wrap.pyx:9:0,
        doc = "Return point and weight k for N-point Gauss-Legendre rule\n\n    Parameters\n    ----------\n    N : int\n        The total number of quadrature points\n    k : int\n        The k'th point in the N-point quadrature rule\n    ",
        modifiers = [...]/0,
        name = 'getGLPair',
        np_args_idx = [...]/0,
        num_required_args = 2,
        outer_attrs = [...]/2,
        py_wrapper_required = True,
        reqd_kw_flags_cname = '0',
        used = True)
    File 'ExprNodes.py', line 5362, in infer_type: SimpleCallNode(fastgl_wrap.pyx:19:26,
        result_is_used = True,
        use_managed_ref = True)
    File 'ExprNodes.py', line 6845, in infer_type: AttributeNode(fastgl_wrap.pyx:19:19,
        attribute = 'GLPair',
        is_attribute = 1,
        needs_none_check = True,
        result_is_used = True,
        use_managed_ref = True)

    Compiler crash traceback from this point on:
      File "/home/semen/.local/lib/python3.6/site-packages/Cython/Compiler/ExprNodes.py", line 6845, in infer_type
        if node.entry.type and node.entry.type.is_cfunction:
    AttributeError: 'NoneType' object has no attribute 'type'
    cythoning /tmp/pip-build-p53fo13v/shenfun/shenfun/optimization/cython/Cheb.pyx to /tmp/pip-build-p53fo13v/shenfun/shenfun/optimization/cython/Cheb.c
    /home/semen/.local/lib/python3.6/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-build-p53fo13v/shenfun/shenfun/optimization/cython/Cheb.pyx
      tree = Parsing.p_module(s, pxd, full_module_name)
    cythoning /tmp/pip-build-p53fo13v/shenfun/shenfun/optimization/cython/convolve.pyx to /tmp/pip-build-p53fo13v/shenfun/shenfun/optimization/cython/convolve.c
    /home/semen/.local/lib/python3.6/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-build-p53fo13v/shenfun/shenfun/optimization/cython/convolve.pyx
      tree = Parsing.p_module(s, pxd, full_module_name)
    cythoning /tmp/pip-build-p53fo13v/shenfun/shenfun/optimization/cython/outer.pyx to /tmp/pip-build-p53fo13v/shenfun/shenfun/optimization/cython/outer.c
    cythoning /tmp/pip-build-p53fo13v/shenfun/shenfun/optimization/cython/applymask.pyx to /tmp/pip-build-p53fo13v/shenfun/shenfun/optimization/cython/applymask.c
    building 'shenfun.optimization.cython.Matvec' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/tmp
    creating build/temp.linux-x86_64-3.6/tmp/pip-build-p53fo13v
    creating build/temp.linux-x86_64-3.6/tmp/pip-build-p53fo13v/shenfun
    creating build/temp.linux-x86_64-3.6/tmp/pip-build-p53fo13v/shenfun/shenfun
    creating build/temp.linux-x86_64-3.6/tmp/pip-build-p53fo13v/shenfun/shenfun/optimization
    creating build/temp.linux-x86_64-3.6/tmp/pip-build-p53fo13v/shenfun/shenfun/optimization/cython
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/semen/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c /tmp/pip-build-p53fo13v/shenfun/shenfun/optimization/cython/Matvec.cpp -o build/temp.linux-x86_64-3.6/tmp/pip-build-p53fo13v/shenfun/shenfun/optimization/cython/Matvec.o -g0 -O3 -w -Ofast -ffast-math -march=native
    x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.6/tmp/pip-build-p53fo13v/shenfun/shenfun/optimization/cython/Matvec.o -lm -o build/lib.linux-x86_64-3.6/shenfun/optimization/cython/Matvec.cpython-36m-x86_64-linux-gnu.so -std=c++11
    building 'shenfun.optimization.cython.la' extension
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/semen/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c /tmp/pip-build-p53fo13v/shenfun/shenfun/optimization/cython/la.cpp -o build/temp.linux-x86_64-3.6/tmp/pip-build-p53fo13v/shenfun/shenfun/optimization/cython/la.o -g0 -O3 -w -Ofast -ffast-math -march=native
    x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.6/tmp/pip-build-p53fo13v/shenfun/shenfun/optimization/cython/la.o -lm -o build/lib.linux-x86_64-3.6/shenfun/optimization/cython/la.cpython-36m-x86_64-linux-gnu.so -std=c++11
    building 'shenfun.optimization.cython.evaluate' extension
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/semen/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c /tmp/pip-build-p53fo13v/shenfun/shenfun/optimization/cython/evaluate.cpp -o build/temp.linux-x86_64-3.6/tmp/pip-build-p53fo13v/shenfun/shenfun/optimization/cython/evaluate.o -g0 -O3 -w -Ofast -ffast-math -march=native
    x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.6/tmp/pip-build-p53fo13v/shenfun/shenfun/optimization/cython/evaluate.o -lm -o build/lib.linux-x86_64-3.6/shenfun/optimization/cython/evaluate.cpython-36m-x86_64-linux-gnu.so -std=c++11
    building 'shenfun.legendre.fastgl.fastgl_wrap' extension
    creating build/temp.linux-x86_64-3.6/tmp/pip-build-p53fo13v/shenfun/shenfun/legendre
    creating build/temp.linux-x86_64-3.6/tmp/pip-build-p53fo13v/shenfun/shenfun/legendre/fastgl
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/semen/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c /tmp/pip-build-p53fo13v/shenfun/shenfun/legendre/fastgl/fastgl_wrap.cpp -o build/temp.linux-x86_64-3.6/tmp/pip-build-p53fo13v/shenfun/shenfun/legendre/fastgl/fastgl_wrap.o -g0 -O3 -w -Ofast -ffast-math -march=native
    /tmp/pip-build-p53fo13v/shenfun/shenfun/legendre/fastgl/fastgl_wrap.cpp:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
     #error Do not use this file, it is the result of a failed Cython compilation.
      ^~~~~
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-p53fo13v/shenfun/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-wnm8nwgd-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-p53fo13v/shenfun/

What should I do to overcome this error?

mikaem commented 3 years ago

Strange, that looks more or less like the fixed issue #76

yesint commented 3 years ago

Strange, that looks more or less like the fixed issue #76

You are right, the latest git version works. It seems that pip repository still contains outdated version where this issue is not fixed.