Skip to content

Running on Ubuntu OS

Nikhil VJ edited this page Apr 26, 2018 · 11 revisions

A. Directly on system Python3

Note: It is recommended to go the virtual environment way instead. Still, if you're fine with it...

git clone https://github.com/WRI-Cities/static-GTFS-manager.git
cd static-GTFS-manager
pip3 install pandas tornado xmltodict tinydb pycryptodomex --user
python3 GTFSManager.py

Note: We'll be installing whatever's the latest version of the respective packages the program needs. There can be breaking changes in newer versions some years down the line that make the program inoperable with them. If that happens on your end, please follow the virtual environment way shown below.

B. Using a virtual environment

This is the recommended way, to ensure you have the exact versions of dependencies that the programmer had at the time of making the software, and to have it not interfere with the rest of your system.

  1. Open Terminal (linux command prompt) and clone this repo to your side:
    git clone https://github.com/WRI-Cities/static-GTFS-manager.git

  2. Navigate into the folder created.
    cd static-GTFS-manager

  3. Install virtualenv in your system if not already installed:
    pip3 install virtualenv --user

  4. Initiate a python3 virtual environment in /tmp and install the dependencies there

virtualenv -p python3 /tmp/VIRTUAL
source /tmp/VIRTUAL/bin/activate
which python3
  1. Last command shows from where the current python environment is running. It should come as /tmp/VIRTUAL/bin/python3

  2. Set pip package installer to 9.0.3 version. This is a temporary workaround because the latest one (10.0.1 at time of writing) has been observed to fail at installing pandas module in some systems because of a dependency artefact. Around June'2018 onwards please skip this step; I expect things will be solved by then. If the next step doesn't work, come back here and try this.
    pip3 install pip==9.0.3

  3. Install the required python dependencies, in the virtual environment where it will not interfere with you system's main python: pip3 install -r requirements.txt
    Note: you can also just read requirements.txt and install the packages manually using pip3 install package==version

  4. Run GTFSManager.py in python3:
    python3 GTFSManager.py

  5. The program should load in a new web browser tab. You can now operate the program from your web browser. In case it doesn't load up, see the terminal for the URL, it is most likely http://localhost:5000/ or so.

  6. See the terminal for instructions and reporting of various processes. There are some recurring warnings which you can ignore, like WARNING:tornado.access:404 GET /favicon.ico (::1) 1.35ms

Note: there is a password input box at top right corner. It's a basic idiot-proofing measure. For any operation involving editing, import or export of data, the password should be typed in. Please scroll down to find ways to change the password or work around it.

Closing

  1. The program will keep running while you operate on the browser. To terminate the program, come back to the Terminal and press Ctrl+C or close the window.

  2. To get out of the python3 virtual environment, run: deactivate. To get back in, run source /tmp/VIRTUAL/bin/activate. You may navigate to /tmp/ folder and delete off the VIRTUAL folder; it won't have any effect on the rest of your system. And on system reboot it'll probably get deleted on its own anyways.

Note: During this whole time, we did create a virtual environment at /tmp/VIRTUAL/ but in the Terminal we stayed at the program's working folder only. We didn't navigate anywhere else.

All commands together

git clone https://github.com/WRI-Cities/static-GTFS-manager.git
cd static-GTFS-manager
pip install virtualenv --user
virtualenv -p python3 /tmp/VIRTUAL
source /tmp/VIRTUAL/bin/activate
which python3
pip3 install pip==9.0.3
pip install -r requirements.txt
python3 GTFSManager.py

Note: If you want to keep a permanent virtual environment, you can setup the VIRTUAL folder under /home/ or anywhere on your system that doesn't have a space in the path name. This is a big current bug about pip installer in virtual environments: It can't tolerate spaces in the absolute path. Which is also why I didn't show a relative path way.. there's high chances one of your folders or even the hard drive name as a space in it.

Q: Do we really need to be so strict about package versions?
A: Not really. This is just the recommended settings that we know to work for sure. Go ahead and try with the latest.. there might even be some improvements in performance! If the program is working fine with a later version, then please file an issue requesting the developers to edit the requirements.txt file and raise the version numbers to have them match current values. Or, you can fork, make the changes at your end and put in a pull request. We'll have to test the whole thing out properly though before proceeding.