Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: relax open3d and numpy version requirements #85

Merged
merged 3 commits into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions camtools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import logging

from . import artifact
from . import camera
from . import colmap
Expand All @@ -16,13 +18,43 @@
from . import transform
from . import util


# Get package version for camtools
try:
# Python >= 3.8
from importlib.metadata import version

__version__ = version("camtools")
def _get_package_version(package):
return version(package)

except ImportError:
# Python < 3.8
import pkg_resources

__version__ = pkg_resources.get_distribution("camtools").version
def _get_package_version(package):
return pkg_resources.get_distribution(package).version


__version__ = _get_package_version("camtools")


# Check open3d and numpy compatibility
# https://github.com/isl-org/Open3D/issues/6840
try:
logging.basicConfig(format="%(message)s")
_logger = logging.getLogger(__name__)

o3d_version = _get_package_version("open3d")
np_version = _get_package_version("numpy")

o3d_version_tuple = tuple(map(int, o3d_version.split(".")[:2]))
np_version_tuple = tuple(map(int, np_version.split(".")[:2]))

if o3d_version_tuple < (0, 19) and np_version_tuple >= (2, 0):
_logger.warning(
f"[Warning] Incompatible versions: open3d {o3d_version} does "
f"not support numpy {np_version}. You may upgrade open3d to >= 0.19.0 "
f"or downgrade numpy to 1.x."
)
except Exception as e:
pass
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ classifiers = [
"Programming Language :: Python :: 3",
]
dependencies = [
"numpy>=1.15.0,<=1.26.4",
"numpy>=1.15.0",
"open3d>=0.16.0",
"opencv-python>=4.5.1.48",
"matplotlib>=3.3.4",
Expand Down
Loading