Clone wiki

TrafficIntelligence / Install and Use the Python Modules and Scripts

  • In order to program in Python and use the provided Python libraries, read the information on the PolyWikiTI.
  • The requirements of the Python tools (the required modules) are the following:
    • the essential modules are Matplotlib and Numpy
    • the following libraries are optional. They are necessary for (sometimes very) specific classes/functions:
      • Computer Vision ( OpenCV (to be installed from source preferrably), scikit-image
      • Statistics and machine learning ( scipy, scikit-learn
      • Moving object geometry ( and plotting shapely polygons ( shapely
      • Tabular data loading/processing ( pandas
      • Metadata ( sqlalchemy
      • Optimization: munkres
    • You can install all required (essential and optional) using the python-requirements.txt file with pip: sudo -H pip3 install -r python-requirements.txt --upgrade.
  • Download the current reporitory version or clone (using mercurial, see the button at the top of the Source page and instructions on PolyWikiTI).
  • Installation can now be done using the provided or pip and more simply through the Makefile: $ sudo make installpython. Otherwise, if for example you do not have system installation rights (sudo), you should look into the PYTHONPATH environment variable (see again PolyWikiTI).
  • To test your installation, start a python interpreter (or even better, ipython) and try to import the cvutils and storage modules by typing the following:
>>> from trafficintelligence import cvutils
>>> from trafficintelligence import storage
  • The provided Python modules are in the subdirectory trafficintelligence and the executable scripts, e.g. or, in the subdirectory scripts.

If there are no errors, you are all set and can start programming in Python using the provided libraries (see the other guides on the homepage).