Python Wrapper for Embree

Overview

pyembree

Python Wrapper for Embree

Installation

You can install pyembree (and embree) via the conda-forge package.

$ conda install -c conda-forge pyembree

Suppressing errors

Creating multiple scenes produces some harmless error messages:

ERROR CAUGHT IN EMBREE
ERROR: Invalid operation
ERROR MESSAGE: b'already initialized'

These can be suppressed with:

import logging
logging.getLogger('pyembree').disabled = True
Comments
  • Enhancement PR

    Enhancement PR

    This PR does the following things

    • Performed typo refactoring in pyx files
    • Updated to newer Embree API (2.) . Embree 3.0 is being developed...
    • Added the possibility to export all embree results when performing request
    • Added 12 new tests run from nosetests, activated them in travis
    • Run examples in travis

    One can discuss each point...

    opened by Gjacquenot 10
  • install info

    install info

    Hi,

    Thanks for making this git. Could you give some more details on how to install Pyembree?

    In Ubuntu command line, I insert sudo python setup.py install

    But there is some missing folder embree2 appartently... Or do I first have to install and compile embree itself?

    Best regards, Arne

    opened by avlonder 4
  • Fixed an attribute in trianges.pyx that prevents compilation

    Fixed an attribute in trianges.pyx that prevents compilation

    I have updated a trianges.pyx since it is using a missing attribute.

    I guess one wants RTC_GEOMETRY_STATIC instead of RTCGEOMETRY_STATIC.

    https://github.com/embree/embree/blob/90e49f243703877c7714814d6eaa5aa3422a5839/include/embree2/rtcore_geometry.h#L72

    The original error log is presented here

    D:\Embree\pyembree>python setup.py build
    Please put "# distutils: language=c++" in your .pyx or .pxd file(s)
    Compiling pyembree\trianges.pyx because it changed.
    [1/1] Cythonizing pyembree\trianges.pyx
    
    Error compiling Cython file:
    ------------------------------------------------------------
    ...
    def run_triangles():
        pass
    
    cdef unsigned int addCube(rtcs.RTCScene scene_i):
        cdef unsigned int mesh = rtcg.rtcNewTriangleMesh(scene_i,
                    rtcg.RTCGEOMETRY_STATIC, 12, 8, 1)
                       ^
    ------------------------------------------------------------
    
    pyembree\trianges.pyx:19:20: cimported module has no attribute 'RTCGEOMETRY_STATIC'
    Traceback (most recent call last):
      File "setup.py", line 11, in <module>
        include_path=include_path)
      File "C:\Program Files\Python36\lib\site-packages\Cython\Build\Dependencies.py", line 1039, in cythonize
        cythonize_one(*args)
      File "C:\Program Files\Python36\lib\site-packages\Cython\Build\Dependencies.py", line 1161, in cythonize_one
        raise CompileError(None, pyx_file)
    Cython.Compiler.Errors.CompileError: pyembree\trianges.pyx
    
    opened by Gjacquenot 3
  • Building Pyembree for use in AWS Lambda

    Building Pyembree for use in AWS Lambda

    I'd like to run Pyembree in an AWS Lambda function (via a Lambda 'Layer'), which means Embree will be located in /opt/python/embree. I'm having a bit of trouble configuring Pyembree to expect Embree in this location.

    This is what I've tried so far (cobbled together from this script and this comment) to build the environment:

    sudo amazon-linux-extras install python3.8
    sudo yum install python38-devel gcc gcc-c++
    wget https://github.com/embree/embree/releases/download/v2.17.7/embree-2.17.7.x86_64.linux.tar.gz -O /tmp/embree.tar.gz -nv
    sudo mkdir /opt/python/embree
    sudo tar -xzf /tmp/embree.tar.gz --strip-components=1 -C /opt/python/embree
    sudo pip3.8 install --no-cache-dir numpy cython
    wget https://github.com/scopatz/pyembree/releases/download/0.1.6/pyembree-0.1.6.tar.gz
    tar xf pyembree-0.1.6.tar.gz
    sed -i -e 's/embree2/\/opt\/python\/embree\/include\/embree2/g' pyembree-0.1.6/pyembree/*
    tar czf pyembree-0.1.6.tar.gz pyembree-0.1.6
    sudo pip3.8 install --global-option=build_ext --global-option="-I/opt/python/embree/include" --global-option="-L/opt/python/embree/lib" --target=/opt/python pyembree-0.1.6.tar.gz
    

    This seems to build without problem and puts Embree and Pyembree in /opt/python. If I cd into /opt/python and run Python, I can import Pyembree, but the build can't find libembree.so.2:

    Python 3.8.5 (default, Feb 18 2021, 01:24:20)
    [GCC 7.3.1 20180712 (Red Hat 7.3.1-12)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import pyembree
    >>> from pyembree import rtcore_scene as rtcs
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ImportError: libembree.so.2: cannot open shared object file: No such file or directory
    

    Any idea what else I should try? I'm not sure if I should be replacing embree2 with opt/python/embree/include/embree2 before building the pxd/pyx files, for example. I've also tried altering setup.py to: include_path = [np.get_include(), "/opt/python/embree/include", "/opt/python/embree/lib"].

    Any pointers very welcome!

    opened by dt99jay 1
  • segfault in destructor

    segfault in destructor

    Thanks for the great package! In a trimesh issue someone posted a backtrace that looked like it was occurring in the pyembree destructor, I was wondering if you'd ever seen anything similar?

    Thread 1 "python" received signal SIGSEGV, Segmentation fault.
    0x0000000000000000 in ?? ()
    (gdb) py-bt
    Traceback (most recent call first):
    (gdb) bt
    #0  0x0000000000000000 in ?? ()
    #1  0x00007fffd8ab7c30 in embree::avx::TriangleMeshISA::~TriangleMeshISA() ()
       from /usr/local/lib/libembree.so.2
    #2  0x00007fffd850002f in embree::Scene::~Scene() ()
       from /usr/local/lib/libembree.so.2
    #3  0x00007fffd8500179 in embree::Scene::~Scene() ()
       from /usr/local/lib/libembree.so.2
    #4  0x00007fffd84c3cc5 in rtcDeleteScene () from /usr/local/lib/libembree.so.2
    #5  0x00007fffd992474c in __pyx_pf_8pyembree_12rtcore_scene_11EmbreeScene_4__dealloc__ (__pyx_v_self=0x7fffd3166490) at pyembree/rtcore_scene.cpp:3434
    #6  __pyx_pw_8pyembree_12rtcore_scene_11EmbreeScene_5__dealloc__ (
        __pyx_v_self=<pyembree.rtcore_scene.EmbreeScene at remote 0x7fffd3166490>)
        at pyembree/rtcore_scene.cpp:3419
    #7  __pyx_tp_dealloc_8pyembree_12rtcore_scene_EmbreeScene (
        o=<pyembree.rtcore_scene.EmbreeScene at remote 0x7fffd3166490>)
        at pyembree/rtcore_scene.cpp:6042
    #8  0x00000000004fc70f in PyDict_Clear () at ../Objects/dictobject.c:946
    #9  0x00000000005419b9 in dict_tp_clear.lto_priv.332 (op=<optimized out>)
        at ../Objects/dictobject.c:2152
    #10 0x000000000049ca0f in delete_garbage (
        old=0x8fa280 <generations.lto_priv+96>, collectable=0x7fffffffdb40)
        at ../Modules/gcmodule.c:820
    #11 collect.lto_priv () at ../Modules/gcmodule.c:984
    ---Type <return> to continue, or q <return> to quit---
    #12 0x00000000004f9ade in PyGC_Collect () at ../Modules/gcmodule.c:1440
    #13 0x00000000004f8d7f in Py_Finalize () at ../Python/pythonrun.c:448
    #14 0x00000000004936f2 in Py_Main () at ../Modules/main.c:665
    #15 0x00007ffff7810830 in __libc_start_main (main=0x4932b0 <main>, argc=2, 
        argv=0x7fffffffddd8, init=<optimized out>, fini=<optimized out>, 
        rtld_fini=<optimized out>, stack_end=0x7fffffffddc8)
        at ../csu/libc-start.c:291
    #16 0x00000000004931d9 in _start ()
    
    opened by mikedh 1
  • Add distance query type

    Add distance query type

    Using the output dict to get the distance to the intersection is very slow. So I added a new query type, distance, which returns just the distance to the hit.

    opened by dwastberg 1
  • multiple scenes

    multiple scenes

    Hi, thanks for the great library!

    Someone opened an issue on trimesh about the errors that get printed when you allocate multiple scenes. It's not really a functional problem as pyembree still returns the correct result, I was wondering if there was a procedure or destructor I could call to suppress these warnings?

    import numpy as np
    
    from pyembree import rtcore_scene
    from pyembree.mesh_construction import TriangleMesh
    
    if __name__ == '__main__':
         triangles_a = np.random.random((10,3,3))
         scene_a = rtcore_scene.EmbreeScene()
         mesh_a = TriangleMesh(scene_a, triangles_a)
    
         # do something to deallocate here?
    
         triangles_b = np.random.random((10,3,3))
         scene_b = rtcore_scene.EmbreeScene()
         mesh_b = TriangleMesh(scene_b, triangles_b)
    

    produces this warning:

    ERROR CAUGHT IN EMBREE
    ERROR: Invalid operation
    ERROR MESSAGE: b'/home/benthin/Projects/embree_v251/kernels/common/rtcore.cpp (157): already initialized'
    

    Best, Mike

    opened by mikedh 1
  • These ctypedefs should define function pointers

    These ctypedefs should define function pointers

    in the same way as RTCFilterFunc in rtcore_geometry.pyx. This allows me to set custom intersection functions from cython code, in the same way that you already can with filter feedback functions:

        from mesh_intersection cimport patchIntersectFunc
        cimport pyembree.rtcore_geometry_user as rtcgu
        .
        .
        .
        rtcgu.rtcSetIntersectFunction(scene, geomID, <rtcgu.RTCIntersectFunc> patchIntersectFunc)
    
    opened by atmyers 1
  • Implementing additional mesh types in mesh_construction.pyx

    Implementing additional mesh types in mesh_construction.pyx

    This pull request adds support for creating hexahedral and tetrahedral meshes. It also implements creating triangular meshes using an indices array as well as a vertices array.

    enhancement 
    opened by atmyers 1
  • Apple Silicion Support

    Apple Silicion Support

    Since Embree 3.13.0 (https://github.com/embree/embree/releases/tag/v3.13.0) Apple Silicon is supported with Embree. pyembree should be updated to support it. Also see: https://github.com/scopatz/pyembree/issues/28

    opened by trologat 0
  • Conflict found when installing pyembree in Python3.9

    Conflict found when installing pyembree in Python3.9

    Hi, when attempting to install pyembree in a Python3.9 environment I get an error due to incompatible packages (see code below). This was tested on a MacBook Pro (2017) running macOS 10.14.6. Is there any way to resolve this?

    $ conda create --name python3.9 -c conda-forge python=3.9 pyembree
    Collecting package metadata (current_repodata.json): done
    Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
    Collecting package metadata (repodata.json): done
    Solving environment: |
    Found conflicts! Looking for incompatible packages.
    This can take several minutes.  Press CTRL-C to abort.
    failed
    
    UnsatisfiableError: The following specifications were found to be incompatible with each other:
    
    Output in format: Requested package -> Available versions
    
    Package python conflicts for:
    python=3.9
    pyembree -> numpy[version='>=1.18.1,<2.0a0'] -> python[version='3.7.*|3.8.*|>=3.9,<3.10.0a0']
    pyembree -> python[version='2.7.*|3.5.*|3.6.*|>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.8,<3.9.0a0|>=3.7,<3.8.0a0|>=3.5,<3.6.0a0|3.4.*']
    
    opened by ReinderVosDeWael 0
  • Dead link in the docstring of ElementMesh

    Dead link in the docstring of ElementMesh

    https://github.com/scopatz/pyembree/blob/master/pyembree/mesh_construction.pyx#L158 This link seems to be dead. I suppose that the node ordering is something like [[0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0], [0, 0, 1], [1, 0, 1], [1, 1, 1], [0, 1, 1]] for a unit cube, right?

    [edit] same here: https://github.com/scopatz/pyembree/blob/master/pyembree/mesh_construction.h#L4

    opened by nai62 0
Releases(0.1.6)
Owner
Anthony Scopatz
Anthony Scopatz
A Python wrapper for Google Tesseract

Python Tesseract Python-tesseract is an optical character recognition (OCR) tool for python. That is, it will recognize and "read" the text embedded i

Matthias A Lee 4.6k Jan 5, 2023
Python wrapper to access the amazon selling partner API

PYTHON-AMAZON-SP-API Amazon Selling-Partner API If you have questions, please join on slack Contributions very welcome! Installation pip install pytho

Michael Primke 330 Jan 6, 2023
A dead simple python wrapper for darknet that works with OpenCV 4.1, CUDA 10.1

What Dead simple python wrapper for Yolo V3 using AlexyAB's darknet fork. Works with CUDA 10.1 and OpenCV 4.1 or later (I use OpenCV master as of Jun

Pliable Pixels 6 Jan 12, 2022
Python wrapper class for OpenVINO Model Server. User can submit inference request to OVMS with just a few lines of code

Python wrapper class for OpenVINO Model Server. User can submit inference request to OVMS with just a few lines of code.

Yasunori Shimura 7 Jul 27, 2022
TargetAllDomainObjects - A python wrapper to run a command on against all users/computers/DCs of a Windows Domain

TargetAllDomainObjects A python wrapper to run a command on against all users/co

Podalirius 19 Dec 13, 2022
Securetar - A streaming wrapper around python tarfile and allow secure handling files and support encryption

Secure Tar Secure Tarfile library It's a streaming wrapper around python tarfile

Pascal Vizeli 2 Dec 9, 2022
Fast image augmentation library and easy to use wrapper around other libraries. Documentation: https://albumentations.ai/docs/ Paper about library: https://www.mdpi.com/2078-2489/11/2/125

Albumentations Albumentations is a Python library for image augmentation. Image augmentation is used in deep learning and computer vision tasks to inc

null 11.4k Jan 9, 2023
The lightweight PyTorch wrapper for high-performance AI research. Scale your models, not the boilerplate.

The lightweight PyTorch wrapper for high-performance AI research. Scale your models, not the boilerplate. Website • Key Features • How To Use • Docs •

Pytorch Lightning 21.1k Jan 1, 2023
The lightweight PyTorch wrapper for high-performance AI research. Scale your models, not the boilerplate.

The lightweight PyTorch wrapper for high-performance AI research. Scale your models, not the boilerplate. Website • Key Features • How To Use • Docs •

Pytorch Lightning 11.9k Feb 13, 2021
TensorFlow 2 AI/ML library wrapper for openFrameworks

ofxTensorFlow2 This is an openFrameworks addon for the TensorFlow 2 ML (Machine Learning) library

Center for Art and Media Karlsruhe 96 Dec 31, 2022
📝 Wrapper library for text generation / language models at char and word level with RNN in TensorFlow

tensorlm Generate Shakespeare poems with 4 lines of code. Installation tensorlm is written in / for Python 3.4+ and TensorFlow 1.1+ pip3 install tenso

Kilian Batzner 63 May 22, 2021
Keras + Hyperopt: A very simple wrapper for convenient hyperparameter optimization

This project is now archived. It's been fun working on it, but it's time for me to move on. Thank you for all the support and feedback over the last c

Max Pumperla 2.1k Jan 3, 2023
PyTorch wrapper for Taichi data-oriented class

Stannum PyTorch wrapper for Taichi data-oriented class PRs are welcomed, please see TODOs. Usage from stannum import Tin import torch data_oriented =

null 86 Dec 23, 2022
DockStream: A Docking Wrapper to Enhance De Novo Molecular Design

DockStream Description DockStream is a docking wrapper providing access to a collection of ligand embedders and docking backends. Docking execution an

AstraZeneca - Molecular AI 72 Jan 2, 2023
A simple API wrapper for Discord interactions.

Your ultimate Discord interactions library for discord.py. About | Installation | Examples | Discord | PyPI About What is discord-py-interactions? dis

james 641 Jan 3, 2023
Monk is a low code Deep Learning tool and a unified wrapper for Computer Vision.

Monk - A computer vision toolkit for everyone Why use Monk Issue: Want to begin learning computer vision Solution: Start with Monk's hands-on study ro

Tessellate Imaging 507 Dec 4, 2022
The lightweight PyTorch wrapper for high-performance AI research. Scale your models, not the boilerplate.

The lightweight PyTorch wrapper for high-performance AI research. Scale your models, not the boilerplate. Website • Key Features • How To Use • Docs •

Pytorch Lightning 21.1k Jan 8, 2023
OCR-D wrapper for detectron2 based segmentation models

ocrd_detectron2 OCR-D wrapper for detectron2 based segmentation models Introduction Installation Usage OCR-D processor interface ocrd-detectron2-segm

Robert Sachunsky 13 Dec 6, 2022
Ros2-voiceroid2 - ROS2 wrapper package of VOICEROID2

ros2_voiceroid2 ROS2 wrapper package of VOICEROID2 Windows Only Installation Ins

Nkyoku 1 Jan 23, 2022