Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Poetry remove fails to remove any packages?

Poetry install:

(installs dependencies)
poetry show --tree

black 20.8b1 The uncompromising code formatter.
├── appdirs *
├── click >=7.1.2
├── mypy-extensions >=0.4.3
├── pathspec >=0.6,<1
├── regex >=2020.1.8
├── toml >=0.10.1
├── typed-ast >=1.4.0
└── typing-extensions >=3.7.4

Next, poetry remove...

poetry remove black


  ValueError

  Package black not found

  at ~/proj/venv/lib/python3.9/site-packages/poetry/console/commands/remove.py:52 in handle
      48│                     requirements[key] = poetry_content[section][key]
      49│                     break
      50│
      51│             if not found:
    → 52│                 raise ValueError("Package {} not found".format(name))
      53│
      54│         for key in requirements:
      55│             del poetry_content[section][key]
      56│

The lack of search threads on this topic indicates, to me, that something that should "just work" is failing.

Any ideas?

like image 698
Chris Avatar asked Sep 11 '25 20:09

Chris


1 Answers

If black is specified as a development dependency in pyproject.toml (quite likely as it is a code formatter) the --dev (or -D for short) option should be used with poetry remove i.e:

poetry remove --dev black
like image 110
elukem Avatar answered Sep 13 '25 08:09

elukem