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.

Editable installs fail when poetry.core is declared as build-system

See original GitHub issue

I have created a minimal package to demonstrate this problem (which I have in a real library).

test_editable/
- test_editable/
-- __init__.py
- pyproject.toml #generated with poetry init
- setup.py # shim

The setup.py file is:

import setuptools

if __name__ == "__main__":
    setuptools.setup(name="test_editable")   # without the name the package is installed as UNKNOWN

The pyproject.toml file is:

[tool.poetry]
name = "test_editable"
version = "0.1.0"
description = "test poetry editable problem"
authors = ["albertogomcas"]
license = "mit"

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

[tool.poetry.dev-dependencies]

[build-system]
#requires = ["poetry>=0.12"]
#build-backend = "poetry.masonry.api"
requires = ["poetry-core>=1.0.0a3"]
build-backend = "poetry.core.masonry.api"

As is above, pip install -e . fails with:

Looking in indexes: https://pypi.org/simple
Obtaining file:///C:/test_editable
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Installing collected packages: test-editable
  Attempting uninstall: test-editable
    Found existing installation: test-editable 0.1.0
    Uninstalling test-editable-0.1.0:
      Successfully uninstalled test-editable-0.1.0
  Running setup.py develop for test-editable
    ERROR: Command errored out with exit status 1:
     command: 'c:\winpython64-master@66fb39fabeb\wpy64-3680\python-3.6.8.amd64\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\test_editable\\setup.py'"'"'; __file__='"'"'C:\\test_editable\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps
         cwd: C:\test_editable\
    Complete output (3 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ModuleNotFoundError: No module named 'setuptools'
    ----------------------------------------
  Rolling back uninstall of test-editable

However, if I comment the build system lines with core and use instead the upper two:

Looking in indexes: https://pypi.org/simple
Obtaining file:///C:/test_editable
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Installing collected packages: test-editable
  Attempting uninstall: test-editable
    Found existing installation: test-editable 0.1.0
    Uninstalling test-editable-0.1.0:
      Successfully uninstalled test-editable-0.1.0
  Running setup.py develop for test-editable
Successfully installed test-editable

I believe the option that works is actually deprecated (?)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
finswimmercommented, Dec 29, 2021

Editable installs for PEP-517 compliant backend wasn’t possible for a long time, because it wasn’t defined how to do this. This has changed with PEP 660. The hook is already implemented in poetry-core’s master branch.

3reactions
brechtmcommented, Oct 7, 2021

I couldn’t get this working. There are two issues with the suggestions described above:

  1. The minimal setup.py does not register entry points (‘plugins’ in pyproject.toml)
  2. python /path/to/another_project/setup.py develop does not result in a working editable installation of another_project (the CWD path is written to the .pth files in the virtualenv)

I miss being able to editable-install my Poetry-managed project into an arbitrary virtualenv for debugging purposes. I now need to fall back to installing in non-editable mode over and over.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Package installed failed with poetry backend - Stack Overflow
By the time someone installs your package with pip install , the fact that it was build with poetry is irrelevant, it will...
Read more >
FAQ | master | Documentation | Poetry - Python dependency ...
Poetry installs all the dependencies and the current package an editable mode. Thus, tests are running against the local files and not the...
Read more >
30371 (Use pipenv to create venv for development) - Sage Trac
We modify src/setup.py to support editable installs via pipenv ( pipenv install -e ... And we will be able to work on the...
Read more >
3. How to package a Python
Editable installs are commonly used by developers because it means that any edits made to the package's source code are immediately available the...
Read more >
Poetry Advance - Python Biella Group
Poetry is the most sofisticated Python dependency system available (up to 2020) ... if the standard command fails to install the requirements.txt file....
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