module numpy has no attribute cumproduct after numpy 2.0.0 release
The following error message is printed after any attempt to use texts
, regardless of modes, flags, etc.
File "/hkfs/home/project/hk-project-consulting/an9294/python_VirtEnvs/vrel-br284/lib64/python3.9/site-packages/numpy/__init__.py", line 410, in __getattr__
raise AttributeError("module {!r} has no attribute "
AttributeError: module 'numpy' has no attribute 'cumproduct
The problem has been observed in both regular python and conda installations.
The error can be reproduced via the following procedure:
- Starting from a new, clean, python virtual environment install the master branch of the vre-language package
- Activate the environment and run any
texts
command. For exampletexts script --help
will print the error message.
It seems the error is related to the version of the numpy package installed.
Prior to the changes, the basic installation of the vre-languange (python -m pip install <path_to_vre-language_local_repo>
) provided numpy v1.26.4
.
After the MR, the installed nummpy is v2.0.0
.
This is apparently caused by the removal of np.object after the numpy 2.0.0 release.
(Seems this was already being deprecated since release 1.20.0).
In any case, the problem can be easily circumvented by pinning the numpy version in the setup.cfg file (L16) :
[...]
textx
numpy<2.0.0 <--- Add "<2.0.0"
pandas
[...]
This installation will default to a numpy version (likely v 1.26.4
), that will work without the AttributeError.
The numpy version then should be pinned to avoid the problem.