AlexanderFabisch / distance3d

Distance computation and collision detection in 3D.
https://alexanderfabisch.github.io/distance3d/
Other
61 stars 8 forks source link

Unable to install version 0.8, nested dependency open3d fails to install #86

Closed manuel-koch closed 9 months ago

manuel-koch commented 9 months ago

I'm trying to setup a new python environment and installing distance3d doesn't work for me anymore. I was using distance3d earlier with the same version range (>=0.8,<1.0) on my computer successfully. Is open3d a new (mandatory) requirement ?

Using the following simple project definition fails for me, running on macOS 14.3.1 (23D60), arm64:

project.toml

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "foo"
version = "0.0.0"
description = 'Foo'
requires-python = ">=3.10"
license = { text = "ISC" }
keywords = []
authors = []
classifiers = [
  "Programming Language :: Python",
  "Programming Language :: Python :: 3.10",
]
dependencies = [
  "numpy>=1,<2",
  "distance3d>=0.8,<1.0",
]

[project.urls]
Documentation = "https://foo.com"
Source = "https://foo.com"
Changelog = "https://foo.com"
Issues = ""

[tool.hatch.build.targets.sdist]
# using just a directory "python_foo" with an empty file "__init__.py"
packages = ["python_foo"]

[tool.hatch.build.targets.wheel]
packages = ["python_foo"]

[tool.hatch.envs.default]
dependencies = []

Trying to setup the environment fails:

$ hatch env prune ; hatch --verbose env create

Finished creating environment: default
Obtaining file:///Users/manuelkoch/tmp/test-env
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Checking if build backend supports build_editable: started
  Checking if build backend supports build_editable: finished with status 'done'
  Getting requirements to build editable: started
  Getting requirements to build editable: finished with status 'done'
  Preparing editable metadata (pyproject.toml): started
  Preparing editable metadata (pyproject.toml): finished with status 'done'
Collecting distance3d<1.0,>=0.8 (from foo==0.0.0)
  Using cached distance3d-0.8.0.tar.gz (78 kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Collecting numpy<2,>=1 (from foo==0.0.0)
  Using cached numpy-1.26.4-cp312-cp312-macosx_11_0_arm64.whl.metadata (61 kB)
Collecting scipy (from distance3d<1.0,>=0.8->foo==0.0.0)
  Using cached scipy-1.12.0-cp312-cp312-macosx_12_0_arm64.whl.metadata (217 kB)
Collecting matplotlib (from distance3d<1.0,>=0.8->foo==0.0.0)
  Using cached matplotlib-3.8.3-cp312-cp312-macosx_11_0_arm64.whl.metadata (5.8 kB)
Collecting pytransform3d (from distance3d<1.0,>=0.8->foo==0.0.0)
  Using cached pytransform3d-3.5.0.tar.gz (102 kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
INFO: pip is looking at multiple versions of distance3d to determine which version is compatible with other requirements. This could take a while.
ERROR: Ignored the following versions that require a different python version: 1.10.0 Requires-Python <3.12,>=3.8; 1.10.0rc1 Requires-Python <3.12,>=3.8; 1.10.0rc2 Requires-Python <3.12,>=3.8; 1.10.1 Requires-Python <3.12,>=3.8; 1.21.2 Requires-Python >=3.7,<3.11; 1.21.3 Requires-Python >=3.7,<3.11; 1.21.4 Requires-Python >=3.7,<3.11; 1.21.5 Requires-Python >=3.7,<3.11; 1.21.6 Requires-Python >=3.7,<3.11; 1.6.2 Requires-Python >=3.7,<3.10; 1.6.3 Requires-Python >=3.7,<3.10; 1.7.0 Requires-Python >=3.7,<3.10; 1.7.1 Requires-Python >=3.7,<3.10; 1.7.2 Requires-Python >=3.7,<3.11; 1.7.3 Requires-Python >=3.7,<3.11; 1.8.0 Requires-Python >=3.8,<3.11; 1.8.0rc1 Requires-Python >=3.8,<3.11; 1.8.0rc2 Requires-Python >=3.8,<3.11; 1.8.0rc3 Requires-Python >=3.8,<3.11; 1.8.0rc4 Requires-Python >=3.8,<3.11; 1.8.1 Requires-Python >=3.8,<3.11; 1.9.0 Requires-Python >=3.8,<3.12; 1.9.0rc1 Requires-Python >=3.8,<3.12; 1.9.0rc2 Requires-Python >=3.8,<3.12; 1.9.0rc3 Requires-Python >=3.8,<3.12; 1.9.1 Requires-Python >=3.8,<3.12
ERROR: Could not find a version that satisfies the requirement open3d (from distance3d) (from versions: none)
ERROR: No matching distribution found for open3d

My project wants to use Python 3.10. I don't see why it couldn't find a matching open3d version given the previous pip output. All of the following versions seem to be compatible with my Python interpreter ( as far as details in the pip output are stating ):

manuel-koch commented 9 months ago

I noticed that master branch is a lot ahead of latest released version of distance3d. Maybe this is already fixed, but not available on PyPi ?

AlexanderFabisch commented 9 months ago

Open3D was a dependency for a long time already. But it is not required for all components. Mostly for loading meshes and visualization. If you like to open a pull request, you can make it optional by moving it to extra_requires. Note to myself: I have to find out which parts actually require Open3D.

The problem is that Open3D is usually not compatible with the latest Python version. So switching to an earlier version is another solution.

A hotfix would be to use pip install --no-deps (not sure if that is the correct syntax though).

In any case I have to make a new release soon. I just didn't do it because I am working with the master branch.

manuel-koch commented 9 months ago

I'm not using latest python version in the example above ( example=3.10 vs latest=3.12 ).

AlexanderFabisch commented 9 months ago

Strange, Open3D 0.18 supports Python 3.8 - 3.11 according to the website.

AlexanderFabisch commented 9 months ago

I'm not using latest python version in the example above ( example=3.10 vs latest=3.12 ).

Are you sure?

requires-python = ">=3.10"

would also include 3.12.

manuel-koch commented 9 months ago

Ah, I see, the line requires-python = ">=3.10" from the project.toml actually allows using Python 3.12 for the hatch environment. I'll try to pin that to 3.10 and see if it works. Thanks for the hint !

manuel-koch commented 9 months ago

Tweaking the project.toml with the following snippet fixed the issue for me:

[tool.hatch.envs.default]
python = "3.10"

Thank you for the quick response !