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

[BUG] numpy required in setup.py #653

Open
davide84 opened this issue Oct 20, 2020 · 7 comments
Open

[BUG] numpy required in setup.py #653

davide84 opened this issue Oct 20, 2020 · 7 comments
Labels

Comments

@davide84
Copy link

Describe the bug
Module numpy is imported in setup.py. This causes "pip install pyradiomics" to fail if numpy is not yet installed. The issue implies that pyradiomics can not be listed as a project dependency in requirements.txt together with numpy, but numpy must be previously installed. This is e.g. the case of fresh installations.

PyRadiomics configuration
Default - no customization.

PyRadiomics log file
None

To Reproduce
"pip install pyradiomics" from a fresh environment with no numpy installed.

Expected behavior
Numpy should be pulled as dependency when installing pyradiomics and not halting the installation.

Version (please complete the following information):
Python 3.8 under Ubuntu 20.04, pyradiomics 3.0.1

Additional context
None

@davide84 davide84 added the bug label Oct 20, 2020
@davide84
Copy link
Author

davide84 commented Oct 21, 2020

It seems to be a common problem of packages depending on numpy.

There probably is a proper fix to this type of dependency issues, apparently addressed with PEP 518; an example is here: SciTools/cartopy#1112 (comment)
Could the same apply to pyradiomics?

@JoostJM
Copy link
Collaborator

JoostJM commented Nov 17, 2020

This is indeed the case, though it only applies to the case where PyRadiomics needs to be built from source (for pre-distributed wheels, setup.py is not executed on install, but rather when the wheel is built).

PyRadiomics needs numpy to be installed, as the C-headers are needed to compile the C-extensions.

The suggestion in your second comment may help, but as mentioned in that thread, can cause some unexpected behaviour (like pip re-installing numpy if it's already installed). This has the potential to break stuff in special environments (like 3D slicer), so I don't wan't to add it to PyRadiomics just yet.

We did, however, add a 'setup-requires.txt' file which is also passed in the setup function. The problem is that setup.py tries to import numpy, and therefore does not have the chance to indicate numpy should be installed first.

I'll run some tests to see if I can fix this problem in some other way.

@psteinb
Copy link

psteinb commented Jul 30, 2021

This is falling on my feet in a project that I am working on, i.e. my CI pipelines crashes when including pyradiomics.
In other words: I'd like to install pyradiomics through pip+requirements.txt with python 3.9, but the numpy problem holds me back.

I see on pypi that wheels for python 3.7 are available. But your setup.py suggests compatibility for up to 3.6 only. This confuses me a bit.

What is your timeline including more python versions?

@masalim2
Copy link

masalim2 commented Apr 8, 2022

PEP 518 addresses how dependencies are installed for building the sdist and wheel packages that are ultimately pushed to PyPI. As far as I can tell, it doesn't quite help with the setup_requires dilemma during pip install. I've opened PR #761 which should work around the issue by deferring the import until the second pass of setup.py (after the setup requirements have actually been installed).

@alkamid
Copy link

alkamid commented Sep 13, 2022

It is now impossible to install pyradiomics properly using poetry. See python-poetry/poetry#6484 (comment)

@peterneher
Copy link

Can't install pyradiomics in a virtual environment (python 3.11) even with previousy installed numpy. Still complains that it there is no numpy

@mk4dir
Copy link

mk4dir commented May 18, 2024

Still having the same issue with python 3.12.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants