-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix installation breakage with pip 19+ #1044
Conversation
Side effect: replaces setup's import location from distutils.core to setuptools in the auto-generated setup.py. "pip install -e" is the final stage of "poetry install". According to PEP-517, the existence or absence of a pyproject.toml, along with a "build-system" key, changes the behavior of a build tool. To get "pip install -e" to work with pip 19, in accordance to PEP 517, we'd need to temporarily remove pyproject.toml. This commit proposes an alternative approach. Since "pip install -e" implicitly uses setuptools's "develop" mode under the hood, we simply invoke setuptools directly, bypassing pip's correct handling of PEP 517, and adding setuptools to the autogenerated setup.py (necessary to get it to work). Note: like "pip install -e", "python setup.py develop --no-deps" feels like a hack. In the future, we may consider working toward not relying on setuptools / distutils for local installation.
@sdispater This also should address #1049 |
Editable mode will remain a hack until pep517 is extended with a clean definition of what editable installs are, and how it should be implemented. Related: |
Looks like another workaround has been released now in 0.12.13 2ed53be |
I don't thin this fix is correct because it does not involve the setuptools shim that pip uses. At the very least it should try to emulate what |
I just released version Basically, what it does is:
|
This will not work if the setup.py file tries to read from the pyproject.toml file. |
@mitsuhiko The fix only addresses the Poetry-generated |
Ok, I'm going to close this PR since it looks like we're happy with the implemented workaround. Thanks @sdispater ! |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This PR fixes bugs installing a poetry package locally with pip >= version 19 installed.
"pip install -e . --no-deps" is replaced with "python setup.py develop --no-deps" to work around pip 19's strict adherence to pip 517. Basically, we can't install in editable mode with pip if a pyproject.toml is present. See: pypa/pip#6331
This commit proposes an alternative approach. Since "pip install -e" implicitly uses setuptools's "develop" mode under the hood, we simply invoke setuptools directly, bypassing pip's correct handling of PEP 517, and adding setuptools to the autogenerated setup.py (necessary to get it to work).
For proof of setuptools's "develop" mode being used under pip's hood: https://github.com/pypa/pip/blob/master/src/pip/_internal/req/req_install.py#L739
Note: like "pip install -e", "python setup.py develop --no-deps" feels like a hack. In the future, we may consider working toward not relying on setuptools / distutils for local installation.
Resolves / deprecates (probably more, there is a lot of complaining about pip version 19):