Closed mathomp4 closed 7 months ago
Hi! Thanks for reporting! I pushed a solution with custom setuptools commands. Numpy (with f2py), meson and meson-python must be available at installation time. Does this work for you?
Hi! Thanks for reporting! I pushed a solution with custom setuptools commands. Numpy (with f2py), meson and meson-python must be available at installation time. Does this work for you?
Ooh. Thanks! I'll let you know tomorrow...once I figure out how to install meson on the cluster. 😄
meson is pip installable...
Good news, it installs!
Bad news, I think more changes are needed underneath. When I try to load it:
$ python3 -c 'import ffnet'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/discover/nobackup/mathomp4/Miniconda-Test/MINIpyD/24.1.2-0_py3.12/2024-03-22/lib/python3.12/site-packages/ffnet/__init__.py", line 17, in <module>
import ffnet.ffnet as ffnetmodule
File "/discover/nobackup/mathomp4/Miniconda-Test/MINIpyD/24.1.2-0_py3.12/2024-03-22/lib/python3.12/site-packages/ffnet/ffnet.py", line 16, in <module>
from scipy import zeros, ones, optimize, sqrt, ndarray, array
ImportError: cannot import name 'zeros' from 'scipy' (/discover/nobackup/mathomp4/Miniconda-Test/MINIpyD/24.1.2-0_py3.12/2024-03-22/lib/python3.12/site-packages/scipy/__init__.py)
I think these lines:
https://github.com/mrkwjc/ffnet/blob/67279ab68469f07c0212228bc1ed41e68f49dcd6/ffnet/ffnet.py#L16-L17
need to become:
from numpy import zeros, ones, sqrt, ndarray, array
from scipy import optimize
If I do that, the README example works:
$ python3 ffnet_example.py
Feed-forward neural network:
inputs: 2
hiddens: 2
outputs: 1
connections and biases: 9
Testing results for 4 testing cases:
OUTPUT 1 (node nr 5):
Targets vs. outputs:
1 1.000000 1.000000
2 0.000000 0.500000
3 0.000000 0.000001
4 1.000000 0.499999
Regression line parameters:
slope = 0.499999
intercept = 0.250000
r-value = 0.707106
p-value = 0.292894
slope stderr = 0.353553
estim. stderr = 0.353553
(or, I guess, doesn't crash? Not sure what the answer should be).
That said, it's possible my suggested changes might need to be protected with try/except? Not sure when the bits moved from scipy to numpy...
Change must be introduced in >scipy-1.10... Nevertheless, I introduced your changes, without try/except, this always should be written so :)
@mrkwjc Things seem to be working well for me now! Thanks! I'll close this.
I recently tried to install ffnet from this repo and I got:
If I try this command with python3.11 I see:
and with python3.12:
As the message says, it looks like
numpy.distutils
is now gone and they recommend looking at:https://numpy.org/devdocs/reference/distutils_status_migration.html
and unfortunately it looks like
setuptools
does not have Fortran support, so this might mean a move to meson. I see many people having to do this on GitHub (see https://github.com/scipy/scipy/issues/13615). If I had a choice, I'd prefer CMake if only because I don't think meson is installed on any of my machines (but maybe with pip this doesn't matter?). Though looking at things like https://github.com/scikit-fmm/scikit-fmm/issues/78#issuecomment-2004970585, maybe meson is "winning"...