A1. Installation

This workshop will use the Python-based COMPAS framework. Listed below are the packages and software that we will use during the workshop.

All commands in the instructions below have to be entered on the "command line". On Windows you HAVE TO use the "Anaconda Prompt" instead of the normal "Command Prompt". On Mac, use the Terminal app.

1. Anaconda

Anaconda is a free and open-source distribution of Python with many scientific packages pre-installed. We use Anaconda and its package manager (conda) to install COMPAS and its dependencies.

Please download and install Anaconda from here following all the default options: https://www.anaconda.com/products/individual For the Anaconda Prompt, you can find the user guide here: https://conda.io/projects/conda/en/latest/user-guide/concepts/conda-commands.html#

Here is the useful cheat sheet of conda commands: https://docs.conda.io/projects/conda/en/4.6.0/_downloads/52a95608c49671267e40c689e0bc00ca/conda-cheatsheet.pdf

2. Git & Github

We will use Github to share all scripts and data files. Download the ZIP folder or clone from the following GitHub repository: https://github.com/compas-Workshops/DF2021

3. COMPAS

We will install COMPAS in a virtual environment named df21, dedicated to the workshop using conda on the command line.

conda config --add channels conda-forge
conda remove -n df21 --all
conda create -n df21 python=3.8 compas compas_cgal compas_view2 --yes

Once the process is complete, verify that the installation was successful.

conda activate df21
python -m compas

If everything is okay, you should something similar to this.

Yay! COMPAS is installed correctly!

COMPAS: 1.7.1
Python: 3.8.2 | packaged by conda-forge | (default, Jun 27 2020, 10:00:00) [Clang 9.0.1 ]
Extensions: ['compas-cgal', 'compas-view2']

For reference, the COMPAS docs can be found here: https://compas.dev/compas/latest/

4. Visual Studio Code

We suggest VS Code as the editor for all Python scripts. You can use a different IDE if you prefer, but if you do, make sure you are able to work with conda environments.

You can download and install VS Code from here: https://code.visualstudio.com

Follow the instructions here to configure VS Code for Python programming: https://compas.dev/compas/latest/gettingstarted/vscode.html

Open your VS Code, click extensions or Ctrl + Shift + X, install extensions EditorConfig for VS Code and Python.

Having opened VS Code, let's select to open the working folder that you downloaded from Github. Make sure the DF2021 folder is unzipped into a local directory of your choosing (for example, your desktop):

Next, let's verify that you are working inside the virtual environment df21 that you just created through Anaconda. To do so, press SHIFT + CTRL + P (Windows) or SHIFT+ CMD + P (iOS) and type in 'Python: Select interpreter'. Select the recently created conda environment df21 in the dropdown:

Or instead use the commands inside VSCode:

conda activate df21
conda install --name df21 flake8 -y

In the left bottom corner of the VS Code window, the environment should now show the correct active Python environment in which your code will run. You can alternatively select the environment here:

To verify the version and extensions, create a new python file saved to your local file and run this code:

import compas
import compas_cgal
import compas_view2

print(compas.__version__)

This should run without any errors and the terminal window output the following:

(df21) C:\Users\...\anaconda3\envs\df21\python.exe "file_name.py"
1.7.1

Finally, select the linter for the Python environment. Again press SHIFT + CTRL + P (Windows) or SHIFT+ CMD + P (iOS) and type in 'Python: Select linter'. Select the flake 8 linter in the dropdown:

5. Rhino3D

The tools and algorithms taught in the workshop are generally independent of 3D modeling platforms. However, for visualisation and data exchange we will us Rhino3d during the later course of the workshop. Download and follow the default installation instructions for Rhino3d 6 or 7 here: https://www.rhino3d.com/download/

To install COMPAS for Rhino, type the following on the command line into the Anaconda Prompt/Terminal.

conda activate df21
python -m compas_rhino.install -v 6.0

Replace -v 6.0 with -v 7.0 if you want to use Rhino 7 instead of Rhino 6. Next, open a Rhino instance, type in the command 'EditPythonscript', and run the following code:

import compas
import compas_rhino

print(compas.__version__)

don't try to

import compas_cgal
import compas_view2

when you are inside Rhino!

This should again show the same version of COMPAS as output in the terminal and VS Code.

Last updated