-
Notifications
You must be signed in to change notification settings - Fork 5
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
Fix 'pip install' for pip>=23.1 #23
Conversation
Thank you, @kalekundert ! This sould be a must-have update, but now I think it is a good time to reactivate the CI I am sorry but I pushed some files to trigger github actions. Currently, the installation was not successful on the github-actions' server. Would you mind to update this PR so that the installation on that server becomes successful?
|
The installation error in the CI comes from this part It looks like that a library requires fortran compilation does not support pip install --no-deps .;
python -m pip install --no-deps . Then, I still see an error in A possible solution would be
You can find an example for this modification in my fujiisoup:fix-install branch, but if you know better solution, feel free to ignore this. |
Thanks for such a quick response. And feel free to make as many commits as you'd like to my branch. I didn't test editable installs, so I'll have to look and see if there's a way to get that to work. Regarding the error with the Reading this F2PY build guide and #22, I realize now that the install process might break again in a few months when python 3.12 comes out. In fact, it looks like it's already possible to test with python 3.12.0-rc.1 via github actions (supported python versions), so it might be worth doing that just to see what happens. If it doesn't work, my impression was that the |
Thank you for the info. I will work on a ci that can run python 3.12, which may be useful for avoiding |
Trying to install
py3nj
withpip>=23.1
results in the following error:The problem is related to the fact that
setup.py
needs to be able to importnumpy
in order to create the fortran modules. This is actually an issue for all versions of pip; if you try to installpy3nj
into an environment withoutnumpy
installed, you'll get the same error message. In fact, the discussion in #17 diagnoses this exact problem, and also proposes the exact solution implemented by this PR. But it's more urgent now, because it used to be that everything would work so long asnumpy
was installed.What changed in
pip>=23.1
is that packages are now built in their own virtual environments, isolated from any user-installed packages. See the CHANGELOG, and two relevant pull requests: pypa/pip#8368 and pypa/pip#8559. This means that there's no longer any way for users to provide thenumpy
dependency (note that installingnumpy
beforepy3nj
in the above snippet didn't avoid the error), sopy3nj
needs to tell pip to include it in the build environment. This is done using the[build-system]
section of thepyproject.toml
file.While I was at it, I moved most of the metadata from
setup.py
topyproject.toml
, and got rid of the now-redundantsetup.cfg
. I think this is considered best-practice, because it's easier for third-party tools to extra project metadata from TOML files than python scripts. I also noticed thatsetup.py
specified a BSD 3-clause license, while the actualLICENSE
file in the repository contains the Apache license. I assumed that thesetup.py
file was wrong, and changed it to just reference theLICENSE
file.