Numpy 1.25 deprecation warning in conda

Hi all,

I recently noticed this warning when running fenics in the conda environment

/home/remidm/miniconda3/envs/fenicsproject/lib/python3.11/site-packages/ffc/uflacs/language/cnodes.py:1364: DeprecationWarning: `product` is deprecated as of NumPy 1.25.0, and will be removed in NumPy 2.0. Please use `prod` instead.
  sublist = build_initializer_lists(val, sizes[1:], level+1, formatter, padlen=padlen, precision=precision)

I don’t expect the version tags in the dependencies will change.

What would you suggest to avoid this? Reinstalling an older version of numpy?

Cheers!

Switching np.product to np.prod should remove the warning

Thank you. Unfortunately, this warning is triggered by the ffc package not my code.

Oh, I missed that it was from ffc. In which case, maybe you could filter the warning:

import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning) 

Otherwise, you could downgrade numpy

yep, I just feel like the conda env should have more requirements on the version of numpy

True, it’ll stop working once numpy 2.0.0 is released. I’m not sure who is in charge of legacy fenics conda packaging?

One usually does not have upper bounds on packages, which can become an issue when software is no longer maintained. Anyone can contribute to ffc or add a patch to the conda recipe:

Thanks Jorgen, just opened an issue on ffc.

Are PRs still accepted?

https://bitbucket.org/fenics-project/ffc/pull-requests/102

If they are, I opened a PR :slight_smile: