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
Use of numpy.distutils in setup.py causes errors if installing in clean virtualenv #143
Comments
This is not a bug, but actually the expected behaviour. |
Thanks for highlighting this @dalonsoa. I wonder if it should still be possible to do an install from scratch in a clean environment using |
I wish it could be avoided, to be honest, but I think that the possible solutions are more convoluted than simply asking for |
It seems this is a common issue that has been addressed (to some extent at least) in various repos, including scipy. See the discussion in the following for further info (not linking issues directly to avoid spamming these issues with reverse references): Issue 4164 in scikit-learn: can't setup.py install without numpy It looks like this could be addressed fairly straightforwardly using the approach taken in PR 292 in scikit-hep/root_numpy, however, if I understand correctly, the downside of this (as highlighted in one of the above links) is that then even running I appreciate that this probably not classed as a critical requirement but might be something worth considering addressing going forward. Happy to look into resolving this if that would be helpful. |
What about I take care of this? |
Absolutely! This has been bothering many people for a long time. If you can sort this out, it will be a great help! |
Solved by #202 |
Describe the bug
When attempting to install Solcore in a clean virtualenv (or any Python environment that does not currently have
numpy
installed) usingpython setup.py install
results in an error since there is an attempt to import the version ofdistutils
from wihtinnumpy
prior to numpy being installed!To Reproduce
Clone solcore, create and activate a virtualenv and then attempt to run the install using
setup.py
. This example is based on a Mac/Linux platform with Python >=3.7 and the virtualenv Python package installed:This immediately results in the error:
Expected behavior
The install should proceed and complete successfully.
Additional context
This is a result of attempting to use the enhanced
distutils
from within numpy prior to numpy being installed.It looks like this version of distutils is required to support the building of the native PDD library from the Fortran source when using the
--with_pdd
option.A simple workaround would be to import only
setup
fromdistutils.core
and then importExtension
fromnumpy.distutils.core
within theif "--with_pdd" in sys.argv:
block. This would still require someone wanting to use the PDD module to installnumpy
manually first but it would at least prevent an error when trying to run the basic install.I assume there's a better solution to this which would presumably involve installing numpy inside the
if "--with_pdd" in sys.argv:
block if it's required.The text was updated successfully, but these errors were encountered: