Skip to content

Instantly share code, notes, and snippets.

@keunhong
Forked from alexlee-gk/install_blender_pyenv.md
Last active March 20, 2020 12:56
Show Gist options
  • Save keunhong/279c98de28877a3a33a1eb95fa7d56a5 to your computer and use it in GitHub Desktop.
Save keunhong/279c98de28877a3a33a1eb95fa7d56a5 to your computer and use it in GitHub Desktop.

Revisions

  1. keunhong revised this gist Oct 24, 2018. 1 changed file with 18 additions and 1 deletion.
    19 changes: 18 additions & 1 deletion install_blender_pyenv.md
    Original file line number Diff line number Diff line change
    @@ -36,7 +36,24 @@ make install

    This should have created the blender binary `bin/blender`. Now, build blender as a module as described in the [original post](http://wiki.blender.org/index.php/User:Ideasman42/BlenderAsPyModule) (in addition to any other options):
    ```
    cmake -DWITH_PLAYER=OFF -DWITH_PYTHON_INSTALL=OFF -DWITH_PYTHON_MODULE=ON ../blender
    cmake \
    -DPYTHON_VERSION=3.7.0 \
    -DPYTHON_ROOT_DIR=$(pyenv prefix) \
    -DCMAKE_INSTALL_PREFIX=$(pyenv prefix)/lib/python3.7/site-packages \
    -DWITH_CYCLES=ON \
    -DWITH_GAMENGINE=OFF \
    -DWITH_IMAGE_HDR=ON \
    -DWITH_IMAGE_OPENEXR=ON \
    -DWITH_IMAGE_TIFF=ON \
    -DWITH_OPENCOLLADA=OFF \
    -DWITH_OPENMP=ON \
    -DWITH_OPENIMAGEIO=ON \
    -DWITH_PYTHON_INSTALL=OFF \
    -DWITH_PYTHON_MODULE=ON \
    -DPYTHON_LIBRARY=$(pyenv virtualenv-prefix)/lib/libpython3.7m.so \
    -DPYTHON_LIBPATH=$(pyenv virtualenv-prefix)/lib \
    -DPYTHON_INCLUDE_DIR=$(pyenv virtualenv-prefix)/include/python3.7m \
    ..
    ```
    Build it an install it:
    ```
  2. keunhong revised this gist Oct 24, 2018. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions install_blender_pyenv.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,8 @@
    #Install blender as a module with python 3.5 and pyenv
    # Install blender as a module with python 3.7 and pyenv

    Tested on Ubuntu 14.04.
    Instructions WIP

    Tested on Ubuntu 18.04.

    ### Setting up a new python environment using pyenv
    Follow instructions from [here](https://gist.github.com/alexlee-gk/ba07524dc0d972be9eac#setting-up-a-new-python-environment-using-pyenv).
    @@ -24,7 +26,7 @@ When blender is build as a module, the `blender` binary doesn't get built. So, f

    When using cmake, use the following python options (in addition to any other options returned from the command above that you need):
    ```
    cmake -DPYTHON_VERSION=3.5 -DPYTHON_ROOT_DIR=~/.pyenv/versions/3.5.1 ../blender
    cmake -DPYTHON_VERSION=3.7 -DPYTHON_ROOT_DIR=~/.pyenv/versions/3.7.0 ../blender
    ```
    Make sure to build it and install it:
    ```
  3. keunhong revised this gist Oct 24, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install_blender_pyenv.md
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ Follow instructions from [here](https://gist.github.com/alexlee-gk/ba07524dc0d97
    Follow instructions from [here](https://gist.github.com/alexlee-gk/ba07524dc0d972be9eac#installing-boost).

    ### Installing blender as a module
    The instructions are mostly the same as the [official installation instructions](http://wiki.blender.org/index.php/User:Ideasman42/BlenderAsPyModule) except for a few modifications specified below.
    The instructions are mostly the same as the [official installation instructions](https://en.blender.org/index.php/User:Ideasman42/BlenderAsPyModule) except for a few modifications specified below.

    Install the python dependecies using `pip`:
    ```
  4. @alexlee-gk alexlee-gk revised this gist Feb 9, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions install_blender_pyenv.md
    Original file line number Diff line number Diff line change
    @@ -3,10 +3,10 @@
    Tested on Ubuntu 14.04.

    ### Setting up a new python environment using pyenv
    Follow instructions from [here](https://gist.github.com/alexlee-gk/ba07524dc0d972be9eac).
    Follow instructions from [here](https://gist.github.com/alexlee-gk/ba07524dc0d972be9eac#setting-up-a-new-python-environment-using-pyenv).

    ### Installing boost
    Follow instructions from [here](https://gist.github.com/alexlee-gk/ba07524dc0d972be9eac).
    Follow instructions from [here](https://gist.github.com/alexlee-gk/ba07524dc0d972be9eac#installing-boost).

    ### Installing blender as a module
    The instructions are mostly the same as the [official installation instructions](http://wiki.blender.org/index.php/User:Ideasman42/BlenderAsPyModule) except for a few modifications specified below.
  5. @alexlee-gk alexlee-gk created this gist Feb 9, 2016.
    44 changes: 44 additions & 0 deletions install_blender_pyenv.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,44 @@
    #Install blender as a module with python 3.5 and pyenv

    Tested on Ubuntu 14.04.

    ### Setting up a new python environment using pyenv
    Follow instructions from [here](https://gist.github.com/alexlee-gk/ba07524dc0d972be9eac).

    ### Installing boost
    Follow instructions from [here](https://gist.github.com/alexlee-gk/ba07524dc0d972be9eac).

    ### Installing blender as a module
    The instructions are mostly the same as the [official installation instructions](http://wiki.blender.org/index.php/User:Ideasman42/BlenderAsPyModule) except for a few modifications specified below.

    Install the python dependecies using `pip`:
    ```
    pip install numpy
    pip install requests
    ```

    When blender is build as a module, the `blender` binary doesn't get built. So, first build blender as normal following [these instructions](http://wiki.blender.org/index.php/Dev:Doc/Building_Blender/Linux/Ubuntu/CMake). Run `install_deps.sh` to generate the cmake options. For example, build all libraries except for opensubdivision, opencollada and ffmpeg:
    ```
    ./blender/build_files/build_environment/install_deps.sh --source ./ --threads=4 --with-all --skip-osd --skip-ffmpeg
    ```

    When using cmake, use the following python options (in addition to any other options returned from the command above that you need):
    ```
    cmake -DPYTHON_VERSION=3.5 -DPYTHON_ROOT_DIR=~/.pyenv/versions/3.5.1 ../blender
    ```
    Make sure to build it and install it:
    ```
    make -j4
    make install
    ```

    This should have created the blender binary `bin/blender`. Now, build blender as a module as described in the [original post](http://wiki.blender.org/index.php/User:Ideasman42/BlenderAsPyModule) (in addition to any other options):
    ```
    cmake -DWITH_PLAYER=OFF -DWITH_PYTHON_INSTALL=OFF -DWITH_PYTHON_MODULE=ON ../blender
    ```
    Build it an install it:
    ```
    make -j4
    make install
    ```
    This should have created the python library `bin/bpy.so`.