fbertola / bgfx-python

Python 3.7+ wrapper for the BGFX library. 🐍
BSD 2-Clause "Simplified" License
121 stars 6 forks source link

pip install bgfx-python fails on macos 10.15.4 #8

Closed SuperSimon81 closed 4 years ago

SuperSimon81 commented 4 years ago

Hi and thank you for your efforts in making python bindings for bgfx

Im trying to install bgfx-python using pip on my machine running macos 10.15.4 and python 3.8. Any suggestions on how to proceed? Below is the terminal output of running pip install bgx-python

Simon


Collecting bgfx-python
  Using cached bgfx-python-1.0.1.tar.gz (81 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Building wheels for collected packages: bgfx-python
  Building wheel for bgfx-python (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/simon/.local/share/virtualenvs/Natrix-WiaOIT_y/bin/python /Users/simon/.local/share/virtualenvs/Natrix-WiaOIT_y/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /var/folders/8w/w3ptt2w10gq8gw8jlkw_x_dh0000gn/T/tmp0bnd9xbo
       cwd: /private/var/folders/8w/w3ptt2w10gq8gw8jlkw_x_dh0000gn/T/pip-install-unf6ib_s/bgfx-python
  Complete output (114 lines):
  Not searching for unused variables given on the command line.
  -- The C compiler identification is AppleClang 11.0.3.11030032
  -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
  -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - works
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- The CXX compiler identification is AppleClang 11.0.3.11030032
  -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
  -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - works
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Configuring done
  -- Generating done
  -- Build files have been written to: /private/var/folders/8w/w3ptt2w10gq8gw8jlkw_x_dh0000gn/T/pip-install-unf6ib_s/bgfx-python/_cmake_test_compile/build
  -- The C compiler identification is AppleClang 11.0.3.11030032
  -- The CXX compiler identification is AppleClang 11.0.3.11030032
  -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
  -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - works
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
  -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - works
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Found Python3: /Library/Frameworks/Python.framework/Versions/3.8/lib/libpython3.8.dylib (found version "3.8.0") found components: Development
  -- Found PythonInterp: /Users/simon/.local/share/virtualenvs/Natrix-WiaOIT_y/bin/python (found version "3.8")
  -- Found PythonLibs: /Library/Frameworks/Python.framework/Versions/3.8/lib/libpython3.8.dylib (found version "3.8.0")
  -- PYTHON_LIBRARIES = /Library/Frameworks/Python.framework/Versions/3.8/lib/libpython3.8.dylib
  -- PYTHON_INCLUDE_DIRS = /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8
  -- BX_DIR = /private/var/folders/8w/w3ptt2w10gq8gw8jlkw_x_dh0000gn/T/pip-install-unf6ib_s/bgfx-python/src/../dependencies/bx
  -- BIMG_DIR = /private/var/folders/8w/w3ptt2w10gq8gw8jlkw_x_dh0000gn/T/pip-install-unf6ib_s/bgfx-python/src/../dependencies/bimg
  -- BGFX_DIR = /private/var/folders/8w/w3ptt2w10gq8gw8jlkw_x_dh0000gn/T/pip-install-unf6ib_s/bgfx-python/src/../dependencies/bgfx
  -- PYBIND11_DIR = /private/var/folders/8w/w3ptt2w10gq8gw8jlkw_x_dh0000gn/T/pip-install-unf6ib_s/bgfx-python/src/../dependencies/pybind11
  -- Performing Test Weak Link MODULE -> SHARED (gnu_ld_ignore) - Failed
  -- Performing Test Weak Link MODULE -> SHARED (osx_dynamic_lookup) - Success
  _modinit_prefix:PyInit_
  _modinit_prefix:PyInit_
  -- Configuring done
  CMake Error at CMakeLists.txt:87 (add_library):
    Cannot find source file:

      /private/var/folders/8w/w3ptt2w10gq8gw8jlkw_x_dh0000gn/T/pip-install-unf6ib_s/bgfx-python/dependencies/bgfx/tools/shaderc/shaderc_glsl.cpp

    Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
    .hpp .hxx .in .txx

  CMake Error at CMakeLists.txt:76 (add_library):
    Cannot find source file:

      /private/var/folders/8w/w3ptt2w10gq8gw8jlkw_x_dh0000gn/T/pip-install-unf6ib_s/bgfx-python/dependencies/bgfx/3rdparty/dear-imgui/imgui.cpp

    Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
    .hpp .hxx .in .txx

  CMake Error at CMakeLists.txt:87 (add_library):
    No SOURCES given to target: shaderc

  CMake Error at CMakeLists.txt:76 (add_library):
    No SOURCES given to target: bgfx_lib

  CMake Generate step failed.  Build files cannot be regenerated correctly.
    File "/private/var/folders/8w/w3ptt2w10gq8gw8jlkw_x_dh0000gn/T/pip-build-env-iioznsir/overlay/lib/python3.8/site-packages/skbuild/setuptools_wrap.py", line 582, in setup
      env = cmkr.configure(cmake_args,
    File "/private/var/folders/8w/w3ptt2w10gq8gw8jlkw_x_dh0000gn/T/pip-build-env-iioznsir/overlay/lib/python3.8/site-packages/skbuild/cmaker.py", line 229, in configure
      raise SKBuildError(

  --------------------------------------------------------------------------------
  -- Trying "Ninja" generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying "Ninja" generator - success
  --------------------------------------------------------------------------------

  Configuring Project
    Working directory:
      /private/var/folders/8w/w3ptt2w10gq8gw8jlkw_x_dh0000gn/T/pip-install-unf6ib_s/bgfx-python/_skbuild/macosx-10.15-x86_64-3.8/cmake-build
    Command:
      cmake /private/var/folders/8w/w3ptt2w10gq8gw8jlkw_x_dh0000gn/T/pip-install-unf6ib_s/bgfx-python/src -G Ninja -DCMAKE_INSTALL_PREFIX:PATH=/private/var/folders/8w/w3ptt2w10gq8gw8jlkw_x_dh0000gn/T/pip-install-unf6ib_s/bgfx-python/_skbuild/macosx-10.15-x86_64-3.8/cmake-install -DPYTHON_EXECUTABLE:FILEPATH=/Users/simon/.local/share/virtualenvs/Natrix-WiaOIT_y/bin/python -DPYTHON_VERSION_STRING:STRING=3.8.0 -DPYTHON_INCLUDE_DIR:PATH=/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8 -DPYTHON_LIBRARY:FILEPATH=/Library/Frameworks/Python.framework/Versions/3.8/lib/libpython3.8.dylib -DSKBUILD:BOOL=TRUE -DCMAKE_MODULE_PATH:PATH=/private/var/folders/8w/w3ptt2w10gq8gw8jlkw_x_dh0000gn/T/pip-build-env-iioznsir/overlay/lib/python3.8/site-packages/skbuild/resources/cmake -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.15 -DCMAKE_OSX_ARCHITECTURES:STRING=x86_64 -DCMAKE_BUILD_TYPE:STRING=Release

  Traceback (most recent call last):

  An error occurred while configuring with CMake.
    Command:
      cmake /private/var/folders/8w/w3ptt2w10gq8gw8jlkw_x_dh0000gn/T/pip-install-unf6ib_s/bgfx-python/src -G Ninja -DCMAKE_INSTALL_PREFIX:PATH=/private/var/folders/8w/w3ptt2w10gq8gw8jlkw_x_dh0000gn/T/pip-install-unf6ib_s/bgfx-python/_skbuild/macosx-10.15-x86_64-3.8/cmake-install -DPYTHON_EXECUTABLE:FILEPATH=/Users/simon/.local/share/virtualenvs/Natrix-WiaOIT_y/bin/python -DPYTHON_VERSION_STRING:STRING=3.8.0 -DPYTHON_INCLUDE_DIR:PATH=/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8 -DPYTHON_LIBRARY:FILEPATH=/Library/Frameworks/Python.framework/Versions/3.8/lib/libpython3.8.dylib -DSKBUILD:BOOL=TRUE -DCMAKE_MODULE_PATH:PATH=/private/var/folders/8w/w3ptt2w10gq8gw8jlkw_x_dh0000gn/T/pip-build-env-iioznsir/overlay/lib/python3.8/site-packages/skbuild/resources/cmake -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.15 -DCMAKE_OSX_ARCHITECTURES:STRING=x86_64 -DCMAKE_BUILD_TYPE:STRING=Release
    Source directory:
      /private/var/folders/8w/w3ptt2w10gq8gw8jlkw_x_dh0000gn/T/pip-install-unf6ib_s/bgfx-python/src
    Working directory:
      /private/var/folders/8w/w3ptt2w10gq8gw8jlkw_x_dh0000gn/T/pip-install-unf6ib_s/bgfx-python/_skbuild/macosx-10.15-x86_64-3.8/cmake-build
  Please see CMake's output for more information.
  ----------------------------------------
  ERROR: Failed building wheel for bgfx-python
Failed to build bgfx-python
ERROR: Could not build wheels for bgfx-python which use PEP 517 and cannot be installed directly
fbertola commented 4 years ago

Hi @SuperSimon81! When you're building from source, you also need to checkout the dependencies submodule. From the project's root run this command:

git submodule update --init --recursive

Hope this helps.

SuperSimon81 commented 4 years ago

Im actually not trying to build from source but just install the precompiled binaries for macos using pip. Will try your suggestion but have the impression I'm misunderstanding something.

fbertola commented 4 years ago

There are no wheels yet for MacOS 10.15, so pip will try to build from source. I'm actually moving the CI pipeline from Travis/Appveyor to Github Actions and I will be able to create wheels for the latest MacOS version.

SuperSimon81 commented 4 years ago

I see. I will try to build it myself while awaiting wheels for 10.15. Thank you for your swift replies.

fbertola commented 4 years ago

@SuperSimon81 wheels are now available for MacOS with the release 1.0.2.

SuperSimon81 commented 4 years ago

I installed the binary now using pip. Trying to run hello_world it seems to fail at importing bgfx_lib. Any tips?


  File "/Users/simon/Documents/Projects/github/bgfx-python/examples/helloworld/helloworld.py", line 3, in <module>
    from bgfx import bgfx, ImGuiExtra, BGFX_CLEAR_COLOR, BGFX_CLEAR_DEPTH, \
  File "/Users/simon/Documents/Projects/github/bgfx-python/bgfx/__init__.py", line 2, in <module>
    from .utils import *
  File "/Users/simon/Documents/Projects/github/bgfx-python/bgfx/utils.py", line 12, in <module>
    import bgfx.bgfx_lib as bgfx_lib
ModuleNotFoundError: No module named 'bgfx.bgfx_lib'```
fbertola commented 4 years ago

Are you running the examples inside the project root? If so, pip will try to import the folder bgfx of the project instead of the wheel's one. You can move the folder aside or delete the bgfx one. I did the same thing in the Github Action as I didn't want to create a separate repo for such simple examples.

SuperSimon81 commented 4 years ago

I was running it using PyCharm, in which I´ve had mysterious trouble loading modules before. Visual Studio Code I got it running immediately. Thanks again.