17

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?

Chris
  • 28,822
  • 27
  • 83
  • 158

1 Answers1

33

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
elukem
  • 1,068
  • 10
  • 11
  • 1
    This worked for me. Although I did get the message ```The --dev option is deprecated, use the `--group dev` notation instead.``` – Bell Dec 08 '22 at 01:57