Skip to content

Commit

Permalink
Support python 3.7 (#802)
Browse files Browse the repository at this point in the history
* Support python 3.7

* Update docs
  • Loading branch information
tancik committed Oct 18, 2022
1 parent 951d972 commit 9bed696
Show file tree
Hide file tree
Showing 15 changed files with 37 additions and 24 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,13 @@ For more complex changes (e.g., running with your own data/setting up a new NeRF

## 1. Installation: Setup the environment

### Prerequisites

CUDA must be installed on the system. This library has been tested with version 11.3. You can find more information about installing CUDA [here](https://docs.nvidia.com/cuda/cuda-quick-start-guide/index.html)

### Create environment

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.7`. We recommend using conda to manage dependencies. Make sure to install [Conda](https://docs.conda.io/en/latest/miniconda.html) before proceeding.

```bash
conda create --name nerfstudio -y python=3.8
Expand Down
6 changes: 5 additions & 1 deletion docs/quickstart/installation.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Installation

## Prerequisites

CUDA must be installed on the system. This library has been tested with version 11.3. You can find more information about installing CUDA [here](https://docs.nvidia.com/cuda/cuda-quick-start-guide/index.html)

## Create environment

We recommend using conda to manage dependencies. Make sure to install [Conda](https://docs.conda.io/en/latest/miniconda.html) before preceding.
Nerfstudio requires `python >= 3.7`. We recommend using conda to manage dependencies. Make sure to install [Conda](https://docs.conda.io/en/latest/miniconda.html) before preceding.

```bash
conda create --name nerfstudio -y python=3.8
Expand Down
4 changes: 2 additions & 2 deletions nerfstudio/cameras/camera_optimizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@

import functools
from dataclasses import dataclass, field
from typing import Literal, Type, Union
from typing import Type, Union

import torch
import tyro
from torch import nn
from torchtyping import TensorType
from typing_extensions import assert_never
from typing_extensions import Literal, assert_never

from nerfstudio.cameras.lie_groups import exp_map_SE3, exp_map_SO3xR3
from nerfstudio.configs import base_config as cfg
Expand Down
3 changes: 2 additions & 1 deletion nerfstudio/cameras/camera_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
"""

import math
from typing import List, Literal, Optional, Tuple
from typing import List, Optional, Tuple

import numpy as np
import torch
from torchtyping import TensorType
from typing_extensions import Literal

_EPS = np.finfo(float).eps * 4.0

Expand Down
3 changes: 2 additions & 1 deletion nerfstudio/configs/base_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
from dataclasses import dataclass
from datetime import datetime
from pathlib import Path
from typing import Any, Dict, List, Literal, Optional, Tuple, Type
from typing import Any, Dict, List, Optional, Tuple, Type

import yaml
from rich.console import Console
from typing_extensions import Literal

from nerfstudio.configs.config_utils import to_immutable_dict

Expand Down
3 changes: 2 additions & 1 deletion nerfstudio/data/dataparsers/nerfstudio_dataparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@
import math
from dataclasses import dataclass, field
from pathlib import Path, PureWindowsPath
from typing import Literal, Optional, Type
from typing import Optional, Type

import numpy as np
import torch
from PIL import Image
from rich.console import Console
from typing_extensions import Literal

from nerfstudio.cameras import camera_utils
from nerfstudio.cameras.cameras import CAMERA_MODEL_TO_TYPE, Cameras, CameraType
Expand Down
3 changes: 2 additions & 1 deletion nerfstudio/data/dataparsers/record3d_dataparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@

from dataclasses import dataclass, field
from pathlib import Path
from typing import Literal, Type
from typing import Type

import numpy as np
import torch
from scipy.spatial.transform import Rotation
from typing_extensions import Literal

from nerfstudio.cameras import camera_utils
from nerfstudio.cameras.cameras import Cameras, CameraType
Expand Down
3 changes: 2 additions & 1 deletion nerfstudio/field_components/encodings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
"""

from abc import abstractmethod
from typing import Literal, Optional
from typing import Optional

import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
from torchtyping import TensorType
from typing_extensions import Literal

from nerfstudio.field_components.base_field_component import FieldComponent
from nerfstudio.utils.math import components_from_spherical_harmonics, expected_sin
Expand Down
3 changes: 2 additions & 1 deletion nerfstudio/model_components/renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@
"""
import math
from typing import Literal, Optional, Union
from typing import Optional, Union

import nerfacc
import torch
from torch import nn
from torchtyping import TensorType
from typing_extensions import Literal

from nerfstudio.cameras.rays import RaySamples
from nerfstudio.utils.math import components_from_spherical_harmonics
Expand Down
3 changes: 2 additions & 1 deletion nerfstudio/models/nerfacto.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
from __future__ import annotations

from dataclasses import dataclass, field
from typing import Dict, List, Literal, Tuple, Type
from typing import Dict, List, Tuple, Type

import numpy as np
import torch
from torch.nn import Parameter
from torchmetrics import PeakSignalNoiseRatio
from torchmetrics.functional import structural_similarity_index_measure
from torchmetrics.image.lpip import LearnedPerceptualImagePatchSimilarity
from typing_extensions import Literal

from nerfstudio.cameras.rays import RayBundle
from nerfstudio.engine.callbacks import (
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ version = "0.1.5.1"
description = "All-in-one repository for state-of-the-art NeRFs"
readme = "README.md"
license = { text="Apache 2.0"}
requires-python = ">=3.8"
requires-python = ">=3.7.3"
classifiers = [
"Development Status :: 3 - Alpha",
"Programming Language :: Python",
Expand All @@ -30,7 +30,7 @@ dependencies = [
"mediapy==1.1.0",
"msgpack==1.0.4",
"msgpack_numpy==0.4.8",
"nerfacc==0.2.0",
"nerfacc==0.2.1",
"opencv-python==4.6.0.66",
"plotly==5.7.0",
"protobuf==3.20.0",
Expand Down
9 changes: 3 additions & 6 deletions scripts/completions/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
import stat
import subprocess
import sys
from typing import List, Literal, Union
from typing import List, Union

import tyro
from rich.console import Console
from rich.prompt import Confirm
from typing_extensions import assert_never
from typing_extensions import Literal, assert_never

ConfigureMode = Literal["install", "uninstall"]
ShellType = Literal["zsh", "bash"]
Expand Down Expand Up @@ -175,10 +175,7 @@ def _update_rc(
assert_never(mode)


def main(
mode: ConfigureMode = "install",
/,
) -> None:
def main(mode: ConfigureMode = "install") -> None:
"""Main script.
Args:
Expand Down
3 changes: 2 additions & 1 deletion scripts/downloads/download_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
import sys
import zipfile
from pathlib import Path
from typing import Literal, Optional
from typing import Optional

import gdown
import tyro
from rich.console import Console
from typing_extensions import Literal

CONSOLE = Console(width=120)

Expand Down
4 changes: 2 additions & 2 deletions scripts/process_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
from dataclasses import dataclass
from enum import Enum
from pathlib import Path
from typing import List, Literal, Optional, Tuple, Union
from typing import List, Optional, Tuple, Union

import appdirs
import numpy as np
import requests
import tyro
from rich.console import Console
from rich.progress import track
from typing_extensions import Annotated
from typing_extensions import Annotated, Literal

from nerfstudio.utils import colmap_utils, install_checks

Expand Down
4 changes: 2 additions & 2 deletions scripts/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import json
import sys
from pathlib import Path
from typing import Literal, Optional
from typing import Optional

import mediapy as media
import torch
Expand All @@ -21,7 +21,7 @@
TextColumn,
TimeRemainingColumn,
)
from typing_extensions import assert_never
from typing_extensions import Literal, assert_never

from nerfstudio.cameras.camera_paths import get_path_from_json, get_spiral_path
from nerfstudio.cameras.cameras import Cameras
Expand Down

0 comments on commit 9bed696

Please sign in to comment.