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

Poetry unable to install pytorch3d #8574

Closed
4 tasks done
leweex95 opened this issue Oct 25, 2023 · 19 comments
Closed
4 tasks done

Poetry unable to install pytorch3d #8574

leweex95 opened this issue Oct 25, 2023 · 19 comments
Labels
kind/bug Something isn't working as expected

Comments

@leweex95
Copy link

leweex95 commented Oct 25, 2023

  • Poetry version: 1.6.1

  • Python version: 3.8.10

  • OS version and name: 20.04.5 LTS

  • pyproject.toml: shown below

  • I am on the latest stable Poetry version, installed using a recommended method.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • I have consulted the FAQ and blog for any relevant entries or release notes.

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

pip has no problem to install the pytorch3d package via a simple pip install: pip install pytorch3d.

Poetry, on the other hand, fails to do the job.

I believe this is a bug and would like to ask for workarounds and, if possible, a resolution of this unwanted behavior.

I tried all the below commands, in vain:

poetry add -vvv pytorch3d showed the following output:

Loading configuration file /home/myfolder/.config/pypoetry/config.toml
Using virtualenv: /home/myfolder/poetry_env/poetry_env_demo/.venv
Creating new session for pypi.org
Source (PyPI): 13 packages found for pytorch3d *
Using version ^0.7.4 for pytorch3d

Updating dependencies
Resolving dependencies...
   1: fact: poetry-env-demo is 0.1.0
   1: derived: poetry-env-demo
   1: fact: poetry-env-demo depends on pytorch3d (^0.7.4)
   1: selecting poetry-env-demo (0.1.0)
   1: derived: pytorch3d (>=0.7.4,<0.8.0)
Source (PyPI): 1 packages found for pytorch3d >=0.7.4,<0.8.0
   1: fact: pytorch3d (0.7.4) depends on fvcore (*)
   1: fact: pytorch3d (0.7.4) depends on iopath (*)
   1: selecting pytorch3d (0.7.4)
   1: derived: iopath
   1: derived: fvcore
Source (PyPI): 10 packages found for iopath *
Source (PyPI): 123 packages found for fvcore *
   1: fact: fvcore (0.1.5.post20221221) depends on numpy (*)
   1: fact: fvcore (0.1.5.post20221221) depends on yacs (>=0.1.6)
   1: fact: fvcore (0.1.5.post20221221) depends on pyyaml (>=5.1)
   1: fact: fvcore (0.1.5.post20221221) depends on tqdm (*)
   1: fact: fvcore (0.1.5.post20221221) depends on termcolor (>=1.1)
   1: fact: fvcore (0.1.5.post20221221) depends on Pillow (*)
   1: fact: fvcore (0.1.5.post20221221) depends on tabulate (*)
   1: fact: fvcore (0.1.5.post20221221) depends on iopath (>=0.1.7)
   1: selecting fvcore (0.1.5.post20221221)
   1: derived: iopath (>=0.1.7)
   1: derived: tabulate
   1: derived: Pillow
   1: derived: termcolor (>=1.1)
   1: derived: tqdm
   1: derived: pyyaml (>=5.1)
   1: derived: yacs (>=0.1.6)
   1: derived: numpy
Source (PyPI): 26 packages found for tabulate *
Source (PyPI): 92 packages found for pillow *
Source (PyPI): 7 packages found for termcolor >=1.1
Source (PyPI): 132 packages found for tqdm *
Source (PyPI): 10 packages found for pyyaml >=5.1
Source (PyPI): 3 packages found for yacs >=0.1.6
Source (PyPI): 101 packages found for numpy *
   1: fact: tqdm (4.66.1) depends on colorama (*)
   1: selecting tqdm (4.66.1)
   1: derived: colorama
Source (PyPI): 43 packages found for colorama *
   1: fact: numpy (1.26.1) requires Python <3.13,>=3.9
   1: derived: not numpy (==1.26.1)
   1: fact: numpy (1.26.0) requires Python <3.13,>=3.9
   1: derived: not numpy (==1.26.0)
   1: fact: numpy (1.25.2) requires Python >=3.9
   1: derived: not numpy (==1.25.2)
   1: fact: numpy (1.25.1) requires Python >=3.9
   1: derived: not numpy (==1.25.1)
   1: fact: numpy (1.25.0) requires Python >=3.9
   1: derived: not numpy (==1.25.0)
   1: selecting numpy (1.24.4)
   1: selecting pillow (10.1.0)
   1: selecting tabulate (0.9.0)
   1: selecting pyyaml (6.0.1)
   1: selecting termcolor (2.3.0)
   1: fact: iopath (0.1.10) depends on tqdm (*)
   1: fact: iopath (0.1.10) depends on typing_extensions (*)
   1: fact: iopath (0.1.10) depends on portalocker (*)
   1: selecting iopath (0.1.10)
   1: derived: portalocker
   1: derived: typing_extensions
Source (PyPI): 39 packages found for portalocker *
Source (PyPI): 27 packages found for typing-extensions *
   1: fact: portalocker (2.8.2) depends on pywin32 (>=226)
   1: selecting portalocker (2.8.2)
   1: derived: pywin32 (>=226)
