Wiki

Clone wiki

DeepDriving / InstallWindowsPython

Installation on Windows

Setup your Python 3 Environment

Pre-Requirements

  • On Windows you need either Python 3.5 or Python 3.6. The following guide is written for Python 3.5.

Setup virtual environment (optional)

  • It is recommend to use virtual environments instead of installing all python packages globally. In this way it is easy to have different package configurations for different projects. Due to the package separation of different virtual environments, also conflicting packages can be used within different projects.

  • Open a terminal window (cmd.ext) where the python installation is in your PATH environment variable.

  • The python virtual environment is stored in a dedicated path. We refer to this path as <python-env> in the following guide. For example, use the path <Projects>\tf_python to highlight, that this python environment uses Tensorflow (tf).

  • First create the virtual environment:

python -m venv <python-env>
  • The path <python-env>/Scripts contains now a script called activate.bat which must be called to activate the virtual environment.
call <python-env>\Scripts\activate.bat

Setup tensorflow

  • First install Tensorflow and its requirements. A guide how to install can be found here. But in general you simply need to perform the next commands.

  • Note: It is not recommend to use Tensorflow on CPU only for this project, since this does not lead to a sufficient frame-rate. Thus this guide concentrates on using Tensorflow with GPU (NVIDIA Graphic Cards only at the moment).

  • Install tensorflow with pip:

pip3 install --upgrade tensorflow-gpu
python

>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))
  • You should see:
b'Hello, TensorFlow!'
  • You can leave the interactive python session with:
>>> quit()

Setup further modules

  • You need to install the following modules for performing training/evaluation and inference:
pip3 install opencv-python
pip3 install termcolor
  • Furthermore this project comes with a bunch of own modules, which must be available in your python installation. For this, you simply need to add <repository-path>\python\modules to your PYTHONPATH environment variable. This can be done in the same way you did it with the libraries, which must be compiled, in the chapter before:
set PYTHONPATH=%PYTHONPATH%;<repository-path>\python\modules

Setup graphical user interface modules

Some scripts of this project uses a graphical user interface. This project uses kivy as library for the GUI. A comprehensive installation guide can be found here. However it should be enough to follow this guide.

  • Ensure, you have the latest pip and wheel version:
pip install --upgrade pip wheel setuptools
  • Install dependencies:
pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew
pip install kivy.deps.gstreamer
  • Install kivy:
python -m pip install kivy
  • Test kivy:
python

>>>> import kivy
  • You should see the following output:
[INFO   ] [Logger      ] Record log in <home-path>\kivy_17-07-13_0.txt
[INFO   ] [Kivy        ] v1.10.0
[INFO   ] [Python      ] v3.5.3 (v3.5.3:1880cb95a742, Jan 16 2017, 16:02:32) [MSC v.1900 64 bit (AMD64)]
  • To leave the python interactive shell simply type:
quit()

Next Step

Updated