quetzal is a Python package providing flexible models for transport planning and traffic forecasting.
(c) SYSTRA
The official documentation is hosted on https://systragroup.github.io/quetzal
In order to improve the ergonomics, the code may be re-factored and a few method calls may be re-designed. As a consequence, the backward compatibility of the library is not guaranteed. Therefore, the version of quetzal used for a project should be specified in its requirements.
One should choose between
- Poetry (recommended)
- Virtualenv
- Anaconda
- May need to set the default (or local) python version in the project
pyenv local 3.12
- install dependancies (this will create a new virtualenv)
poetry install
- activate the env
poetry shell
- add the env to ipykernel (to use in jupyter)
python -m ipykernel install --user --name=quetzal_env
Virtual environment: virtualenv .venv -p python3.12; source .venv/bin/activate
or any equivalent command.
pip install -e .
In order to use python notebook, Anaconda 3 + Python 3.12 must be installed. Then create + activate quetzal environment:
conda init
conda create -n quetzal_env -y python=3.12
conda activate quetzal_env
pip install -e . -r requirements_win.txt
python -m ipykernel install --user --name=quetzal_env
Anaconda 3 + Python 3.12
is supposed to be installed. You must edit the Path
user environment variable, adding several folders where Anaconda is installed:
path-to-anaconda3\
path-to-anaconda3\Scripts
path-to-anaconda3\Library\bin
path-to-anaconda3\Library\usr\bin
To create quetzal_env automatically and install quetzal
(base) C:users\you\path\to\quetzal> windows-install.bat
press enter to accept default environment name
(base) pip config set global.trusted-host "pypi.org files.pythonhosted.org"
(base) C:users\you\path\to\quetzal> windows-install.bat
security warning: the host is added to pip.ini
Anaconda and Pip do not get along well, your Anaconda install may have been corrupted at some point.
- Remove your envs
- Uninstall Anaconda
- Delete your Python and Anaconda folders (users\you\Anaconda3, users\you\Appdata\Roaming\Python, ...etc)
- Install Anaconda
- pandas append was remove:
# before
sm.volumes = sm.volumes.append(vol)
#now
sm.volumes = pd.concat([sm.volumes, vol])
#or
sm.volumes = pd.concat([sm.volumes, pd.DataFrame(vol)])
filtering index with set was remove:
# before
sm.volumes = sm.volumes.loc[od_set]
#now
sm.volumes = sm.volumes.loc[list(od_set)]
- shapely
# before
hull = zones.unary_union.convex_hull
# now
hull = zones.union_all().convex_hull
- scikitlearn
# add n_init='auto'
KMeans(n_clusters=num_zones,random_state=0,n_init='auto')