Upgrading#
Warning
This version of the documentation is for older releases of Brightway (legacy or brightway2). It includes only those pages which are relevant to the legacy releases. To access the complete documentation, please switch the the latest version. The legacy releases supports the popular Activity Browser user interface, but do not have the latest features of Brightway. You can learn more about the different versions of Brightway here.
Upgrading from Version 1#
Upgrading from version 1 requires a full export of your data objects, and reimporting them after upgrading the software. Please follow these steps:
Don’t upgrade your software yet! Instead, first export your databases and methods into Brightway packages:
from bw2data import *
from bw2data.io import BW2Package
for index, name in enumerate(databases):
BW2Package.export_obj(Database(name), "db-{}".format(index), "upgrade")
for index, name in enumerate(methods):
BW2Package.export_obj(Method(name), "lcia-{}".format(index), "upgrade")
# Add in any other objects you want to export here
# Might have to remove parenthese around print statement
print("Your exported objects are here:", config.request_dir("upgrade"))
Upgrade your software following the installation guide.
Each data directory would now be a new project. You can import the objects you exported earlier like this:
from brightway2 import *
import os
preferences['allow incomplete imports'] = True
filepath = "path that was printed earlier in section 1"
projects.current = "name of this project"
for filename in sorted(os.listdir(filepath)):
print(filename)
BW2Package.import_file(os.path.join(filepath, filename))
You will need to do this for each data directory you want to upgrade.
Upgrading from Version 2#
Note
Add context here…