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!