简体   繁体   English

如何使用无头渲染在 ubuntu 14.04 上安装 Pyrender?

[英]how to install Pyrender on ubuntu 14.04 with headless rendering?

I want to install Pyrender with headless rendering on Ubuntu 14.04.我想在 Ubuntu 14.04 上安装带有无头渲染的 Pyrender。 Specifically, I'd like have it installed within a Dockerfile.具体来说,我希望将它安装在 Dockerfile 中。 How can I do it so that OSMesa (and everything else) installs correctly?我该怎么做才能正确安装 OSMesa(和其他所有东西)?

Here are the lines from my Dockerfile that got things working (Ubuntu 14.04, python 3.6).这是我的 Dockerfile 中使事情正常运行的行(Ubuntu 14.04,python 3.6)。 It mostly involves following the installation guide , with some extra stuff to make sure deps get installed properly ( llvm-6.0 is the main thing that's tricky).它主要涉及遵循安装指南,还有一些额外的东西来确保 deps 正确安装( llvm-6.0是主要的棘手问题)。

If you're not trying to run in Docker, you can basically just run this stuff (in order) from the command line.如果你不想在 Docker 中运行,你基本上可以从命令行运行这些东西(按顺序)。

# Install pyrender
RUN pip3 install pyrender

# Copy and rename an apt lib file so that apt-add-repository 
# works (cleaner way would be to symlink it but Dockerfiles don't seem
# to like symlinks). Might be due to some screwy python3.6/3.4 conflicts 
# on my Docker image
RUN cp /usr/lib/python3/dist-packages/apt_pkg.cpython-34m-x86_64-linux-gnu.so /usr/lib/python3/dist-packages/apt_pkg.cpython-36m-x86_64-linux-gnu.so

# Add new apt repositories and then apt-add some OSMesa deps
RUN add-apt-repository "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-6.0 main"
RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test
RUN apt-get update && apt-get install --yes llvm-6.0 freeglut3 freeglut3-dev pkg-config

# Download OSMesa, then build and install it
RUN curl -o mesa-18.3.3.tar.gz ftp://ftp.freedesktop.org/pub/mesa/mesa-18.3.3.tar.gz
RUN tar xfv mesa-18.3.3.tar.gz
WORKDIR ./mesa-18.3.3
RUN ./configure --prefix=/usr/local                           \
            --enable-opengl --disable-gles1 --disable-gles2   \
            --disable-va --disable-xvmc --disable-vdpau       \
            --enable-shared-glapi                             \
            --disable-texture-float                           \
            --enable-gallium-llvm --enable-llvm-shared-libs   \
            --with-gallium-drivers=swrast,swr                 \
            --disable-dri --with-dri-drivers=                 \
            --disable-egl --with-egl-platforms= --disable-gbm \
            --disable-glx                                     \
            --disable-osmesa --enable-gallium-osmesa          \
            ac_cv_path_LLVM_CONFIG=llvm-config-6.0
RUN make -j8
RUN make install

# Add some new environment variables so the OSMesa libs can be found
ENV MESA_HOME /usr/local
ENV LIBRARY_PATH $LIBRARY_PATH:$MESA_HOME/lib
ENV LD_LIBRARY_PATH $LD_LIBRARY_PATH:$MESA_HOME/lib
ENV C_INCLUDE_PATH $C_INCLUDE_PATH:$MESA_HOME/include/
ENV CPLUS_INCLUDE_PATH $CPLUS_INCLUDE_PATH:$MESA_HOME/include/

# Get rid of the crappy old version of pyopengl, install a sweet new one
RUN pip3 uninstall -y pyopengl
RUN pip3 install git+https://github.com/mmatl/pyopengl.git

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM