From 35f8f73b92d6dd301a0a921eb5c4ea1e2dc5e733 Mon Sep 17 00:00:00 2001 From: Sebastiaan Meijer Date: Mon, 18 Nov 2024 21:30:20 +0100 Subject: [PATCH 1/4] Drop support for Python 3.8, suggest 3.10 by default (and unrelated automatic formatting fixes) --- docs/quickstart/installation.md | 20 ++++++++++---------- pyproject.toml | 6 ++---- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/docs/quickstart/installation.md b/docs/quickstart/installation.md index de79064213..579cd7674f 100644 --- a/docs/quickstart/installation.md +++ b/docs/quickstart/installation.md @@ -5,16 +5,16 @@ ::::::{tab-set} :::::{tab-item} Linux -Nerfstudio requires `python >= 3.8`. We recommend using conda to manage dependencies. Make sure to install [Conda](https://docs.conda.io/en/latest/miniconda.html) before proceeding. +Nerfstudio requires `python >= 3.9`. We recommend using conda to manage dependencies. Make sure to install [Conda](https://docs.conda.io/en/latest/miniconda.html) before proceeding. ::::: :::::{tab-item} Windows :::{admonition} Note :class: info -Nerfstudio on Windows is less tested and more fragile, due to way more moving parts outside of Nerfstudio's control. -The instructions also tend to break over time as updates to different Windows packages happen. -Installing Nerfstudio on Linux instead is recommended if you have the option. +Nerfstudio on Windows is less tested and more fragile, due to way more moving parts outside of Nerfstudio's control. +The instructions also tend to break over time as updates to different Windows packages happen. +Installing Nerfstudio on Linux instead is recommended if you have the option. Alternatively, installing Nerfstudio under WSL2 (temporary unofficial guide [here](https://gist.github.com/SharkWipf/0a3fc1be3ea88b0c9640db6ce15b44b9), not guaranteed to work) is also an option, but this comes with its own set of caveats. ::: @@ -51,7 +51,7 @@ For example: When updating, or if you close your terminal before you finish the installation and run your first `splatfacto`, you have to re-do this environment activation step. ::: -Nerfstudio requires `python >= 3.8`. We recommend using conda to manage dependencies. Make sure to install [Conda](https://docs.conda.io/en/latest/miniconda.html) before proceeding. +Nerfstudio requires `python >= 3.9`. We recommend using conda to manage dependencies. Make sure to install [Conda](https://docs.conda.io/en/latest/miniconda.html) before proceeding. ::::: :::::: @@ -59,7 +59,7 @@ Nerfstudio requires `python >= 3.8`. We recommend using conda to manage dependen ## Create environment ```bash -conda create --name nerfstudio -y python=3.8 +conda create --name nerfstudio -y python=3.10 conda activate nerfstudio python -m pip install --upgrade pip @@ -184,7 +184,7 @@ TLDR for linux: curl -fsSL https://pixi.sh/install.sh | bash ``` -### Install Pixi Environmnent +### Install Pixi Environmnent After Pixi is installed, you can run ```bash git clone https://github.com/nerfstudio-project/nerfstudio.git @@ -192,7 +192,7 @@ cd nerfstudio pixi run post-install pixi shell ``` -This will fetch the latest Nerfstudio code, install all enviroment dependencies including colmap, tinycudann and hloc, and then activate the pixi environment (similar to conda). +This will fetch the latest Nerfstudio code, install all enviroment dependencies including colmap, tinycudann and hloc, and then activate the pixi environment (similar to conda). From now on, each time you want to run Nerfstudio in a new shell, you have to navigate to the nerfstudio folder and run `pixi shell` again. You could also run @@ -435,6 +435,6 @@ export PATH=$PATH:$CUDA_HOME/bin **Other errors** -(Windows) A lot of errors on Windows can be caused by not having the Visual Studio environment loaded. -If you run into errors you can't figure out, please try re-activating the Visual Studio environment (as outlined at the top of the Windows instructions on this page) and try again. +(Windows) A lot of errors on Windows can be caused by not having the Visual Studio environment loaded. +If you run into errors you can't figure out, please try re-activating the Visual Studio environment (as outlined at the top of the Windows instructions on this page) and try again. This activation only lasts within your current terminal session and does not extend to other terminals, but this should only be needed on first run and on updates. diff --git a/pyproject.toml b/pyproject.toml index 6d284ae13b..fe7de0b951 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ version = "1.1.5" description = "All-in-one repository for state-of-the-art NeRFs" readme = "README.md" license = { text="Apache 2.0"} -requires-python = ">=3.8.0" +requires-python = ">=3.9.0" classifiers = [ "Development Status :: 3 - Alpha", "Programming Language :: Python", @@ -39,9 +39,7 @@ dependencies = [ "protobuf<=3.20.3,!=3.20.0", # TODO(1480) enable when pycolmap windows wheels are available # "pycolmap==0.3.0", - # TODO(3461) and external issue cnr-isti-vclab/PyMeshLab/issues/398: Unrestrict Windows version when it isn't broken anymore. "pymeshlab>=2022.2.post2; platform_machine != 'arm64' and platform_machine != 'aarch64'", - "pymeshlab<2023.12.post2; sys_platform == 'win32' and platform_machine != 'arm64' and platform_machine != 'aarch64'", "pyngrok>=5.1.0", "python-socketio>=5.7.1", "pyquaternion>=0.9.9", @@ -162,7 +160,7 @@ reportMissingImports = "warning" reportMissingTypeStubs = false reportPrivateImportUsage = false -pythonVersion = "3.8" +pythonVersion = "3.10" pythonPlatform = "Linux" [tool.ruff] From 8311cf62f43c8d6596365f6fd3a59acb4b671452 Mon Sep 17 00:00:00 2001 From: Sebastiaan Meijer Date: Mon, 18 Nov 2024 21:55:08 +0100 Subject: [PATCH 2/4] Update github workflow to Python 3.10 --- .github/workflows/core_code_checks.yml | 4 ++-- .github/workflows/publish.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/core_code_checks.yml b/.github/workflows/core_code_checks.yml index 35ed0f1ca5..8f3b7df8fb 100644 --- a/.github/workflows/core_code_checks.yml +++ b/.github/workflows/core_code_checks.yml @@ -15,10 +15,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Python 3.8.13 + - name: Set up Python 3.10.15 uses: actions/setup-python@v4 with: - python-version: '3.8.13' + python-version: '3.10.15' - uses: actions/cache@v2 with: path: ${{ env.pythonLocation }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b75984535a..e9039a2aa6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v1 with: - python-version: '3.8' + python-version: '3.10' - name: Install dependencies run: | python -m pip install build twine From 9c2d67f95142d58fe38aa76aa5feb7addc7877ac Mon Sep 17 00:00:00 2001 From: Sebastiaan Meijer Date: Tue, 19 Nov 2024 01:59:33 +0100 Subject: [PATCH 3/4] Update pixi.toml to use Python>=3.9 --- pixi.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pixi.toml b/pixi.toml index ad2eee6aec..36156143b3 100644 --- a/pixi.toml +++ b/pixi.toml @@ -21,7 +21,7 @@ train-example-nerf = {cmd="ns-train nerfacto --data data/nerfstudio/dozer/", dep [dependencies] -python = ">=3.8,<3.11" +python = ">=3.9,<3.11" pip = ">=24.0,<25" cuda = {version = "*", channel="nvidia/label/cuda-11.8.0"} pytorch-cuda = {version = "11.8.*", channel="pytorch"} From 191ea43c52fd8de063c2f787c0744ae410986821 Mon Sep 17 00:00:00 2001 From: Sebastiaan Meijer Date: Thu, 21 Nov 2024 23:07:17 +0100 Subject: [PATCH 4/4] ruff formatting --- nerfstudio/scripts/render.py | 7 ++++--- nerfstudio/viewer/render_state_machine.py | 8 +++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/nerfstudio/scripts/render.py b/nerfstudio/scripts/render.py index 4eb4a71840..47944bdcbd 100644 --- a/nerfstudio/scripts/render.py +++ b/nerfstudio/scripts/render.py @@ -186,9 +186,10 @@ def _render_trajectory_video( max_idx = true_max_idx if crop_data is not None: - with renderers.background_color_override_context( - crop_data.background_color.to(pipeline.device) - ), torch.no_grad(): + with ( + renderers.background_color_override_context(crop_data.background_color.to(pipeline.device)), + torch.no_grad(), + ): outputs = pipeline.model.get_outputs_for_camera( cameras[camera_idx : camera_idx + 1], obb_box=obb_box ) diff --git a/nerfstudio/viewer/render_state_machine.py b/nerfstudio/viewer/render_state_machine.py index 32448d9bc8..7f646038f0 100644 --- a/nerfstudio/viewer/render_state_machine.py +++ b/nerfstudio/viewer/render_state_machine.py @@ -161,9 +161,11 @@ def _render_img(self, camera_state: CameraState): [color[0] / 255.0, color[1] / 255.0, color[2] / 255.0], device=self.viewer.get_model().device, ) - with background_color_override_context( - background_color - ), torch.no_grad(), viewer_utils.SetTrace(self.check_interrupt): + with ( + background_color_override_context(background_color), + torch.no_grad(), + viewer_utils.SetTrace(self.check_interrupt), + ): outputs = self.viewer.get_model().get_outputs_for_camera(camera, obb_box=obb) else: with torch.no_grad(), viewer_utils.SetTrace(self.check_interrupt):