Source (PyPI): 10 packages found for pywin32 >=226
   1: selecting typing-extensions (4.8.0)
   1: fact: yacs (0.1.8) depends on PyYAML (*)
   1: selecting yacs (0.1.8)
   1: selecting colorama (0.4.6)
   1: selecting pywin32 (306)
   1: Version solving took 0.356 seconds.
   1: Tried 1 solutions.

Finding the necessary packages for the current system
Source (PyPI): 1 packages found for pytorch3d >=0.7.4,<0.8.0
Source (PyPI): 1 packages found for iopath *
Source (PyPI): 1 packages found for fvcore *
Source (PyPI): 1 packages found for portalocker *
Source (PyPI): 1 packages found for typing-extensions *
Source (PyPI): 1 packages found for tqdm *
Source (PyPI): 1 packages found for tabulate *
Source (PyPI): 1 packages found for pillow *
Source (PyPI): 1 packages found for termcolor >=1.1
Source (PyPI): 1 packages found for pyyaml >=5.1
Source (PyPI): 1 packages found for yacs >=0.1.6
Source (PyPI): 1 packages found for numpy *

Package operations: 1 install, 0 updates, 0 removals, 11 skipped

  • Installing fvcore (0.1.5.post20221221): Pending...
  • Installing fvcore (0.1.5.post20221221): Skipped for the following reason: Already installed
  • Installing numpy (1.24.4): Pending...
  • Installing numpy (1.24.4): Skipped for the following reason: Already installed
  • Installing portalocker (2.8.2): Pending...
  • Installing portalocker (2.8.2): Skipped for the following reason: Already installed
  • Installing iopath (0.1.10): Pending...
  • Installing iopath (0.1.10): Skipped for the following reason: Already installed
  • Installing pyyaml (6.0.1): Pending...
  • Installing pyyaml (6.0.1): Skipped for the following reason: Already installed
  • Installing tabulate (0.9.0): Pending...
  • Installing tabulate (0.9.0): Skipped for the following reason: Already installed
  • Installing pytorch3d (0.7.4): Pending...
  • Installing tqdm (4.66.1): Pending...
  • Installing tqdm (4.66.1): Skipped for the following reason: Already installed
  • Installing yacs (0.1.8): Pending...
  • Installing pytorch3d (0.7.4): Failed

  Stack trace:

  5  ~/.local/lib/python3.8/site-packages/poetry/installation/executor.py:286 in _execute_operation
      284│ 
      285│             try:
    → 286│                 result = self._do_execute_operation(operation)
      287│             except EnvCommandError as e:
      288│                 if e.e.returncode == -2:

  4  ~/.local/lib/python3.8/site-packages/poetry/installation/executor.py:386 in _do_execute_operation
      384│             return 0
      385│ 
    → 386│         result: int = getattr(self, f"_execute_{method}")(operation)
      387│ 
      388│         if result != 0:

  3  ~/.local/lib/python3.8/site-packages/poetry/installation/executor.py:511 in _execute_install
      509│ 
      510│     def _execute_install(self, operation: Install | Update) -> int:
    → 511│         status_code = self._install(operation)
      512│ 
      513│         self._save_url_reference(operation)

  2  ~/.local/lib/python3.8/site-packages/poetry/installation/executor.py:549 in _install
      547│             archive = self._download_link(operation, Link(package.source_url))
      548│         else:
    → 549│             archive = self._download(operation)
      550│ 
      551│         operation_message = self.get_operation_message(operation)

  1  ~/.local/lib/python3.8/site-packages/poetry/installation/executor.py:739 in _download
      737│ 
      738│     def _download(self, operation: Install | Update) -> Path:
    → 739│         link = self._chooser.choose_for(operation.package)
      740│ 
      741│         if link.yanked:

  RuntimeError

  Unable to find installation candidates for pytorch3d (0.7.4)

  at ~/.local/lib/python3.8/site-packages/poetry/installation/chooser.py:73 in choose_for
       69│ 
       70│             links.append(link)
       71│ 
       72│         if not links:
    →  73│             raise RuntimeError(f"Unable to find installation candidates for {package}")
       74│ 
       75│         # Get the best link
       76│         chosen = max(links, key=lambda link: self._sort_key(package, link))
       77│ 

I also tried adding the package via: poetry add -vvv git+ssh://[email protected]/facebookresearch/pytorch3d.git which also yielded an error:

Loading configuration file /home/myfolder/.config/pypoetry/config.toml
Using virtualenv: /home/myfolder/poetry_env/poetry_env_demo/.venv

  Stack trace:

  3  ~/.local/lib/python3.8/site-packages/dulwich/client.py:1130 in fetch_pack
      1128│         with proto:
      1129│             try:
    → 1130│                 refs, server_capabilities = read_pkt_refs(proto.read_pkt_seq())
      1131│             except HangupException as exc:
      1132│                 raise _remote_error_from_stderr(stderr) from exc

  2  ~/.local/lib/python3.8/site-packages/dulwich/client.py:241 in read_pkt_refs
       239│     refs = {}
       240│     # Receive refs from server
    →  241│     for pkt in pkt_seq:
       242│         (sha, ref) = pkt.rstrip(b"\n").split(None, 1)
       243│         if sha == b"ERR":

  1  ~/.local/lib/python3.8/site-packages/dulwich/protocol.py:272 in read_pkt_seq
      270│             flush-pkt.
      271│         """
    → 272│         pkt = self.read_pkt_line()
      273│         while pkt:
      274│             yield pkt

  HangupException

  The remote server unexpectedly closed the connection.

  at ~/.local/lib/python3.8/site-packages/dulwich/protocol.py:215 in read_pkt_line
      211│ 
      212│         try:
      213│             sizestr = read(4)
      214│             if not sizestr:
    → 215│                 raise HangupException()
      216│             size = int(sizestr, 16)
      217│             if size == 0:
      218│                 if self.report_activity:
      219│                     self.report_activity(4, "read")

The following error occurred when trying to handle this error:


  Stack trace:

  20  ~/.local/lib/python3.8/site-packages/cleo/application.py:327 in run
       325│ 
       326│             try:
     → 327│                 exit_code = self._run(io)
       328│             except BrokenPipeError:
       329│                 # If we are piped to another process, it may close early and send a

  19  ~/.local/lib/python3.8/site-packages/poetry/console/application.py:190 in _run
       188│         self._load_plugins(io)
       189│ 
     → 190│         exit_code: int = super()._run(io)
       191│         return exit_code
       192│ 

  18  ~/.local/lib/python3.8/site-packages/cleo/application.py:431 in _run
       429│             io.input.interactive(interactive)
       430│ 
     → 431│         exit_code = self._run_command(command, io)
       432│         self._running_command = None
       433│ 

  17  ~/.local/lib/python3.8/site-packages/cleo/application.py:473 in _run_command
       471│ 
       472│         if error is not None:
     → 473│             raise error
       474│ 
       475│         return terminate_event.exit_code

  16  ~/.local/lib/python3.8/site-packages/cleo/application.py:457 in _run_command
       455│ 
       456│             if command_event.command_should_run():
     → 457│                 exit_code = command.run(io)
       458│             else:
       459│                 exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED

  15  ~/.local/lib/python3.8/site-packages/cleo/commands/base_command.py:119 in run
       117│         io.input.validate()
       118│ 
     → 119│         status_code = self.execute(io)
       120│ 
       121│         if status_code is None:

  14  ~/.local/lib/python3.8/site-packages/cleo/commands/command.py:62 in execute
        60│ 
        61│         try:
     →  62│             return self.handle()
        63│         except KeyboardInterrupt:
        64│             return 1

  13  ~/.local/lib/python3.8/site-packages/poetry/console/commands/add.py:160 in handle
       158│             return 0
       159│ 
     → 160│         requirements = self._determine_requirements(
       161│             packages,
       162│             allow_prereleases=self.option("allow-prereleases"),

  12  ~/.local/lib/python3.8/site-packages/poetry/console/commands/init.py:375 in _determine_requirements
       373│ 
       374│         result = []
     → 375│         for requirement in self._parse_requirements(requires):
       376│             if "git" in requirement or "url" in requirement or "path" in requirement:
       377│                 result.append(requirement)

  11  ~/.local/lib/python3.8/site-packages/poetry/console/commands/init.py:441 in _parse_requirements
       439│             cwd=cwd,
       440│         )
     → 441│         return [parser.parse(requirement) for requirement in requirements]
       442│ 
       443│     def _format_requirements(self, requirements: list[dict[str, str]]) -> Requirements:

  10  ~/.local/lib/python3.8/site-packages/poetry/console/commands/init.py:441 in <listcomp>
       439│             cwd=cwd,
       440│         )
     → 441│         return [parser.parse(requirement) for requirement in requirements]
       442│ 
       443│     def _format_requirements(self, requirements: list[dict[str, str]]) -> Requirements:

   9  ~/.local/lib/python3.8/site-packages/poetry/utils/dependency_specification.py:89 in parse
        87│ 
        88│         specification = (
     →  89│             self._parse_url(requirement)
        90│             or self._parse_path(requirement)
        91│             or self._parse_simple(requirement)

   8  ~/.local/lib/python3.8/site-packages/poetry/utils/dependency_specification.py:149 in _parse_url
       147│ 
       148│         if url_parsed.scheme in GIT_URL_SCHEMES:
     → 149│             return self._parse_git_url(requirement)
       150│ 
       151│         if url_parsed.scheme in ["http", "https"]:

   7  ~/.local/lib/python3.8/site-packages/poetry/utils/dependency_specification.py:133 in _parse_git_url
       131│ 
       132│         source_root = self._env.path.joinpath("src") if self._env else None
     → 133│         package = self._direct_origin.get_package_from_vcs(
       134│             "git",
       135│             url=url.url,

   6  ~/.local/lib/python3.8/site-packages/poetry/packages/direct_origin.py:111 in get_package_from_vcs
       109│             raise ValueError(f"Unsupported VCS dependency {vcs}")
       110│ 
     → 111│         return _get_package_from_git(
       112│             url=url,
       113│             branch=branch,

   5  ~/.local/lib/python3.8/site-packages/poetry/packages/direct_origin.py:32 in _get_package_from_git
        30│     source_root: Path | None = None,
        31│ ) -> Package:
     →  32│     source = Git.clone(
        33│         url=url,
        34│         source_root=source_root,

   4  ~/.local/lib/python3.8/site-packages/poetry/vcs/git/backend.py:434 in clone
       432│         try:
       433│             if not cls.is_using_legacy_client():
     → 434│                 local = cls._clone(url=url, refspec=refspec, target=target)
       435│                 cls._clone_submodules(repo=local)
       436│                 return local

   3  ~/.local/lib/python3.8/site-packages/poetry/vcs/git/backend.py:257 in _clone
       255│             local = Repo(str(target))
       256│ 
     → 257│         remote_refs = cls._fetch_remote_refs(url=url, local=local)
       258│ 
       259│         logger.debug(

   2  ~/.local/lib/python3.8/site-packages/poetry/vcs/git/backend.py:202 in _fetch_remote_refs
       200│ 
       201│         with local:
     → 202│             result: FetchPackResult = client.fetch(
       203│                 path,
       204│                 local,

   1  ~/.local/lib/python3.8/site-packages/dulwich/client.py:816 in fetch
        814│             f, commit, abort = target.object_store.add_pack()
        815│         try:
     →  816│             result = self.fetch_pack(
        817│                 path,
        818│                 determine_wants,

  HangupException

  ssh: connect to host github.com port 22: Connection timed out

  at ~/.local/lib/python3.8/site-packages/dulwich/client.py:1132 in fetch_pack
      1128│         with proto:
      1129│             try:
      1130│                 refs, server_capabilities = read_pkt_refs(proto.read_pkt_seq())
      1131│             except HangupException as exc:
    → 1132│                 raise _remote_error_from_stderr(stderr) from exc
      1133│             (
      1134│                 negotiated_capabilities,
      1135│                 symrefs,
      1136│                 agent,

I also tried using poetry add -vvv git+https://github.com/facebookresearch/pytorch3d.git which gave me a different output, this time a timeout happens:

Loading configuration file /home/myfolder/.config/pypoetry/config.toml
Using virtualenv: /home/myfolder/poetry_env/poetry_env_demo/.venv
[urllib3.connectionpool] Starting new HTTPS connection (1): github.com:443
[urllib3.util.retry] Incremented Retry for (url='/facebookresearch/pytorch3d.git/info/refs?service=git-upload-pack'): Retry(total=2, connect=None, read=None, redirect=None, status=None)
[urllib3.connectionpool] Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f0284bf4df0>: Failed to establish a new connection: [Errno 110] Connection timed out')': /facebookresearch/pytorch3d.git/info/refs?service=git-upload-pack
[urllib3.connectionpool] Starting new HTTPS connection (2): github.com:443
[urllib3.util.retry] Incremented Retry for (url='/facebookresearch/pytorch3d.git/info/refs?service=git-upload-pack'): Retry(total=1, connect=None, read=None, redirect=None, status=None)
[urllib3.connectionpool] Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f0284bf4fa0>: Failed to establish a new connection: [Errno 110] Connection timed out')': /facebookresearch/pytorch3d.git/info/refs?service=git-upload-pack
[urllib3.connectionpool] Starting new HTTPS connection (3): github.com:443
[urllib3.util.retry] Incremented Retry for (url='/facebookresearch/pytorch3d.git/info/refs?service=git-upload-pack'): Retry(total=0, connect=None, read=None, redirect=None, status=None)
[urllib3.connectionpool] Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f0284c01100>: Failed to establish a new connection: [Errno 110] Connection timed out')': /facebookresearch/pytorch3d.git/info/refs?service=git-upload-pack
[urllib3.connectionpool] Starting new HTTPS connection (4): github.com:443

  Stack trace:

  2  ~/.local/lib/python3.8/site-packages/urllib3/connection.py:203 in _new_conn
      201│         """
      202│         try:
    → 203│             sock = connection.create_connection(
      204│                 (self._dns_host, self.port),
      205│                 self.timeout,

  1  ~/.local/lib/python3.8/site-packages/urllib3/util/connection.py:85 in create_connection
       83│     if err is not None:
       84│         try:
    →  85│             raise err
       86│         finally:
       87│             # Break explicitly a reference cycle

  TimeoutError

  [Errno 110] Connection timed out

  at ~/.local/lib/python3.8/site-packages/urllib3/util/connection.py:73 in create_connection
       69│             if timeout is not _DEFAULT_TIMEOUT:
       70│                 sock.settimeout(timeout)
       71│             if source_address:
       72│                 sock.bind(source_address)
    →  73│             sock.connect(sa)
       74│             # Break explicitly a reference cycle
       75│             err = None
       76│             return sock
       77│ 

My pyproject.toml is fully empty.

[tool.poetry]
name = "poetry-env-demo"
version = "0.1.0"
description = ""
authors = ["myname <myemail>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.8"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
@leweex95 leweex95 added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Oct 25, 2023
@dimbleby
Copy link
Contributor

pytorch3d have not published a package for the 0.7.4 release that is suitable for your platform - see https://pypi.org/project/pytorch3d/#files, and raise that with them.

if you want to add an earlier release than the latest then you need to say so: which duplicates #707

please close

@leweex95
Copy link
Author

@dimbleby are you sure this is the problem?

When I try to specify the version as well, I still get the same error during the poetry install.

poetry add -vvv pytorch3d==0.7.3

outputs:

Loading configuration file /home/myproject/.config/pypoetry/config.toml
Using virtualenv: /home/myproject/poetry_env/poetry_env_demo/.venv
Creating new session for pypi.org
Source (PyPI): 1 packages found for pytorch3d 0.7.3
Updating dependencies
Resolving dependencies...
   1: fact: poetry-env-demo is 0.1.0
   1: derived: poetry-env-demo
   1: fact: poetry-env-demo depends on pytorch3d (0.7.3)
   1: selecting poetry-env-demo (0.1.0)
   1: derived: pytorch3d (==0.7.3)
Source (PyPI): 1 packages found for pytorch3d 0.7.3
   1: fact: pytorch3d (0.7.3) depends on fvcore (*)
   1: fact: pytorch3d (0.7.3) depends on iopath (*)
   1: selecting pytorch3d (0.7.3)
   1: derived: iopath
   1: derived: fvcore
Source (PyPI): 10 packages found for iopath *
Source (PyPI): 123 packages found for fvcore *
   1: fact: fvcore (0.1.5.post20221221) depends on numpy (*)
   1: fact: fvcore (0.1.5.post20221221) depends on yacs (>=0.1.6)
   1: fact: fvcore (0.1.5.post20221221) depends on pyyaml (>=5.1)
   1: fact: fvcore (0.1.5.post20221221) depends on tqdm (*)
   1: fact: fvcore (0.1.5.post20221221) depends on termcolor (>=1.1)
   1: fact: fvcore (0.1.5.post20221221) depends on Pillow (*)
   1: fact: fvcore (0.1.5.post20221221) depends on tabulate (*)
   1: fact: fvcore (0.1.5.post20221221) depends on iopath (>=0.1.7)
   1: selecting fvcore (0.1.5.post20221221)
   1: derived: iopath (>=0.1.7)
   1: derived: tabulate
   1: derived: Pillow
   1: derived: termcolor (>=1.1)
   1: derived: tqdm
   1: derived: pyyaml (>=5.1)
   1: derived: yacs (>=0.1.6)
   1: derived: numpy
Source (PyPI): 26 packages found for tabulate *
Source (PyPI): 92 packages found for pillow *
Source (PyPI): 7 packages found for termcolor >=1.1
Source (PyPI): 132 packages found for tqdm *
Source (PyPI): 10 packages found for pyyaml >=5.1
Source (PyPI): 3 packages found for yacs >=0.1.6
Source (PyPI): 101 packages found for numpy *
   1: fact: tqdm (4.66.1) depends on colorama (*)
   1: selecting tqdm (4.66.1)
   1: derived: colorama
Source (PyPI): 43 packages found for colorama *
   1: fact: numpy (1.26.1) requires Python <3.13,>=3.9
   1: derived: not numpy (==1.26.1)
   1: fact: numpy (1.26.0) requires Python <3.13,>=3.9
   1: derived: not numpy (==1.26.0)
   1: fact: numpy (1.25.2) requires Python >=3.9
   1: derived: not numpy (==1.25.2)
   1: fact: numpy (1.25.1) requires Python >=3.9
   1: derived: not numpy (==1.25.1)
   1: fact: numpy (1.25.0) requires Python >=3.9
   1: derived: not numpy (==1.25.0)
   1: selecting numpy (1.24.4)
   1: selecting pillow (10.1.0)
   1: selecting tabulate (0.9.0)
   1: selecting pyyaml (6.0.1)
   1: selecting termcolor (2.3.0)
   1: fact: iopath (0.1.10) depends on tqdm (*)
   1: fact: iopath (0.1.10) depends on typing_extensions (*)
   1: fact: iopath (0.1.10) depends on portalocker (*)
   1: selecting iopath (0.1.10)
   1: derived: portalocker
   1: derived: typing_extensions
Source (PyPI): 39 packages found for portalocker *
Source (PyPI): 27 packages found for typing-extensions *
   1: fact: portalocker (2.8.2) depends on pywin32 (>=226)
   1: selecting portalocker (2.8.2)
   1: derived: pywin32 (>=226)
Source (PyPI): 10 packages found for pywin32 >=226
   1: selecting typing-extensions (4.8.0)
   1: fact: yacs (0.1.8) depends on PyYAML (*)
   1: selecting yacs (0.1.8)
   1: selecting colorama (0.4.6)
   1: selecting pywin32 (306)
   1: Version solving took 0.289 seconds.
   1: Tried 1 solutions.

Finding the necessary packages for the current system
Source (PyPI): 1 packages found for pytorch3d 0.7.3
Source (PyPI): 1 packages found for iopath *
Source (PyPI): 1 packages found for fvcore *
Source (PyPI): 1 packages found for portalocker *
Source (PyPI): 1 packages found for typing-extensions *
Source (PyPI): 1 packages found for tqdm *
Source (PyPI): 1 packages found for tabulate *
Source (PyPI): 1 packages found for pillow *
Source (PyPI): 1 packages found for termcolor >=1.1
Source (PyPI): 1 packages found for pyyaml >=5.1
Source (PyPI): 1 packages found for yacs >=0.1.6
Source (PyPI): 1 packages found for numpy *

Package operations: 1 install, 0 updates, 0 removals, 11 skipped

  • Installing fvcore (0.1.5.post20221221): Pending...
  • Installing fvcore (0.1.5.post20221221): Skipped for the following reason: Already installed
  • Installing numpy (1.24.4): Pending...
  • Installing numpy (1.24.4): Skipped for the following reason: Already installed
  • Installing iopath (0.1.10): Pending...
  • Installing iopath (0.1.10): Skipped for the following reason: Already installed
  • Installing portalocker (2.8.2): Pending...
  • Installing portalocker (2.8.2): Skipped for the following reason: Already installed
  • Installing pillow (10.1.0): Pending...
  • Installing pillow (10.1.0): Skipped for the following reason: Already installed
  • Installing tabulate (0.9.0): Pending...
  • Installing tabulate (0.9.0): Skipped for the following reason: Already installed
  • Installing tqdm (4.66.1): Pending...
  • Installing tqdm (4.66.1): Skipped for the following reason: Already installed
  • Installing pytorch3d (0.7.3): Pending...
  • Installing yacs (0.1.8): Pending...
  • Installing yacs (0.1.8): Skipped for the following reason: Already installed
  • Installing termcolor (2.3.0): Pending...
  • Installing pytorch3d (0.7.3): Failed

  Stack trace:

  5  ~/.local/lib/python3.8/site-packages/poetry/installation/executor.py:286 in _execute_operation
      284│ 
      285│             try:
    → 286│                 result = self._do_execute_operation(operation)
      287│             except EnvCommandError as e:
      288│                 if e.e.returncode == -2:

  4  ~/.local/lib/python3.8/site-packages/poetry/installation/executor.py:386 in _do_execute_operation
      384│             return 0
      385│ 
    → 386│         result: int = getattr(self, f"_execute_{method}")(operation)
      387│ 
      388│         if result != 0:

  3  ~/.local/lib/python3.8/site-packages/poetry/installation/executor.py:511 in _execute_install
      509│ 
      510│     def _execute_install(self, operation: Install | Update) -> int:
    → 511│         status_code = self._install(operation)
      512│ 
      513│         self._save_url_reference(operation)

  2  ~/.local/lib/python3.8/site-packages/poetry/installation/executor.py:549 in _install
      547│             archive = self._download_link(operation, Link(package.source_url))
      548│         else:
    → 549│             archive = self._download(operation)
      550│ 
      551│         operation_message = self.get_operation_message(operation)

  1  ~/.local/lib/python3.8/site-packages/poetry/installation/executor.py:739 in _download
      737│ 
      738│     def _download(self, operation: Install | Update) -> Path:
    → 739│         link = self._chooser.choose_for(operation.package)
      740│ 
      741│         if link.yanked:

  RuntimeError

  Unable to find installation candidates for pytorch3d (0.7.3)

  at ~/.local/lib/python3.8/site-packages/poetry/installation/chooser.py:73 in choose_for
       69│ 
       70│             links.append(link)
       71│ 
       72│         if not links:
    →  73│             raise RuntimeError(f"Unable to find installation candidates for {package}")
       74│ 
       75│         # Get the best link
       76│         chosen = max(links, key=lambda link: self._sort_key(package, link))
       77│ 

@leweex95
Copy link
Author

poetry add -vvv pytorch3d="<0.7.4" also returns the same error:

  RuntimeError

  Unable to find installation candidates for pytorch3d (0.7.3)

@leweex95
Copy link
Author

Furthermore, pip has no problem installing the 0.7.4 version on my same exact platform...

$pip install "git+https://github.com/facebookresearch/pytorch3d.git"

Defaulting to user installation because normal site-packages is not writeable
Collecting git+https://github.com/facebookresearch/pytorch3d.git
  Cloning https://github.com/facebookresearch/pytorch3d.git to /tmp/pip-req-build-5i36lv52
  Running command git clone --filter=blob:none --quiet https://github.com/facebookresearch/pytorch3d.git /tmp/pip-req-build-5i36lv52
  Resolved https://github.com/facebookresearch/pytorch3d.git to commit a8c70161a1c99c1878ae7cf312cf7907a84f01b0
  Preparing metadata (setup.py) ... done
Requirement already satisfied: fvcore in /home/myfolder/.local/lib/python3.8/site-packages (from pytorch3d==0.7.4) (0.1.5.post20221221)
Requirement already satisfied: iopath in /home/myfolder/.local/lib/python3.8/site-packages (from pytorch3d==0.7.4) (0.1.10)
Requirement already satisfied: Pillow in /home/myfolder/.local/lib/python3.8/site-packages (from fvcore->pytorch3d==0.7.4) (10.1.0)
Requirement already satisfied: numpy in /home/myfolder/.local/lib/python3.8/site-packages (from fvcore->pytorch3d==0.7.4) (1.24.4)
Requirement already satisfied: pyyaml>=5.1 in /usr/lib/python3/dist-packages (from fvcore->pytorch3d==0.7.4) (5.3.1)
Requirement already satisfied: tabulate in /home/myfolder/.local/lib/python3.8/site-packages (from fvcore->pytorch3d==0.7.4) (0.9.0)
Requirement already satisfied: termcolor>=1.1 in /home/myfolder/.local/lib/python3.8/site-packages (from fvcore->pytorch3d==0.7.4) (2.3.0)
Requirement already satisfied: tqdm in /home/myfolder/.local/lib/python3.8/site-packages (from fvcore->pytorch3d==0.7.4) (4.66.1)
Requirement already satisfied: yacs>=0.1.6 in /home/myfolder/.local/lib/python3.8/site-packages (from fvcore->pytorch3d==0.7.4) (0.1.8)
Requirement already satisfied: portalocker in /home/myfolder/.local/lib/python3.8/site-packages (from iopath->pytorch3d==0.7.4) (2.8.2)
Requirement already satisfied: typing-extensions in /home/myfolder/.local/lib/python3.8/site-packages (from iopath->pytorch3d==0.7.4) (4.8.0)
Building wheels for collected packages: pytorch3d
  Building wheel for pytorch3d (setup.py) ... done
  Created wheel for pytorch3d: filename=pytorch3d-0.7.4-cp38-cp38-linux_x86_64.whl size=63585872 sha256=a34bf60bb116f60916fc290180928de1b27423c0ef5256f1f5e3701cc289b38a
  Stored in directory: /tmp/pip-ephem-wheel-cache-7_65j5n_/wheels/5e/a7/7c/814c3888eaaecaaf0f533faeb3c6812d82274484be51f7441c
Successfully built pytorch3d
DEPRECATION: distro-info 0.23ubuntu1 has a non-standard version number. pip 23.3 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of distro-info or contact the author to suggest that they release a version with a conforming version number. Discussion can be found at https://github.com/pypa/pip/issues/12063
Installing collected packages: pytorch3d
Successfully installed pytorch3d-0.7.4

Checking if correct version is installed:

$ pip show pytorch3d
Name: pytorch3d
Version: 0.7.4
Summary: PyTorch3D is FAIR's library of reusable components for deep Learning with 3D data.
Home-page: https://github.com/facebookresearch/pytorch3d
Author: FAIR
Author-email: 
License: UNKNOWN
Location: /home/myfolder/.local/lib/python3.8/site-packages
Requires: fvcore, iopath
Required-by: 

@dimbleby
Copy link
Contributor

yes I am sure this is the problem. There are also no suitable distributions for you platform at pytorch3d version 0.7.3.

@leweex95
Copy link
Author

@dimbleby

You are saying there are no suitable distributions for any of those versions. But pip has no problem whatsoever installing any of these versions, as shown above. Why isn't poetry able to install any of these versions, let alone identify the correct version that is installable?

What are the possible workarounds to use the poetry3d package, or others that run into similar issues?

@dimbleby
Copy link
Contributor

you are mixing up two things in this issue: sometimes you are trying to install from git and sometimes from pypi.

pip will also refuse to install recent versions of pytorch3d from pypi.

the error you reported when installing from git using poetry looks like a transient network issue, not something that can be fixed from this repository.

@leweex95
Copy link
Author

@dimbleby

"sometimes you are trying to install from git and sometimes from pypi"

That's correct. Because I want to install this package for my project, using poetry, and I checked carefully the documentation for all alternative means of installation, and none of them succeeded.

When attempting a pip install, while specifying explicitly the 0.7.4 version, it indeed fails (pip install pytorch3d==0.7.4). But as I showed above, installing the package directly from the repo works perfectly fine:

pip install "git+https://github.com/facebookresearch/pytorch3d.git"

Now, how is it possible that the above installation works and I can use the 0.7.4 version right away, while poetry is incapable to install the same package in any possible way? If it is just a network issue, why would it only affect poetry, but not pip? And furthermore, why can I, despite this, install any other package via poetry, without issues?

poetry add -vvv git+ssh://[email protected]/facebookresearch/pytorch3d.git (and same with the #0.7.4 tag) fail
poetry add -vvv git+https://github.com/facebookresearch/pytorch3d.git (and same with the #0.7.4 tag) fail
poetry add -vvv pytorch3d and poetry add -vvv pytorch3d==0.7.4 fail

@dimbleby
Copy link
Contributor

I cannot help you with your network issues. poetry is able to clone the repository successfully for me. You will have to figure that out for yourself.

Having said that, installing from git doesn't work because facebookresearch/pytorch3d#1419. That too is not a poetry bug: it is correctly reported against pytorch3d.

There is no poetry bug here. You will need to

  • ask pytorch3d to publish wheels for the platform that you are on, so that you can install a recent version from pypi
  • or resolve your network issue and ask pytorch3d to fix that bug, so that you can install from git
  • or go back to using whatever version of pytorch3d it is that pip finds when installing from pypi - though that will leave you stuck with that old release

please close

@leweex95
Copy link
Author

"poetry is able to clone the repository successfully for me"

What command did you use exactly that cloned the repository successfully?

As I said, I doubt it is a network issue, as I am able to install anything else with poetry or pip.

@dimbleby
Copy link
Contributor

dimbleby commented Oct 25, 2023

I copy pasted what you wrote above. But again: even if you get the cloning to work the git install will fail because of the pytorch3d bug.

@leweex95
Copy link
Author

Here is an update. No more network issue. Is this what you were receiving?

Command:
poetry add git+https://github.com/facebookresearch/pytorch3d.git

Output:

Unable to determine package info for path: /home/myfolder/poetry_env/poetry_env_demo/.venv/src/pytorch3d

Command ['/tmp/tmpiqa7yemy/.venv/bin/python', '-'] errored with the following return code 1

Output:
Traceback (most recent call last):
  File "/tmp/tmpiqa7yemy/.venv/lib/python3.8/site-packages/build/__init__.py", line 466, in _handle_backend
    yield
  File "/tmp/tmpiqa7yemy/.venv/lib/python3.8/site-packages/build/__init__.py", line 356, in get_requires_for_build
    return set(get_requires(config_settings))
  File "/tmp/tmpiqa7yemy/.venv/lib/python3.8/site-packages/pyproject_hooks/_impl.py", line 166, in get_requires_for_build_wheel
    return self._call_hook('get_requires_for_build_wheel', {
  File "/tmp/tmpiqa7yemy/.venv/lib/python3.8/site-packages/pyproject_hooks/_impl.py", line 311, in _call_hook
    self._subprocess_runner(
  File "/tmp/tmpiqa7yemy/.venv/lib/python3.8/site-packages/build/__init__.py", line 302, in _runner
    self._hook_runner(cmd, cwd, extra_environ)
  File "/tmp/tmpiqa7yemy/.venv/lib/python3.8/site-packages/pyproject_hooks/_impl.py", line 71, in quiet_subprocess_runner
    check_output(cmd, cwd=cwd, env=env, stderr=STDOUT)
  File "/usr/lib/python3.8/subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/tmp/build-env-gp8nic4b/bin/python', '/tmp/tmpiqa7yemy/.venv/lib/python3.8/site-packages/pyproject_hooks/_in_process/_in_process.py', 'get_requires_for_build_wheel', '/tmp/tmpqm4822d_']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 16, in <module>
  File "/tmp/tmpiqa7yemy/.venv/lib/python3.8/site-packages/build/__init__.py", line 356, in get_requires_for_build
    return set(get_requires(config_settings))
  File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "/tmp/tmpiqa7yemy/.venv/lib/python3.8/site-packages/build/__init__.py", line 474, in _handle_backend
    raise BuildBackendException(  # noqa: B904 # use raise from
build.BuildBackendException: Backend subprocess exited when trying to invoke get_requires_for_build_wheel


Input:
import build
import build.env
import pyproject_hooks

source = '/home/myfolder/poetry_env/poetry_env_demo/.venv/src/pytorch3d'
dest = '/tmp/tmpiqa7yemy/dist'

with build.env.IsolatedEnvBuilder() as env:
    builder = build.ProjectBuilder(
        srcdir=source,
        scripts_dir=env.scripts_dir,
        python_executable=env.executable,
        runner=pyproject_hooks.quiet_subprocess_runner,
    )
    env.install(builder.build_system_requires)
    env.install(builder.get_requires_for_build('wheel'))
    builder.metadata_path(dest)

Fallback egg_info generation failed.

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

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

@dimbleby
Copy link
Contributor

I have repeatedly pointed you at the pytorch3d bug report for this, please click on the link

@leweex95
Copy link
Author

Pytorch3D developers say it is a Poetry issue:

"I think poetry might be deliberately not (yet) designed to deal with packages like PyTorch3D which have tight build time dependencies on versions of other packages. So it might be "by design" that this doesn't work easily. If that's not the case, we'd like help, e.g. pointers to documentation. If it is possible to adapt PyTorch3D nicely into poetry, it hasn't been done."

facebookresearch/pytorch3d#1673

@dimbleby
Copy link
Contributor

I don't know why you have duplicated the existing pytorch issue.

This is not a poetry issue. Please close.

@leweex95
Copy link
Author

Because poetry is still unable to install the pytorch3d package, due to poetry not supporting build-time dependencies to be specified. Pytorch3d is depending on torch at build-time. Pip has no issue to install the package, but poetry fails. I raised the question on pytorch3d's side as you asked for, and they told me that it is a missing feature in Poetry.

@dimbleby
Copy link
Contributor

dimbleby commented Oct 26, 2023

pytorch3d has undeclared build-time dependencies, and the solution should be that it declares them - which is what facebookresearch/pytorch3d#1419 says all along

you should close both the issues that you have raised

  • this one because there is no poetry bug
  • the other because it is a duplicate

and continue any further discussion in facebookresearch/pytorch3d#1419

@sinAshish
Copy link

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
@abn abn removed the status/triage This issue needs to be triaged label Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

4 participants