Team Ai
Apppublic

OpenMotionLab/MotionGPT

sourceHugging Facemitupdated 1y agoView on Hugging Face
118likes
index.rst173 linesDownload Raw Back to install
1Installation Guide2==================3 4Python Installation5-------------------6 7This package is available via ``pip``.8 9.. code-block:: bash10 11   pip install pyrender12 13If you're on MacOS, you'll need14to pre-install my fork of ``pyglet``, as the version on PyPI hasn't yet included15my change that enables OpenGL contexts on MacOS.16 17.. code-block:: bash18 19   git clone https://github.com/mmatl/pyglet.git20   cd pyglet21   pip install .22 23.. _osmesa:24 25Getting Pyrender Working with OSMesa26------------------------------------27If you want to render scenes offscreen but don't want to have to28install a display manager or deal with the pains of trying to get29OpenGL to work over SSH, you have two options.30 31The first (and preferred) option is using EGL, which enables you to perform32GPU-accelerated rendering on headless servers.33However, you'll need EGL 1.5 to get modern OpenGL contexts.34This comes packaged with NVIDIA's current drivers, but if you are having issues35getting EGL to work with your hardware, you can try using OSMesa,36a software-based offscreen renderer that is included with any Mesa37install.38 39If you want to use OSMesa with pyrender, you'll have to perform two additional40installation steps:41 42- :ref:`installmesa`43- :ref:`installpyopengl`44 45Then, read the offscreen rendering tutorial. See :ref:`offscreen_guide`.46 47.. _installmesa:48 49Installing OSMesa50*****************51 52As a first step, you'll need to rebuild and re-install Mesa with support53for fast offscreen rendering and OpenGL 3+ contexts.54I'd recommend installing from source, but you can also try my ``.deb``55for Ubuntu 16.04 and up.56 57Installing from a Debian Package58********************************59 60If you're running Ubuntu 16.04 or newer, you should be able to install the61required version of Mesa from my ``.deb`` file.62 63.. code-block:: bash64 65   sudo apt update66   sudo wget https://github.com/mmatl/travis_debs/raw/master/xenial/mesa_18.3.3-0.deb67   sudo dpkg -i ./mesa_18.3.3-0.deb || true68   sudo apt install -f69 70If this doesn't work, try building from source.71 72Building From Source73********************74 75First, install build dependencies via `apt` or your system's package manager.76 77.. code-block:: bash78 79   sudo apt-get install llvm-6.0 freeglut3 freeglut3-dev80 81Then, download the current release of Mesa from here_.82Unpack the source and go to the source folder:83 84.. _here: https://archive.mesa3d.org/mesa-18.3.3.tar.gz85 86.. code-block:: bash87 88   tar xfv mesa-18.3.3.tar.gz89   cd mesa-18.3.390 91Replace ``PREFIX`` with the path you want to install Mesa at.92If you're not worried about overwriting your default Mesa install,93a good place is at ``/usr/local``.94 95Now, configure the installation by running the following command:96 97.. code-block:: bash98 99   ./configure --prefix=PREFIX                                   \100               --enable-opengl --disable-gles1 --disable-gles2   \101               --disable-va --disable-xvmc --disable-vdpau       \102               --enable-shared-glapi                             \103               --disable-texture-float                           \104               --enable-gallium-llvm --enable-llvm-shared-libs   \105               --with-gallium-drivers=swrast,swr                 \106               --disable-dri --with-dri-drivers=                 \107               --disable-egl --with-egl-platforms= --disable-gbm \108               --disable-glx                                     \109               --disable-osmesa --enable-gallium-osmesa          \110               ac_cv_path_LLVM_CONFIG=llvm-config-6.0111 112Finally, build and install Mesa.113 114.. code-block:: bash115 116   make -j8117   make install118 119Finally, if you didn't install Mesa in the system path,120add the following lines to your ``~/.bashrc`` file after121changing ``MESA_HOME`` to your mesa installation path (i.e. what you used as122``PREFIX`` during the configure command).123 124.. code-block:: bash125 126   MESA_HOME=/path/to/your/mesa/installation127   export LIBRARY_PATH=$LIBRARY_PATH:$MESA_HOME/lib128   export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MESA_HOME/lib129   export C_INCLUDE_PATH=$C_INCLUDE_PATH:$MESA_HOME/include/130   export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:$MESA_HOME/include/131 132.. _installpyopengl:133 134Installing a Compatible Fork of PyOpenGL135****************************************136 137Next, install and use my fork of ``PyOpenGL``.138This fork enables getting modern OpenGL contexts with OSMesa.139My patch has been included in ``PyOpenGL``, but it has not yet been released140on PyPI.141 142.. code-block:: bash143 144   git clone https://github.com/mmatl/pyopengl.git145   pip install ./pyopengl146 147 148Building Documentation149----------------------150 151The online documentation for ``pyrender`` is automatically built by Read The Docs.152Building ``pyrender``'s documentation locally requires a few extra dependencies --153specifically, `sphinx`_ and a few plugins.154 155.. _sphinx: http://www.sphinx-doc.org/en/master/156 157To install the dependencies required, simply change directories into the `pyrender` source and run158 159.. code-block:: bash160 161    $ pip install .[docs]162 163Then, go to the ``docs`` directory and run ``make`` with the appropriate target.164For example,165 166.. code-block:: bash167 168    $ cd docs/169    $ make html170 171will generate a set of web pages. Any documentation files172generated in this manner can be found in ``docs/build``.173