2. Install

Current 0.0.9-alpha.3 runs on Python-2.7+ and Python-3.3+ but 3.3+ is the preferred one, i.e, the desktop UI runs only with it. It is distributed on Wheels.

Before installing it, make sure that there are no older versions left over. So run this command until you cannot find any project installed:

$ pip uninstall wltp                        ## Use `pip3` if both python-2 & 3 are in PATH.

You can install the project directly from the PyPi repo the “standard” way, by typing the pip in the console:

$ pip install wltp
  • If you want to install a pre-release version (the version-string is not plain numbers, but ends with alpha, beta.2 or something else), use additionally --pre.

  • If you want to upgrade an existing instalation along with all its dependencies, add also --upgrade (or -U equivalently), but then the build might take some considerable time to finish. Also there is the possibility the upgraded libraries might break existing programs(!) so use it with caution, or from within a virtualenv (isolated Python environment).

  • To install it for different Python environments, repeat the procedure using the appropriate python.exe interpreter for each environment.

  • Tip

    To debug installation problems, you can export a non-empty DISTUTILS_DEBUG and distutils will print detailed information about what it is doing and/or print the whole command line when an external program (like a C compiler) fails.

After installation, it is important that you check which version is visible in your PATH:

$ wltp --version
0.0.9-alpha.3

To install for different Python versions, repeat the procedure for every required version.

2.1. Older versions

An additional purpose of the versioning schema of the project is to track which specific version of the GTR it implements. Given a version number MAJOR.MINOR.PATCH, the MAJOR part tracks the GTR phase implemented. See the “GTR version matrix” section in Changes for the mapping of MAJOR-numbers to GTR versions.

To install an older version issue the console command:

$ pip install wltp=1.1.1                    ## Use `--pre` if version-string has a build-suffix.

If you have another version already installed, you have to use --ignore-installed (or -I). For using the specific version, check this (untested) stackoverflow question .

Of course it is better to install each version in a separate virtualenv (isolated Python environment) and shy away from all this.

2.2. Installing from sources

If you download the sources you have more options for installation. There are various methods to get hold of them:

  • Download the source distribution from PyPi repo.

  • Download a release-snapshot from github

  • Clone the git-repository at github.

    Assuming you have a working installation of git you can fetch and install the latest version of the project with the following series of commands:

    $ git clone "https://github.com/ankostis/wltp.git" wltp.git
    $ cd wltp.git
    $ python setup.py install                                 ## Use `python3` if both python-2 & 3 installed.
    

When working with sources, you need to have installed all libraries that the project depends on. Particularly for the latest WinPython environments (Windows / OS X) you can install the necessary dependencies with:

$ pip install -r WinPython_requirements.txt .

The previous command installs a “snapshot” of the project as it is found in the sources. If you wish to link the project’s sources with your python environment, install the project in development mode:

$ python setup.py develop

Note

This last command installs any missing dependencies inside the project-folder.

2.3. Project files and folders

The files and folders of the project are listed below:

+--wltp/            ## (package) The python-code of the calculator
|   +--cycles/      ## (package) The python-code for the WLTC data
|   +--test/        ## (package) Test-cases and the wltp_db
|   +--model        ## (module) Describes the data and their schema for the calculation
|   +--experiment   ## (module) The calculator
|   +--plots        ## (module) Diagram-plotting code and utilities
+--docs/            ## Documentation folder
|   +--pyplots/     ## (scripts) Plot the metric diagrams embeded in the README
+--devtools/        ## (scripts) Preprocessing of WLTC data on GTR and the wltp_db
|   +--run_tests.sh ## (script) Executes all TestCases
+--wltp             ## (script) The cmd-line entry-point script for the calculator
+--setup.py         ## (script) The entry point for `setuptools`, installing, testing, etc
+--requirements.txt ## The installation dependencies.
+--README.rst
+--CHANGES.rst
+--LICENSE.txt

2.4. Discussion