Thursday, January 3, 2019

Compile Animation Nodes with Anaconda and Cython on Ubuntu 18.04

Get the latest source

Download the latest Animation Nodes source code and unzip.

Install Anaconda

Go to Anaconda.com and download the latest version.
The file Anaconda3-5.2.0-Linux-x86_64.sh needs to be made executable.

chmod +x /path/to/your/Anaconda3-5.2.0-Linux-x86_64.sh

To install run

./path/to/your/Anaconda3-5.2.0-Linux-x86_64.sh

Follow the prompts during installation. You'll need to answer questions and approve installation locations.

The installer offers to install MS VSCode at the end. It is no problem to decline.

After installation run
source ~/.bashrc

Run conda list to test installation. It will output all of the installed packages.

Create an Anaconda Environment

Run conda create --name your_env_name python=3

--name is a required option for the command.

Example: conda create --name AnaEnv python=3

Note: Be specific with the version number. The latest version of Python used for Animation Nodes is 3.7.1. The latest version for Anaconda has recently updated to 3.7.2, which fails to compile the earlier version. 

New Example: conda create --name AnaEvn371 python=3.7.1


Activate / Deactivate

To start the Anaconda Environment
Run conda activate your_env_name

To stop the Anaconda Environment
Run conda deactivate

You need to have the environment activated to compile Animation Nodes. You know it's active by the environment name prepended to your command prompt.

Install Cython

Run conda install cython
The command will download and install Cython on your computer. You need this to compile Animation Nodes.

Compile Animation Nodes

With your Anaconda Environment activated (the command prompt should be prepended with your environment name), run the setup.py file in the Animation Nodes source code you downloaded and unzipped.

python /path/to/your/setup.py

The first time you run this command, it creates a config.json file. You open it and change the path to the location where you want AN installed.

After updating the config.json file, run the command again with the build option to compile AN.

python /path/to/your/setup.py build --noversioncheck --copy

I needed to include the --noversioncheck option in order to get it to compile. An error message on the first try provided the option name to use.

Without --copy, the path in the config.json file is ignored.  The animation_nodes folder is in the root of the animation_nodes_blender2.8 source code directory.