Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation error due to pybind11 #19

Closed
ghost opened this issue May 6, 2021 · 12 comments
Closed

Installation error due to pybind11 #19

ghost opened this issue May 6, 2021 · 12 comments

Comments

@ghost
Copy link

ghost commented May 6, 2021

When installing oceanmesh personalized python library with pip install -U -e . in the oceanmeshmater directorym I get a long big thread of errors due to pybind11.
I already installed the requirements sudo apt install libcgal-dev python3-pybind11.

The log with the errors from the installation of oceanmesh with pip is bellow. Did you get the same kind of errors? How could I solve this?

Installing collected packages: oceanmesh
  Running setup.py develop for oceanmesh
    ERROR: Command errored out with exit status 1:
     command: /home/nuno/resources/miniconda3/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/nuno/universidade/tese/unst_grid_generation/oceanmesh-master/setup.py'"'"'; __file__='"'"'/home/nuno/universidade/tese/unst_grid_generation/oceanmesh-master/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps
         cwd: /home/nuno/universidade/tese/unst_grid_generation/oceanmesh-master/
    Complete output (107 lines):
    running develop
    running egg_info
    writing oceanmesh.egg-info/PKG-INFO
    writing dependency_links to oceanmesh.egg-info/dependency_links.txt
    writing requirements to oceanmesh.egg-info/requires.txt
    writing top-level names to oceanmesh.egg-info/top_level.txt
    reading manifest file 'oceanmesh.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'oceanmesh.egg-info/SOURCES.txt'
    running build_ext
    -- OS detected: Linux
    -- CXX Compiler detected: GNU
    -- CMake additional search path for libraries:
    -- Using header-only CGAL
    -- Targetting Unix Makefiles
    -- Using /usr/bin/c++ compiler.
    -- Boost version: 1.65.1
    -- Boost include dirs: /usr/include
    -- Boost libraries:
    -- Using gcc version 4 or later. Adding -frounding-math
    -- CGAL version: 5.00.0.100
    -- Build type: Release
    -- USING CXXFLAGS = '-DVERSION_INFO=\"0.0.1\" -O3 -DNDEBUG'
    -- USING EXEFLAGS = ' '
    -- Requested component: MPFR
    -- Requested component: GMP
    -- Found pybind11 v2.0.1: /usr/include;/home/nuno/resources/miniconda3/include/python3.8
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/nuno/universidade/tese/unst_grid_generation/oceanmesh-master/build/temp.linux-x86_64-3.8
    [ 25%] Building CXX object CMakeFiles/fast_geometry.dir/oceanmesh/cpp/fast_geometry.cpp.o
    [ 50%] Building CXX object CMakeFiles/delaunay_class.dir/oceanmesh/cpp/delaunay_class.cpp.o
    /home/nuno/universidade/tese/unst_grid_generation/oceanmesh-master/oceanmesh/cpp/fast_geometry.cpp: In function ‘pybind11::array unique_edges(pybind11::array_t<int, 17>)’:
    /home/nuno/universidade/tese/unst_grid_generation/oceanmesh-master/oceanmesh/cpp/fast_geometry.cpp:76:23: error: no matching function for call to ‘pybind11::buffer_info::buffer_info(int*, long unsigned int, std::__cxx11::string, int, std::vector<long int>&, std::vector<long int>&)’
                           ));
                           ^
    In file included from /usr/include/pybind11/pytypes.h:12:0,
                     from /usr/include/pybind11/cast.h:13,
                     from /usr/include/pybind11/attr.h:13,
                     from /usr/include/pybind11/pybind11.h:36,
                     from /usr/include/pybind11/complex.h:12,
                     from /home/nuno/universidade/tese/unst_grid_generation/oceanmesh-master/oceanmesh/cpp/fast_geometry.cpp:2:
    /usr/include/pybind11/common.h:287:5: note: candidate: pybind11::buffer_info::buffer_info(pybind11::buffer_info&&)
         buffer_info(buffer_info &&other) {
         ^~~~~~~~~~~
    /usr/include/pybind11/common.h:287:5: note:   candidate expects 1 argument, 6 provided
    /usr/include/pybind11/common.h:274:14: note: candidate: pybind11::buffer_info::buffer_info(Py_buffer*, bool)
         explicit buffer_info(Py_buffer *view, bool ownview = true)
                  ^~~~~~~~~~~
    /usr/include/pybind11/common.h:274:14: note:   candidate expects 2 arguments, 6 provided
    /usr/include/pybind11/common.h:270:5: note: candidate: pybind11::buffer_info::buffer_info(void*, pybind11::size_t, const string&, pybind11::size_t)
         buffer_info(void *ptr, size_t itemsize, const std::string &format, size_t size)
         ^~~~~~~~~~~
    /usr/include/pybind11/common.h:270:5: note:   candidate expects 4 arguments, 6 provided
    /usr/include/pybind11/common.h:262:5: note: candidate: pybind11::buffer_info::buffer_info(void*, pybind11::size_t, const string&, pybind11::size_t, const std::vector<long unsigned int>&, const std::vector<long unsigned int>&)
         buffer_info(void *ptr, size_t itemsize, const std::string &format, size_t ndim,
         ^~~~~~~~~~~
    /usr/include/pybind11/common.h:262:5: note:   no known conversion for argument 5 from ‘std::vector<long int>’ to ‘const std::vector<long unsigned int>&’
    /usr/include/pybind11/common.h:260:5: note: candidate: pybind11::buffer_info::buffer_info()
         buffer_info() { }
         ^~~~~~~~~~~
    /usr/include/pybind11/common.h:260:5: note:   candidate expects 0 arguments, 6 provided
    /home/nuno/universidade/tese/unst_grid_generation/oceanmesh-master/oceanmesh/cpp/fast_geometry.cpp: At global scope:
    /home/nuno/universidade/tese/unst_grid_generation/oceanmesh-master/oceanmesh/cpp/fast_geometry.cpp:79:16: error: expected constructor, destructor, or type conversion before ‘(’ token
     PYBIND11_MODULE(fast_geometry, m) {
                    ^
    CMakeFiles/fast_geometry.dir/build.make:62: recipe for target 'CMakeFiles/fast_geometry.dir/oceanmesh/cpp/fast_geometry.cpp.o' failed
    make[2]: *** [CMakeFiles/fast_geometry.dir/oceanmesh/cpp/fast_geometry.cpp.o] Error 1
    CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/fast_geometry.dir/all' failed
    make[1]: *** [CMakeFiles/fast_geometry.dir/all] Error 2
    make[1]: *** Waiting for unfinished jobs....
    /home/nuno/universidade/tese/unst_grid_generation/oceanmesh-master/oceanmesh/cpp/delaunay_class.cpp:66:16: error: expected constructor, destructor, or type conversion before ‘(’ token
     PYBIND11_MODULE(delaunay_class, m) {
                    ^
    CMakeFiles/delaunay_class.dir/build.make:62: recipe for target 'CMakeFiles/delaunay_class.dir/oceanmesh/cpp/delaunay_class.cpp.o' failed
    make[2]: *** [CMakeFiles/delaunay_class.dir/oceanmesh/cpp/delaunay_class.cpp.o] Error 1
    CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/delaunay_class.dir/all' failed
    make[1]: *** [CMakeFiles/delaunay_class.dir/all] Error 2
    Makefile:83: recipe for target 'all' failed
    make: *** [all] Error 2
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/nuno/universidade/tese/unst_grid_generation/oceanmesh-master/setup.py", line 81, in <module>
        setup(
      File "/home/nuno/resources/miniconda3/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "/home/nuno/resources/miniconda3/lib/python3.8/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/home/nuno/resources/miniconda3/lib/python3.8/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/home/nuno/resources/miniconda3/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/home/nuno/resources/miniconda3/lib/python3.8/site-packages/setuptools/command/develop.py", line 34, in run
        self.install_for_development()
      File "/home/nuno/resources/miniconda3/lib/python3.8/site-packages/setuptools/command/develop.py", line 136, in install_for_development
        self.run_command('build_ext')
      File "/home/nuno/resources/miniconda3/lib/python3.8/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/home/nuno/resources/miniconda3/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/home/nuno/universidade/tese/unst_grid_generation/oceanmesh-master/setup.py", line 44, in run
        self.build_extension(ext)
      File "/home/nuno/universidade/tese/unst_grid_generation/oceanmesh-master/setup.py", line 76, in build_extension
        subprocess.check_call(
      File "/home/nuno/resources/miniconda3/lib/python3.8/subprocess.py", line 364, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j2']' returned non-zero exit status 2.
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/nuno/resources/miniconda3/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/nuno/universidade/tese/unst_grid_generation/oceanmesh-master/setup.py'"'"'; __file__='"'"'/home/nuno/universidade/tese/unst_grid_generation/oceanmesh-master/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output.

@krober10nd
Copy link
Collaborator

Hey @nunormont probably you need to use a newer C++ compiler. What version of C++ did you use?

I don't actively develop this code here at the currently due to other projects but I can of course help out if you want to achieve a particular goal.

@ghost
Copy link
Author

ghost commented May 6, 2021

So here are my versions of cpp and g++ (the compiler is g++ isn't it?)

cpp (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I have to update g++ and cpp? I use the Ubuntu 18.04 OS by the way.

@krober10nd
Copy link
Collaborator

Looks like you're using

    -- Using /usr/bin/c++ compiler.
    -- Using gcc version 4 or later. Adding -frounding-math

I would set the CXX variable to point to your C++ compiler that supports std14

@ghost
Copy link
Author

ghost commented May 6, 2021

Sorry if I'm not understanding, but the CXX variable is defined in ~/.bashrc or in other specific CMake of oceanmesh?

@krober10nd
Copy link
Collaborator

It's alright,

export CXX=/path/to/cpp/compiler

@ghost
Copy link
Author

ghost commented May 6, 2021

Yes I actually did that and I sourced the bashrc. In my case I did this: export CXX=/usr/bin/g++ but got the same error. I also tried export CXX=/usr/bin/cpp but it didn't solve the problem either. Before that, I updated the CPP compiler from g++-7 to g++-8, with the methodology here: https://www.bojankomazec.com/2020/03/upgrading-gnu-cc-compilers-on-ubuntu.html.

@krober10nd
Copy link
Collaborator

Hmm I'll have to take a closer look then tomorrow when I have a chance. Maybe something changed in the new pybind11

@ghost
Copy link
Author

ghost commented May 7, 2021

Thank you, I'll also try to dive deep into that.

@krober10nd
Copy link
Collaborator

Okay could you try to uninstall the apt-get version of pybind11 and try to use pip install pybind11 -U instead? It seems this is a common problem with installations of pybind11 by searching the error message:

 error: expected constructor, destructor, or type conversion before ‘(’ token

@ghost
Copy link
Author

ghost commented May 11, 2021

I uninstalled and purged python3-pybind11 and did pip install pybind11 -U as you instructed, and I still get errors:
(...)

Installing collected packages: oceanmesh
  Running setup.py develop for oceanmesh
    ERROR: Command errored out with exit status 1:
     command: /home/nuno/resources/miniconda3/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/nuno/universidade/tese/unst_grid_generation/oceanmesh-python/setup.py'"'"'; __file__='"'"'/home/nuno/universidade/tese/unst_grid_generation/oceanmesh-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps
         cwd: /home/nuno/universidade/tese/unst_grid_generation/oceanmesh-python/
    Complete output (77 lines):
    running develop
    running egg_info
    writing oceanmesh.egg-info/PKG-INFO
    writing dependency_links to oceanmesh.egg-info/dependency_links.txt
    writing requirements to oceanmesh.egg-info/requires.txt
    writing top-level names to oceanmesh.egg-info/top_level.txt
    reading manifest file 'oceanmesh.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'oceanmesh.egg-info/SOURCES.txt'
    running build_ext
    -- OS detected: Linux
    -- CXX Compiler detected: GNU
    -- CMake additional search path for libraries:
    -- Using header-only CGAL
    -- Targetting Unix Makefiles
    -- Using /usr/bin/c++ compiler.
    -- Boost version: 1.65.1
    -- Boost include dirs: /usr/include
    -- Boost libraries:
    -- Using gcc version 4 or later. Adding -frounding-math
    -- CGAL version: 5.00.0.100
    -- Build type: Release
    -- USING CXXFLAGS = ' -O3 -DNDEBUG'
    -- USING EXEFLAGS = ' '
    -- Requested component: MPFR
    -- Requested component: GMP
    CMake Warning at CMakeLists.txt:31 (find_package):
      By not providing "Findpybind11.cmake" in CMAKE_MODULE_PATH this project has
      asked CMake to find a package configuration file provided by "pybind11",
      but CMake did not find one.
    
      Could not find a package configuration file provided by "pybind11" with any
      of the following names:
    
        pybind11Config.cmake
        pybind11-config.cmake
    
      Add the installation prefix of "pybind11" to CMAKE_PREFIX_PATH or set
      "pybind11_DIR" to a directory containing one of the above files.  If
      "pybind11" provides a separate development package or SDK, be sure it has
      been installed.
    
    
    -- Found pybind11 v:
    CMake Error at CMakeLists.txt:35 (pybind11_add_module):
      Unknown CMake command "pybind11_add_module".
    
    
    -- Configuring incomplete, errors occurred!
    See also "/home/nuno/universidade/tese/unst_grid_generation/oceanmesh-python/CMakeFiles/CMakeOutput.log".
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/nuno/universidade/tese/unst_grid_generation/oceanmesh-python/setup.py", line 78, in <module>
        setup(
      File "/home/nuno/resources/miniconda3/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "/home/nuno/resources/miniconda3/lib/python3.8/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/home/nuno/resources/miniconda3/lib/python3.8/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/home/nuno/resources/miniconda3/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/home/nuno/resources/miniconda3/lib/python3.8/site-packages/setuptools/command/develop.py", line 34, in run
        self.install_for_development()
      File "/home/nuno/resources/miniconda3/lib/python3.8/site-packages/setuptools/command/develop.py", line 136, in install_for_development
        self.run_command('build_ext')
      File "/home/nuno/resources/miniconda3/lib/python3.8/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/home/nuno/resources/miniconda3/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/home/nuno/universidade/tese/unst_grid_generation/oceanmesh-python/setup.py", line 42, in run
        self.build_extension(ext)
      File "/home/nuno/universidade/tese/unst_grid_generation/oceanmesh-python/setup.py", line 71, in build_extension
        subprocess.check_call(
      File "/home/nuno/resources/miniconda3/lib/python3.8/subprocess.py", line 364, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', '/home/nuno/universidade/tese/unst_grid_generation/oceanmesh-python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/home/nuno/universidade/tese/unst_grid_generation/oceanmesh-python/oceanmesh/cpp', '-DPYTHON_EXECUTABLE=/home/nuno/resources/miniconda3/bin/python', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/nuno/resources/miniconda3/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/nuno/universidade/tese/unst_grid_generation/oceanmesh-python/setup.py'"'"'; __file__='"'"'/home/nuno/universidade/tese/unst_grid_generation/oceanmesh-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps Check the logs for full command output.

@krober10nd
Copy link
Collaborator

Sorry, not sure, I don't have Ubuntu. Maybe build then pybind11 by source.

My other package uses the same build system and this is what one user recommended.

krober10nd/SeismicMesh#161

@ghost
Copy link
Author

ghost commented May 12, 2021

I solved my problem with those links. Thanks!

@ghost ghost closed this as completed May 12, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant