python-glmnet
python-glmnet copied to clipboard
Package does not build with `--use-pep517` (with Poetry)
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 https://github.com/python-poetry/poetry/issues/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: https://github.com/civisanalytics/python-glmnet/blob/813c06f5fcc9604d8e445bd4992f53c4855cc7cb/setup.py#L12-L18
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: https://github.com/python-poetry/poetry/issues/3433#issuecomment-840509576
Versions for completness:
poetry run python --version
> Python 3.10.7
poetry --version
> Poetry (version 1.2.0)