Installation

Brightway2 can be installed pretty much everywhere, on Windows, OS X, Linux, and anywhere else Python can be compiled.

Quickstart

  1. Install Miniconda version 3.6 64-bit.
  2. Update conda
conda update conda
  1. In a terminal window or command line shell, create a new conda environment. A conda environment is like a separate computer where software packages don’t conflict with each other. You can call it whatever your want:
conda create -n <change-me> python=3.6
  1. Activate your environment, using one of the following:
source activate <change-me>
activate <change-me>
  1. Install Brightway2:
conda install -y -q -c conda-forge -c cmutel -c haasad brightway2 jupyter
  1. If you are on Windows, you also need to do:
conda install -y -q pywin32
  1. After installing all packages, you can save some disk space by cleaning conda:
conda clean -tipsy

You can also install Brightway2 using pip, but the numerical libraries are much easier to install from conda.

Running the Miniconda installer

Windows

Double click the installer file Miniconda3-latest-Windows-x86_64.exe.

Install just for yourself:

_images/windows-1.png

Next, change the default installation location to somewhere easy to type, like in your home directory or C:\miniconda\:

_images/windows-2.png

Unless you have other Python versions installed, it is fine to make this your default Python.

Launching and using a command shell

You can also manually launch Python in a command shell using the application launcher. The launch procedure varies depending on the version of Windows you are running, but is usually next to the main Windows home button. Typing cmd should be enough to find the program you are looking for:

_images/cmd-shell-1.png

Note

You can usually use the right mouse button to paste into command shell or PowerShell windows.

You can copy and paste, or simply type commands, into the command shell. You will need to activate the environment in each terminal window.

_images/cmd-shell-2.png

In the command shell, you can enter the ipython interpreter with ipython, or run notebooks with jupyter notebook. Note that you can’t launch the notebook server from the root C:\ drive, you must be in a directory, e.g. C:\my-notebooks\.

OS X/Linux

Note

On Mac OS X, you might have to make the bash script executable: chmod +x ~/Downloads/Miniconda3-latest-MacOSX-x86_64.sh

Run Miniconda3-latest-MacOSX-x86_64.sh (or equivalent) to start the Miniconda installer:

_images/osx-1.png

Press enter to start reading the Miniconda license.

_images/osx-2.png

Press the space bar to go through the license.

_images/osx-3.png

Type yes to agree to the license terms. Next, change the default installation location to something easy to find and remember, like /Users/<your user name>/miniconda/ (OS X) or /home/<your user name>/miniconda/ (Linux).

Warning

You can’t easily move this directory later, as its path is hard-coded in many files. If you make a mistake, it is better to start the installation from the beginning.

If you don’t have another copy of Python on your machine, then you can make this your default Python interpreter. However, it will also work just fine if you don’t make it your default Python - you will just need to type a bit more to activate this Python version each time you start a terminal or command shell. If you don’t want to make it your default python, then you will need to adjust the paths so that the following commands work. For example, instead of running conda, you will probably need to change to the correct directory first, e.g. something like cd ~/miniconda/bin/.

_images/osx-4.png

Python 2 or 3

Brightway2 supports python 2 and 3, but the recommended version is python 3.6. Tests are run against 2.7 and 3.6. Python 3 versions less than 3.4 are not supported.

The library eight is used to forward-port python 2.7 code to 3.X. This means that super, str, and bytes have 3.X semantics. The print function and true division are imported from __future__, as are unicode_literals.

See also:

Note

Please subscribe to the brightway2 updates mailing list to be informed of new releases.

Notebook directory

It is best practice to store your notebooks in separate directories for each project you are working on. One reasonable place would be in your Documents or Desktop.

Cloud installs

Brightway2 is designed to run without too much fuss on servers in the cloud. See the instructions for using Docker and specific instructions for Cloud Nine.

Activity-browser

_images/activity-browser.png

The activity browser is an experimental graphical user interface for Brightway2.

To install:

conda install -y -q -c conda-forge arrow pyqt networkx seaborn requests-oauthlib
pip install https://github.com/haasad/activity-browser/archive/master.zip

You can now run the activity browser with the command:

activity-browser

Compiling on Linux

General instructions are provided for Ubuntu 14.04; people using other distributions are assumed smart to be enough to adapt as necessary.

To compile from source on linux using UMFPACK as a sparse linear algebra library, the following pacakges are required:

sudo apt-get update
sudo apt-get install python-scipy python-numpy python-nose python-pip python-lxml cython python-virtualenv virtualenvwrapper build-essential libsuitesparse-dev swig

Developers

If you want to develop with Brightway, then you should also install the following:

  • pytest
  • sphinx

You can install editable Brightway2 packages using mercurial:

pip install -e hg+https://bitbucket.org/cmutel/brightway2-data#egg=bw2data
pip install -e hg+https://bitbucket.org/cmutel/brightway2-calc#egg=bw2calc
pip install -e hg+https://bitbucket.org/cmutel/brightway2-ui#egg=bw2ui
pip install -e hg+https://bitbucket.org/cmutel/brightway2-analyzer#egg=bw2analyzer

You can also simply clone the bitbucket source code repositories instead of installing them.

Upgrading Brightway2

Brightway2 is being actively developed, and new releases come frequently.

Note

Please subscribe to the brightway2 updates mailing list to be informed of new releases.

To upgrade Brightway2, do the following:

First, make sure your background packages are up to date. In anaconda/miniconda, use the following commands (once you have activated your environment):

conda update conda
conda update brightway2

Brightway2 Packages

Brightway2 is split into several packages, where each package fulfills a certain role in the framework. The idea is that you can be an expert on a certain package, but not have to learn anything about other packages.

Core packages

brightway2

This manual, plus a generic container that imports from brightway2-data and brightway2-calc.

brightway2-data

This package provides facilities for managing LCI databases and LCIA methods, as well as input and output scripts.

brightway2-calc

This package provides classes for LCA calculations, both static and uncertain, and basic regionalized LCA.

brightway2-analyzer

This package provides functions for interpreting and analyzing LCI databases, LCIA methods, and LCA results.

Secondary packages

These packages are extensions to Brightway2, and have lower standards for documentation and test coverage. They show how Brightway2 can be extended into new areas of LCA.

brightway2-regional

Full-fledged regionalization in Brightway2.

brightway2-temporalis

Dynamic LCA in Brightway2.