Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.
This repository was 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

Description

@boennecd

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions