question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't install detectron2

See original GitHub issue
  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: Arch Linux
  • Poetry version: 1.0.5
  • Contents of your pyproject.toml file:
[tool.poetry]
name = "a"
version = "0.1.0"
description = ""
authors = ["a"]

[tool.poetry.dependencies]
python = "^3.6"
detectron2 = { git = "https://github.com/facebookresearch/detectron2.git" }

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

Issue

Poetry can’t figure out the version of detectron2. I’ve tried to debug this myself but the error messages don’t tell me anything useful:

$ /tmp/poetry/bin/poetry install -vvv

Creating virtualenv a-1_qs6r2x-py3.8 in /home/x/.cache/pypoetry/virtualenvs
Using virtualenv: /home/x/.cache/pypoetry/virtualenvs/a-1_qs6r2x-py3.8
Updating dependencies
Resolving dependencies...
   1: fact: a is 0.1.0
   1: derived: a
   1: fact: a depends on detectron2 (*)
   1: selecting a (0.1.0)
   1: derived: detectron2 (*)
   1: Version solving took 3.842 seconds.
   1: Tried 1 solutions.

[RuntimeError]
Unable to retrieve the package version for /tmp/pypoetry-git-detectron2683igqav

Traceback (most recent call last):
  File "/tmp/poetry/lib/poetry/_vendor/py3.8/clikit/console_application.py", line 131, in run
    status_code = command.handle(parsed_args, io)
  File "/tmp/poetry/lib/poetry/_vendor/py3.8/clikit/api/command/command.py", line 120, in handle
    status_code = self._do_handle(args, io)
  File "/tmp/poetry/lib/poetry/_vendor/py3.8/clikit/api/command/command.py", line 171, in _do_handle
    return getattr(handler, handler_method)(args, io, self)
  File "/tmp/poetry/lib/poetry/_vendor/py3.8/cleo/commands/command.py", line 92, in wrap_handle
    return self.handle()
  File "/tmp/poetry/lib/poetry/console/commands/install.py", line 63, in handle
    return_code = installer.run()
  File "/tmp/poetry/lib/poetry/installation/installer.py", line 74, in run
    self._do_install(local_repo)
  File "/tmp/poetry/lib/poetry/installation/installer.py", line 161, in _do_install
    ops = solver.solve(use_latest=self._whitelist)
  File "/tmp/poetry/lib/poetry/puzzle/solver.py", line 36, in solve
    packages, depths = self._solve(use_latest=use_latest)
  File "/tmp/poetry/lib/poetry/puzzle/solver.py", line 180, in _solve
    result = resolve_version(
  File "/tmp/poetry/lib/poetry/mixology/__init__.py", line 7, in resolve_version
    return solver.solve()
  File "/tmp/poetry/lib/poetry/mixology/version_solver.py", line 80, in solve
    next = self._choose_package_version()
  File "/tmp/poetry/lib/poetry/mixology/version_solver.py", line 355, in _choose_package_version
    packages = self._provider.search_for(dependency)
  File "/tmp/poetry/lib/poetry/puzzle/provider.py", line 130, in search_for
    packages = self.search_for_vcs(dependency)
  File "/tmp/poetry/lib/poetry/puzzle/provider.py", line 167, in search_for_vcs
    package = self.get_package_from_vcs(
  File "/tmp/poetry/lib/poetry/puzzle/provider.py", line 204, in get_package_from_vcs
    package = cls.get_package_from_directory(tmp_dir, name=name)
  File "/tmp/poetry/lib/poetry/puzzle/provider.py", line 343, in get_package_from_directory
    raise RuntimeError(

Is poetry unable to get dynamically generated versions?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:10
  • Comments:25 (7 by maintainers)

github_iconTop GitHub Comments

8reactions
abncommented, Oct 17, 2020

@malcolmgreaves for completeness this is what you need to keep legacy build.

[build-system]
requires = ["setuptools", "wheel", "torch"]
build-backend = "setuptools.build_meta:__legacy__"
2reactions
iamlucaswolfcommented, Jun 3, 2021

@malcolmgreaves I just tried your workaround to integrate detectron2 with an existing project but still get errors… 😕

My pyproject.toml looks like this:

[tool.poetry.dependencies]
...
detectron2 = { git = "https://github.com/facebookresearch/detectron2.git"}

[build-system]
requires = ["setuptols", "wheel", "torch"]
build-backend = "setuptools.build_meta:__legacy__"

However, when I run poetry install, I get:

PackageInfoError

  Unable to determine package info for path: /tmp/pypoetry-git-detectron20h25u89n
  
  Fallback egg_info generation failed.
  
  Command ['/tmp/tmpi8lubyub/.venv/bin/python', 'setup.py', 'egg_info'] errored with the following return code 1, and output: 
  Traceback (most recent call last):
    File "/tmp/pypoetry-git-detectron20h25u89n/setup.py", line 10, in <module>
      import torch
  ModuleNotFoundError: No module named 'torch'

  at ~/.poetry/lib/poetry/inspection/info.py:502 in _pep517_metadata
      498│                 try:
      499│                     venv.run("python", "setup.py", "egg_info")
      500│                     return cls.from_metadata(path)
      501│                 except EnvCommandError as fbe:
    → 502│                     raise PackageInfoError(
      503│                         path, "Fallback egg_info generation failed.", fbe
      504│                     )
      505│                 finally:
      506│                     os.chdir(cwd.as_posix())

Any idea why that might be the case?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error when installing detectron2 from source #1445 - GitHub
I recently updated my Cuda toolkit version to 10.2 as well as Pytorch to 1.5 and I was trying to rebuild detectron2 from...
Read more >
Installation — detectron2 0.6 documentation
To rebuild detectron2 that's built from a local clone, use rm -rf build/ **/*.so to clean the old build first. You often need...
Read more >
How to Install Detectron2 on Windows 10 or 11 - Medium
Step 1: Install Anaconda for windows · Step 2: Download Cuda 10.2 and install it · Step 3: Create a conda environment ·...
Read more >
Can't build Detectron2 on Windows 10 - Stack Overflow
conda install -c anaconda ninja. Go to the directory where I want to install detectron2. e: cd e:/TRON. Git clone detectron2 repository.
Read more >
Detectron2 Installation on windows issue - PyTorch Forums
Hello, I am trying to install Detector2 on my Windows 11 machine. I am facing below error can you guide me to solve...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found