Skip to content

Installation issues on MacOS and poetry #1740

Closed as not planned
Closed as not planned
@GeoffNN

Description

@GeoffNN

🐛 Bugs / Unexpected behaviors

I'm following the installation instructions on at https://github.com/facebookresearch/pytorch3d/blob/main/INSTALL.md. The installation errors by saying torch isn't installed, although it is.
I'm using Python 3.10.9, and a virtualenv through poetry. I've specific constraints pytorch<2.2 and torchvision=0.16. When installing from github, I get the following error:

On the other hand running poetry run python -c "import torch; print(torch.__version__)" returns "2.1.0".

Instructions To Reproduce the Issue:

Please include the following (depending on what the issue is):

  1. Any changes you made (git diff) or code you wrote
    N/A
  2. The exact command(s) you ran:
poetry new test_dir_pytorch3d
cd test_dir_pytorch3d
poetry env use 3.10
poetry add torch=2.1.0 torchvision=0.16
poetry run python -c "import torch; print(torch.__version__)"
>>> 2.1.0
MACOSX_DEPLOYMENT_TARGET=10.14 CC=clang CXX=clang++ poetry add  "git+https://github.com/facebookresearch/pytorch3d.git"
>>> ModuleNotFoundError: No module named 'torch'
  1. What you observed (including the full logs):
Unable to determine package info for path: /Users/.../.venv/src/pytorch3d

Command ['/var/folders/vm/.../.venv/bin/python', '-I', '-W', 'ignore', '-c', "import build\nimport build.env\nimport pyproject_hooks\n\nsource = '/Users/.../.venv/src/pytorch3d'\ndest = '/var/folders/vm/.../dist'\n\nwith build.env.DefaultIsolatedEnv() as env:\n    builder = build.ProjectBuilder(\n        source_dir=source,\n        python_executable=env.python_executable,\n        runner=pyproject_hooks.quiet_subprocess_runner,\n    )\n    env.install(builder.build_system_requires)\n    env.install(builder.get_requires_for_build('wheel'))\n    builder.metadata_path(dest)\n"] errored with the following return code 1

Error output:
Traceback (most recent call last):
  File "<string>", line 15, in <module>
  File "/private/var/folders/vm/.../.venv/lib/python3.12/site-packages/build/__init__.py", line 239, in get_requires_for_build
    with self._handle_backend(hook_name):
  File "/opt/homebrew/Cellar/[email protected]/3.12.1_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/private/var/folders/vm/.../.venv/lib/python3.12/site-packages/build/__init__.py", line 360, in _handle_backend
    raise BuildBackendException(exception, f'Backend subprocess exited when trying to invoke {hook}') from None
build._exceptions.BuildBackendException: Backend subprocess exited when trying to invoke get_requires_for_build_wheel

Fallback egg_info generation failed.

Command ['/var/folders/vm/.../.venv/bin/python', 'setup.py', 'egg_info'] errored with the following return code 1

Output:
Traceback (most recent call last):
  File "/Users/.../.venv/src/pytorch3d/setup.py", line 15, in <module>
    import torch
ModuleNotFoundError: No module named 'torch'

Note that I get the same error when I try MACOSX_DEPLOYMENT_TARGET=10.14 CC=clang CXX=clang++ poetry run pip install "git+https://github.com/facebookresearch/pytorch3d.git"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions