You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 171618d
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/users-guide/modelsetup.rst
+42-11Lines changed: 42 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -139,16 +139,20 @@ Install UV
139
139
We recommend installing UV as an independent tool on your machine, separate from any existing package managers you may have such as conda or pip.
140
140
141
141
For Windows users, run the following command in PowerShell to install *uv*. It does not require administrator privileges and installs *uv* for the current user only.
142
-
by default, uv is installed to `~/.local/bin` directory. Usually, this is `C:/Users/<username>/.local/bin`.
142
+
By default, uv is installed to `~/.local/bin` directory. Usually, this is `C:/Users/<username>/.local/bin`.
143
+
143
144
::
145
+
144
146
# Run the installer. Please review the printed message after installation.
You can check the version of *uv* you have installed by running
181
+
175
182
::
176
183
177
184
uv --version
@@ -187,9 +194,9 @@ The first is to use *uv* to install an official ActivitySim release from the Pyt
187
194
The second is to use *uv* to install ActivitySim from the source code repository and use the dependency lockfile.
188
195
189
196
.. note::
190
-
The first option (:ref:`From PyPI`) is the quickest way to install ActivitySim from an official release and is recommended for users who do not wish to change the Python code.
197
+
The first option (:ref:`Option 1: From PyPI`) is the quickest way to install ActivitySim from an official release and is recommended for users who do not wish to change the Python code.
191
198
However, they may end up using different deep dependencies than those tested by the developers.
192
-
The second option (:ref:`From Source with Lockfile`) is recommended for users who may want to customize the Python code, and/or who want to run ActivitySim
199
+
The second option (:ref:`Option 2: From Source with Lockfile`) is recommended for users who may want to customize the Python code, and/or who want to run ActivitySim
193
200
exactly as it was tested by the developers using the dependency lockfile which results in the exact same deep dependencies.
194
201
195
202
The steps involved are described as follows.
@@ -286,7 +293,9 @@ Run ActivitySim with UV
286
293
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
287
294
288
295
Activate the virtual environment created by *uv*. This option is similar to using Python's classic venv or Conda env.
296
+
289
297
::
298
+
290
299
# cd into the project directory if not already there
291
300
## if you used the From PyPI option
292
301
cd asim_project
@@ -299,11 +308,13 @@ Activate the virtual environment created by *uv*. This option is similar to usin
299
308
Once the virtual environment is activated, you can run ActivitySim commands directly using the `activitysim` command.
300
309
For example, run the ActivitySim commandline using the following. More information about the commandline interface is available in
301
310
the :ref:`Ways to Run the Model` section.
311
+
302
312
::
303
313
304
314
activitysim run -c configs -o output -d data
305
315
306
316
Alternatively, you can run ActivitySim commands directly using *uv* without activating the virtual environment.
317
+
307
318
::
308
319
309
320
uv run activitysim run -c configs -o output -d data
@@ -314,26 +325,33 @@ My travel demand model requires additional Python packages not included with Act
You can add additional packages to your *uv* project by using the `uv add` command. For example, to add the `geopandas` package,
316
327
run the following command within your existing *uv* project directory.
328
+
317
329
::
330
+
318
331
# cd into your project directory
319
332
cd asim_project
320
333
321
334
# Add geopandas package
322
335
uv add geopandas
336
+
323
337
This will add the package to your virtual environment and update the `pyproject.toml` and the `uv.lock` file to include the new package and its dependencies.
324
338
325
339
If you envision having a version of Python packages that is different from the one used by ActivitySim, e.g., you need pandas 1.x for visualization (for some reason),
326
340
we recommend creating a separate *uv* project for your custom packages and managing them independently from ActivitySim.
341
+
327
342
::
343
+
328
344
# Open Command Prompt
329
345
mkdir viz_project
330
346
cd viz_project
331
347
uv init
332
348
uv add pandas==1.5.3
333
349
334
-
Many agencies use commerical software that have Python APIs and dependencies that may conflict with ActivitySim dependencies.
335
-
In such cases, we also recommend creating a separate *uv* project for the commerical software and managing them independently from ActivitySim.
350
+
Many agencies use commercial software that have Python APIs and dependencies that may conflict with ActivitySim dependencies.
351
+
In such cases, we also recommend creating a separate *uv* project for the commercial software and managing them independently from ActivitySim.
352
+
336
353
::
354
+
337
355
# Open Command Prompt
338
356
mkdir emme_project
339
357
cd emme_project
@@ -342,21 +360,34 @@ In such cases, we also recommend creating a separate *uv* project for the commer
342
360
343
361
How to share my working environment with others?
344
362
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
345
-
You can share your working environment with others by sharing the `uv.lock` file located in your project directory.
346
-
This file contains the exact versions of all packages and dependencies used in your project.
347
-
Others can recreate the same environment by running the `uv sync --locked` command in a new project directory containing the shared `uv.lock` file.
363
+
You can share your working environment with others by sharing the `uv.lock` file and the `pyproject.toml` file located in your project directory.
364
+
The `uv.lock` file contains the exact versions of all packages and dependencies used in your project.
365
+
Others can recreate the same environment by running the `uv sync --locked` command in a new project directory containing the shared files.
366
+
348
367
::
368
+
369
+
# Initialize a new project directory
370
+
mkdir new_asim_project
371
+
cd new_asim_project
372
+
373
+
# Copy .python-version file to new project directory (if exists)
374
+
copy path\to\shared\.python-version .
375
+
# Copy pyproject.toml file to new project directory
376
+
copy path\to\shared\pyproject.toml .
349
377
# Copy uv.lock file to new project directory
378
+
copy path\to\shared\uv.lock .
379
+
380
+
# Recreate the same environment
350
381
uv sync --locked
351
382
352
383
If I use the From PyPI option to install ActivitySim, would I run into dependency issues?
Using the :ref:`From PyPI` option to install ActivitySim may result in different versions of deep dependencies than those tested by ActivitySim developers.
355
-
This is because the :ref:`From PyPI` option installs only the direct dependencies listed in ActivitySim's `pyproject.toml` file,
385
+
Using the :ref:`Option 1: From PyPI` option to install ActivitySim may result in different versions of deep dependencies than those tested by ActivitySim developers.
386
+
This is because the :ref:`Option 1: From PyPI` option installs only the direct dependencies listed in ActivitySim's `pyproject.toml` file,
356
387
and relies on *uv* to resolve and install the deep dependencies. It is likely that a newer version of ActivitySim deep dependencies
357
388
may cause compatibility issues. For example, see this recent update with `numexpr`: https://github.com/pydata/numexpr/issues/540
358
389
359
-
When that happens, we recommend using the :ref:`From Source with Lockfile` option to install ActivitySim, which ensures that
390
+
When that happens, we recommend using the :ref:`Option 2: From Source with Lockfile` option to install ActivitySim, which ensures that
360
391
you are using the exact same deep dependencies as those tested by ActivitySim developers. In the meantime, you can also
361
392
report the compatibility issues to the ActivitySim development team via GitHub Issues, so that they can address them in future releases.
0 commit comments