Environment setup
Table of contents
Running commands at a command prompt
Throughout this documentation, you are instructed to run various commands at a prompt.
The prompt is available in a variety of forms, depending on the computer’s operating system.
MacOS command prompts
On MacOS, access the prompt by runing the terminal application.
A prompt is accessible via the Terminal in MacOS. The Terminal enables commands to be run within a “shell”. Different shells are available on MacOS but recent versions of MacOS default to using the Z-shell, zsh
.
Windows command prompts
On Windows, access the prompt by running cmd
or PowerShell. Some helpful links for Windows are provided below:
- How to access the command prompt
- How to use the command prompt
- How to access the Powershell
- Powershell cheatsheet
Install the Python interpreter
The Python interpreter is the software that runs Python programs.
The G-Cubed Python package requires you have a working Python interpreter installed on the computer. That Python interpreter must be version 3.10 or later.
TIP: Install the latest Python interpreter that is available.
Windows installation
Install Python 3.10+ on Windows from the Python site.
This involves the following steps.
- Select the latest Python 3 release
- Scroll down the page to the Files section
- Download the appropriate Windows installer for your computer 32 bit or 64 bit (probably not ARM).
- Double click on the installer to run the installation and accept the default settings.
MacOS installation
Homebrew is a handy package manager for MacOS. It can be used to install the latest version of the Python interpreter. If you do not have homebrew
installed already, at the command prompt, run the single command specified on the homebrew homepage.
Once homebrew is installed, again from your command prompt, use it to install the latest Python version:
brew install python
Python package management
Python itself cannot do too much, it needs all kinds of packages for all kinds of purposes.
G-Cubed uses this package system, distributing the G-Cubed model functionality as a Python package.
pip is a manager for Python’s packages. It helps you to install and remove packages. Packages that have been installed using pip are automatically discoverable by Python when they are imported into Python scripts.
pip may already be installed on your computer. To check, run the following command at the command prompt:
pip --version
This should provide version details about pip and its associated Python interpreter. If not then you will need to install pip.
To install pip, follow the instructions on the pip official website. We recommend the method that uses your Python interpreter to run the get-pip.py
script.
gcubed package installation
The current gcubed
package is version 1.0.5, released on August 15, 2023
To install that package, download the binary gcubed package from McKibbin Software Group Pty. Limited. The file has a whl
filename extension.
Download the gcubed package version 1.0.5
To install the downloaded gcubed
Python package, run the following command in your terminal from within the directory that contains the downloaded file:
pip install gcubed-1.0.5-py3-none-any.whl
or
python -m pip install gcubed-1.0.5-py3-none-any.whl
gcubed version updates
You will need to uninstall and then reinstall the gcubed
package whenever there is a package update.
To do so, uninstall the old version of gcubed then install the newest version when you want to update gcubed
.
To uninstall:
pip uninstall gcubed
or
python -m pip uninstall gcubed
Respond with a Y
to confirm the uninstall when asked.
To then install the updated version of the gcubed
package:
pip install gcubed-<NEW_VERSION>-py3-none-any.whl
or
python -m pip install gcubed-<NEW_VERSION>-py3-none-any.whl
Change log for Python G-Cubed
Version 1.0.6 (forthcoming)
Added settings to the model configuration system to write and use a custom parameter calibration class.
Migrated the differences and deviations functionality from the Projections class to the gcubed.projections module. They are still accessible as class methods of the Projections class but that way of accessing them is deprecated and will be removed in future versions.
Improved the efficiency of the deviation calculations by vectorising most of the operations.
Added a new method (productivity_growth_rates_for_all_regions_and_sectors) to access productivity projections from the Productivity class.
Added new carbon coefficients for final demand for fossil fuels and for factor demand by each sector for each fossil fuel in each region.
Version 1.0.5
Released on August 15, 2023.
Removed the ox_directory
from the model configuration. The Ox directory is no longer required now that benchmarking against Ox results has been completed.
Removed the benchmarks_directory
from the model configuration. The Benchmarks directory was only used for detailed reporting of any discrepancies between Ox results and Python results.
Removed logging system configuration from the Runner classes. Configuration of the logging system is now fully controlled by the user.
The ability for a runner to save baseline and final projections and the deviations between them to the results directory automatically has been deprecated. As part of this deprecation, the save_results
and results_directory
properties of Runners now issue a warning whenever their values are changed.
Modified the gcubed.graphics.chart_pack
app to use a simpler file format for defining chart packs. The chart pack app also now can be run using a simpler command:
python -m gcubed.graphics.charts
The python -m gcubed.graphics.chart_pack
command still works but it is deprecated and will be removed in a future release.
The gcubed.graphics
app. has been enhanced. It now supports the addition of a second series on the chart, so long as the units of the two series are identical.
Version 1.0.4
Not released to the public.
Version 1.0.3
Released on July 31, 2023.
Initial release of Python G-Cubed.