7.3 KiB
| id | title | sidebar_label |
|---|---|---|
| dev_build | Build OpenPYPE from source | Build |
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
Introduction
To build Pype you currently need (on all platforms):
- Python 3.7 as we are following vfx platform.
- git
We use CX_Freeze to freeze the code and all dependencies and Poetry for virtual environment management.
This is outline of build steps. Most of them are done automatically via scripts:
- Virtual environment is created using Poetry in
.venv - Necessary third-party tools (like ffmpeg, OpenImageIO
and usd libraries) are downloaded to
./vendor/bin - OpenPype code is frozen with cx_freeze to
./build - Modules are moved from
libtodependenciesto solve some Python 2 / Python 3 clashes - On Mac application bundle and dmg image will be created from built code.
- On Windows, you can create executable installer with
./tools/build_win_installer.ps1
Platform specific steps
<Tabs groupId="platforms" defaultValue="win" values={[ {label: 'Windows', value: 'win'}, {label: 'Linux', value: 'linux'}, {label: 'Mac', value: 'mac'}, ]}>
Windows
More tools might be needed for installing some dependencies (for example for OpenTimelineIO) - mostly development tools like CMake and Visual Studio
Clone repository:
git clone --recurse-submodules git@github.com:pypeclub/pype.git
Run from source
For development purposes it is possible to run OpenPype directly from the source. We provide a simple launcher script for this.
To start OpenPype from source you need to
- Run
.\tools\create_env.ps1to create virtual environment in.venv - Run
.\tools\fetch_thirdparty_libs.ps1to get ffmpeg, oiio and other tools needed. - Run
.\tools\run_tray.ps1if you have all required dependencies on your machine you should be greeted with OpenPype igniter window and once you give it your Mongo URL, with OpenPype icon in the system tray.
Step 1 and 2 needs to be run only once (or when something was changed).
To build OpenPype:
- Run
.\tools\fetch_thirdparty_libs.ps1to get ffmpeg, oiio and other tools needed. .\tools\build.ps1to create virtual environment in.venv
To create distributable OpenPype versions, run ./tools/create_zip.ps1 - that will
create zip file with name pype-vx.x.x.zip parsed from current pype repository and
copy it to user data dir. You can specify --path /path/to/zip to force it into a different
location. This can be used to prepare new version releases for artists in the studio environment
without the need to re-build the whole package
Linux
Docker
You can use Docker to build OpenPype. Just run:
$ sudo ./tools/docker_build.sh
and you should have built OpenPype in build directory. It is using Centos 7
as a base image.
You can pull the image:
# replace 3.0.0 tag with version you want
$ docker pull pypeclub/openpype:3.0.0
See https://hub.docker.com/r/pypeclub/openpype/tag for more.
Beware that as Python is built against some libraries version in Centos 7 base image, those might not be available in linux version you are using. We try to handle those we found (libffi, libcrypto/ssl, etc.) but there might be more.
Manual build
To build OpenPype on Linux you will need:
- curl on systems that doesn't have one preinstalled.
- bzip2, readline, sqlite3 and other libraries.
Because some Linux distros come with newer Python version pre-installed, you might need to install 3.7 version and make use of it explicitly. Your best bet is probably using pyenv.
You can use your package manager to install git and other packages to your build environment.
Common steps for all Distros
Use pyenv to prepare Python version for Pype build
$ curl https://pyenv.run | bash
# you can add those to ~/.bashrc
$ export PATH="$HOME/.pyenv/bin:$PATH"
$ eval "$(pyenv init -)"
$ eval "$(pyenv virtualenv-init -)"
# reload shell
$ exec $SHELL
# install Python 3.7.10
# python will be downloaded and build so please make sure
# you have all necessary requirements installed (see bellow).
$ pyenv install -v 3.7.10
# change path to pype 3
$ cd /path/to/pype-3
# set local python version
$ pyenv local 3.7.9
:::note Install build requirements for Ubuntu
sudo apt-get update; sudo apt-get install --no-install-recommends make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev git
In case you run in error about xcb when running Pype,
you'll need also additional libraries for Qt5:
sudo apt install qt5-default
:::
:::note Install build requirements for Centos 7
$ sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
$ sudo yum install centos-release-scl
$ sudo yum install bash which git devtoolset-7-gcc* \
make cmake curl wget gcc zlib-devel bzip2 \
bzip2-devel readline-devel sqlite sqlite-devel \
openssl-devel tk-devel libffi-devel qt5-qtbase-devel \
patchelf
:::
:::note Install build requirements for other distros
Build process usually needs some reasonably recent versions of libraries and tools. You can follow what's needed for Ubuntu and change it for your package manager. Centos 7 steps have additional magic to overcame very old versions. :::
For more information about setting your build environment please refer to pyenv suggested build environment.
To build Pype:
- Run
./tools/fetch_thirdparty_libs.shto get ffmpeg, oiio and other tools needed. - Run
./tools/build.shto build pype executables in.\build\
To build pype on MacOS you wil need:
- Homebrew, Easy way of installing everything necessary is to use.
- CMake to build some external OpenPype dependencies.
- XCode Command Line Tools (or some other build system)
- Install Homebrew:
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Install cmake:
$ brew install cmake
- Install pyenv:
$ brew install pyenv
$ echo 'eval "$(pypenv init -)"' >> ~/.zshrc
$ pyenv init
$ exec "$SHELL"
$ PATH=$(pyenv root)/shims:$PATH
- Pull in required Python version 3.7.x
# install Python build dependences
$ brew install openssl readline sqlite3 xz zlib
# replace with up-to-date 3.7.x version
$ pyenv install 3.7.9
- Set local Python version
# switch to Pype source directory
$ pyenv local 3.7.9
To build Pype:
- Run
./tools/create_env.shto create virtual environment in./venv - Run
./tools/build.shto build Pype executables in./build/