Skip to content
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

poetry install with build script fails on 1.2.0 #4979

Closed
matteosantama opened this issue Jan 4, 2022 · 11 comments · Fixed by #5590
Closed

poetry install with build script fails on 1.2.0 #4979

matteosantama opened this issue Jan 4, 2022 · 11 comments · Fixed by #5590
Labels
kind/bug Something isn't working as expected

Comments

@matteosantama
Copy link

matteosantama commented Jan 4, 2022

❯ poetry --version
Poetry (version 1.2.0a2)

I am trying to run poetry install. This configuration works on 1.1.12

# pyproject.toml
[tool.poetry]
name = "test"
version = "0.1.0"
description = ""
authors = ["Matteo Santamaria <XXX@gmail.com>"]
readme = "README.md"
build = "build.py"

[tool.poetry.dependencies]
python = "3.8"

[tool.poetry.dev-dependencies]
numpy = "^1.22.0"

[build-system]
requires = ["poetry-core", "numpy>=1.22.0,<=1.23.0"] 
build-backend = "poetry.core.masonry.api"
# build.py
import numpy as np

def build(setup_kwargs):
    return setup_kwargs

but fails on 1.2.0a2.

Tested on macOS Monterey Version 12.0.1 Apple M1 Pro

@matteosantama matteosantama added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jan 4, 2022
@matteosantama
Copy link
Author

It's worth mentioning that I am running these commands in a virtual environment not managed by poetry

@finswimmer
Copy link
Member

Hello @matteosantama,

this is a duplicate of #2789.

fin swimmer

@matteosantama
Copy link
Author

@finswimmer I've updated my original post the better reflect the problem. What I've identified is related to your linked issue, but different in that it demonstrates a 1.1.x -> 1.2.x regression. Any project that uses a build script this way will be adversely impacted by upgrading to 1.2.x

I think this issue should be re-opened and placed in the 1.2 milestone.

@hdk5
Copy link

hdk5 commented Jan 28, 2022

I second this issue.

It should be noted that this issue does not happen with build command, and is caused by --use-pep517 flag usage for pip install

hdk5 added a commit to hdk5/poetry that referenced this issue Feb 8, 2022
@abn abn removed the status/triage This issue needs to be triaged label Mar 3, 2022
@abn
Copy link
Member

abn commented May 10, 2022

@matteosantama can you provide a bit more detail on the error?

EDIT: Nevermind was able to reproduce it with your provided configuration.

The root cause here is the change in build configuration. You should configure your build script as follows.

[tool.poetry.build]
script = "build.py"
generate-setup-file = false

Additionally, if you want to generate a setup.py file for the build you are also missing setuptools in your build-system.requirees.

@abn
Copy link
Member

abn commented May 11, 2022

Reopening this as the issue exists when a setup.py file was generated forcefully. Do note that build scripts are still an experimental feature and breakages can occur.

#5590 should fix the reported issue. Additionally, #5401 should improve the experience when generate-setup-file = false.

@nischalat
Copy link

nischalat commented Sep 8, 2022

I'm still having this issue with my docker build. I get the following error "Version 1.2.0 is not supported by this installer!". However I'm using the poetry 1.20 in my local env and it works just fine. Anyone knows how I can fix this. I'm using the following
RUN /bin/bash -ci "curl -sSLk https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python"

@neersighted
Copy link
Member

neersighted commented Sep 8, 2022

This issue tracks setup.py + build script support. The issue you are having is use of an unsupported, deprecated installer (#6377 for more details) -- you need to migrate to install.python-poetry.org as described in the documentation or release announcement.

@nischalat
Copy link

Thanks for the quick response @neersighted I was able to install poetry. However, I'm running into issues with the path and unable to find poetry in my Docker file. Below is what I'm running. Apologies if I'm posting this on the wrong thread

RUN /bin/bash -ci "curl -sSL https://install.python-poetry.org | python -"
RUN echo "source $HOME/.local/bin" >> /root/.bashrc
RUN /bin/bash -ci "poetry config virtualenvs.create false"
RUN /bin/bash -ci "poetry --version"

@neersighted
Copy link
Member

neersighted commented Sep 9, 2022

You should set environmental variables in a Dockerfile using the ENV directive.

RUN curl -sSL https://install.python-poetry.org/ | python3 - --version 1.2.0
ENV PATH="$HOME/.local/bin:$PATH"
RUN poetry --version

Please do not turn off virtualenv creation -- you are likely to run into way more problems for no benefit. The ability to turn off virtualenv creation was intended as a "I know what I am doing" feature for very advanced users -- if you don't know why you need it off, you do not need it off -- see #6398 for a roundup issue on this topic.

Finally, please don't use this solved issue for support -- you are sending notifications to everyone who has participated in it for something that is off-topic. Please start a Discussion on the discussion tab, or join the Discord server if you need support from the community.

Copy link

github-actions bot commented Mar 1, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants