pypipython-poetry95% confidence\u2191 85

Poetry install on an existing project Error "does not contain any element"

Full error message
I am using Poetry for the first time.
I have a very simple project. Basically

a_project
|
|--test
|    |---test_something.py
|
|-script_to_test.py

From a project I do poetry init and then poetry install

I get the following

 poetry install
Updating dependencies
Resolving dependencies... (0.5s)

Writing lock file

Package operations: 7 installs, 0 updates, 0 removals

  • Installing attrs (22.2.0)
  • Installing exceptiongroup (1.1.0)
  • Installing iniconfig (2.0.0)
  • Installing packaging (23.0)
  • Installing pluggy (1.0.0)
  • Installing tomli (2.0.1)
  • Installing pytest (7.2.1)

/home/me/MyStudy/2023/pyenv_practice/dos/a_project/a_project does not contain any element

after this I can run poetry run pytest without problem but what does that error message mean?

If you're on poetry>=1.8, also make sure to have [tool.poetry] package-mode = false in your configuration as stated here in the documentation here. Or when you're setting up a new project, simply run poetry install --no-root as mentioned by @bfontaine . Old solution: Check if your pyproject.toml contains something like: [tool.poetry] packages = [{include = "a_project"}] Removing the line with packages = [{include = "a_project"}] helped in my case and should avoid including the root project. See documentation here.

API access

Get this solution programmatically \u2014 free, no authentication.

curl https://depscope.dev/api/error/e1df077d7d2d94f57e49cef56bb48c8fb6d486974a26aab242610441acf951fb
hash \u00b7 e1df077d7d2d94f57e49cef56bb48c8fb6d486974a26aab242610441acf951fb
Poetry install on an existing project Error "does not c… — DepScope fix | DepScope