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
Support modern uv project management (uv init + uv add)
- Update MaxText installation scripts to detect 'uv.lock' and use 'uv add --frozen'.
- Consolidate uv detection and installation logic into a shared 'uv_utils.py' module.
- Improve uv detection robustness by prioritizing 'python -m uv' and path lookup.
- Update docs/install_maxtext.md with modern uv workflow instructions and fix outdated paths.
- Fix macOS installation by dynamically skipping legacy MaxText directory.
> **Note:** The `install_maxtext_tpu_github_deps`, `install_maxtext_cuda12_github_dep`, and
58
+
> **Note:** The `install_maxtext_tpu_github_deps`, `install_maxtext_cuda12_github_deps`, and
59
59
> `install_maxtext_tpu_post_train_extra_deps` commands are temporarily required to install dependencies directly from GitHub
60
60
> that are not yet available on PyPI. As shown above, choose the one that corresponds to your use case.
61
61
62
+
## Modern UV Project (Recommended for New Projects)
63
+
64
+
If you are starting a new project and want to use `uv`'s project management features (with a `pyproject.toml` and `uv.lock` in your own project), you can use `uv add`. MaxText's helper scripts will detect your `uv.lock` and correctly add their extra dependencies to your `pyproject.toml`.
65
+
66
+
```bash
67
+
# 1. Initialize your project
68
+
mkdir my-maxtext-project &&cd my-maxtext-project
69
+
uv init
70
+
71
+
# 2. Add MaxText as a dependency
72
+
uv add maxtext[tpu] --resolution=lowest
73
+
74
+
# 3. Install MaxText's extra GitHub dependencies
75
+
# These will be automatically added to your pyproject.toml
76
+
install_maxtext_tpu_github_deps
77
+
```
78
+
62
79
> **Note:** The maxtext package contains a comprehensive list of all direct and transitive dependencies, with lower bounds, generated by [seed-env](https://github.com/google-ml-infra/actions/tree/main/python_seed_env). We highly recommend the `--resolution=lowest` flag. It instructs `uv` to install the specific, tested versions of dependencies defined by MaxText, rather than the latest available ones. This ensures a consistent and reproducible environment, which is critical for stable performance and for running benchmarks.
63
80
81
+
## macOS Installation
82
+
83
+
Due to macOS's case-insensitive filesystem, special care is needed to avoid conflicts between the `maxtext` and legacy `MaxText` package names. We recommend installing it from source using the `.[runner]` configuration.
84
+
64
85
## From Source
65
86
66
87
If you plan to contribute to MaxText or need the latest unreleased features, install from source.
@@ -110,7 +131,7 @@ To update dependencies, you will follow these general steps:
110
131
111
132
1.**Modify Base Requirements**: Update the desired dependencies in `base_requirements/requirements.txt` or the hardware-specific files (`base_requirements/tpu-base-requirements.txt`, `base_requirements/gpu-base-requirements.txt`).
112
133
2.**Generate New Files**: Run the `seed-env` CLI tool to generate new, fully-pinned requirements files based on your changes.
113
-
3.**Update Project Files**: Copy the newly generated files into the `generated_requirements/` directory.
134
+
3.**Update Project Files**: Copy the newly generated files into the `src/dependencies/requirements/generated_requirements/` directory.
114
135
4.**Handle GitHub Dependencies**: Move any dependencies that are installed directly from GitHub from the generated files to `src/dependencies/github_deps/pre_train_deps.txt`.
115
136
5.**Verify**: Test the new dependencies to ensure the project installs and runs correctly.
116
137
@@ -166,8 +187,8 @@ After generating the new requirements, you need to update the files in the MaxTe
166
187
167
188
1.**Copy the generated files:**
168
189
169
-
- Move `generated_tpu_artifacts/tpu-requirements.txt` to `generated_requirements/tpu-requirements.txt`.
170
-
- Move `generated_gpu_artifacts/cuda12-requirements.txt` to `generated_requirements/cuda12-requirements.txt`.
190
+
- Move `generated_tpu_artifacts/tpu-requirements.txt` to `src/dependencies/requirements/generated_requirements/tpu-requirements.txt`.
191
+
- Move `generated_gpu_artifacts/cuda12-requirements.txt` to `src/dependencies/requirements/generated_requirements/cuda12-requirements.txt`.
171
192
172
193
2.**Update `pre_train_deps.txt` (if necessary):**
173
194
Currently, MaxText uses a few dependencies, such as `mlperf-logging` and `google-jetstream`, that are installed directly from GitHub source. These are defined in `base_requirements/requirements.txt`, and the `seed-env` tool will carry them over to the generated requirements files.
0 commit comments