First, you need to set up your server.
Clone the tm2py GitHub repo using Git Bash or GitHub Desktop, and switch to the branch you want to run.
Open the OpenPaths EMME Shell and:
- Change directory (
cd) to the parent folder of thetm2pyGitHub folder. - Create a new virtual environment alongside the
tm2pyfolder (not inside it):
python -m venv <your_tm2py_env_name>
Activate the virtual environment in the OpenPaths EMME shell:
<your_tm2py_env_name>\Scripts\activate
Copy the emme.pth file from your OpenPaths EMME installation folder to the virtual environment’s site-packages folder. You can do this via shell commands or manually in Windows.
Copy from:
C:\Program Files\Bentley\OpenPaths\EMME 24.01.00\emme.pth
Copy to:
<your_tm2py_env_name>\Lib\site-packages\
(Yes, this is one of those quirky things travel modelers do.)
In the same activated shell:
-
Change into the
tm2pyfolder:
cd tm2py -
Install in editable mode:
pip install -e .
-
In the shell, launch Python:
python -
Try importing tm2py:
import tm2py
You should only see packages listed in requirements.txt installed. If the import works without errors, the installation was successful.