Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Package does not build with --use-pep517 (with Poetry) #79

Open
boennecd opened this issue Oct 10, 2022 · 0 comments
Open

Package does not build with --use-pep517 (with Poetry) #79

boennecd opened this issue Oct 10, 2022 · 0 comments

Comments

@boennecd
Copy link

boennecd commented Oct 10, 2022

The package does not build with pip using --use-pep517 with poetry. This is mainly an issue as the flag cannot be disabled with poetry (see python-poetry/poetry#3433).

A reproducible example is given below:

mkdir tmp
cd tmp
poetry init 
# click through steps...
poetry add glmnet
> Using version ^2.2.1 for glmnet
> 
> Updating dependencies
> Resolving dependencies... (0.1s)
> 
> Writing lock file
> 
> Package operations: 6 installs, 0 updates, 0 removals
> 
>   • Installing numpy (1.23.3)
>   • Installing joblib (1.2.0)
>   • Installing scipy (1.9.2)
>   • Installing threadpoolctl (3.1.0)
>   • Installing scikit-learn (1.1.2)
>   • Installing glmnet (2.2.1): Failed
> 
>   CalledProcessError
> 
>  ...
> 
>    Installing build dependencies: started
>    Installing build dependencies: finished with status 'done'
>    Getting requirements to build wheel: started
>    Getting requirements to build wheel: finished with status 'error'
>    error: subprocess-exited-with-error
>    
>    × Getting requirements to build wheel did not run successfully.
>exit code: 1
>    ╰─> [2 lines of output]
>        install requires: 'numpy'. use pip or easy_install.
>          $ pip install numpy
>        [end of output]

The error comes from the beginning of the setup.py file:

python-glmnet/setup.py

Lines 12 to 18 in 813c06f

import setuptools # noqa: F401
try:
from numpy.distutils.core import Extension, setup
except ImportError:
sys.exit("install requires: 'numpy'."
" use pip or easy_install."
" \n $ pip install numpy")

which seems to use this SO answer to compile the FORTRAN code from the original R package: https://stackoverflow.com/a/55358607/5861244

A solution in the short term is to call

poetry run python -m pip install glmnet --no-use-pep517
poetry add glmnet 

as mentioned here: python-poetry/poetry#3433 (comment)

Versions for completness:

poetry run python --version
> Python 3.10.7
poetry --version
> Poetry (version 1.2.0)
@boennecd boennecd changed the title Package does not build with --use-pep517 Package does not build with --use-pep517 (with Poetry) Oct 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant