modelon-community / Assimulo

Assimulo is a simulation package for solving ordinary differential equations.
https://jmodelica.org/assimulo/index.html
GNU Lesser General Public License v3.0
66 stars 16 forks source link

Set up needs to be updated for NumPy >= 1.22 #34

Closed jonrkarr closed 1 year ago

jonrkarr commented 2 years ago

Unfortunately, it looks like NumPy introduced a change with 1.22 which breaks the set up of Assimulo. Below is an excerpt of the error. NumPy now looks for a new attribute, extra_c_compile_args of extensions.

...
#42 27.93     Traceback (most recent call last):
#42 27.93       File "<string>", line 1, in <module>
#42 27.93       File "/tmp/pip-req-build-6n21kyom/setup.py", line 691, in <module>
#42 27.93         ndc.setup(name=NAME,
#42 27.93       File "/usr/local/lib/python3.9/site-packages/numpy/distutils/core.py", line 169, in setup
#42 27.93         return old_setup(**new_attr)
#42 27.93       File "/usr/local/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
#42 27.93         return distutils.core.setup(**attrs)
#42 27.93       File "/usr/local/lib/python3.9/distutils/core.py", line 148, in setup
#42 27.93         dist.run_commands()
#42 27.93       File "/usr/local/lib/python3.9/distutils/dist.py", line 966, in run_commands
#42 27.93         self.run_command(cmd)
#42 27.93       File "/usr/local/lib/python3.9/distutils/dist.py", line 985, in run_command
#42 27.93         cmd_obj.run()
#42 27.93       File "/usr/local/lib/python3.9/site-packages/numpy/distutils/command/install.py", line 60, in run
#42 27.93         r = self.setuptools_run()
#42 27.93       File "/usr/local/lib/python3.9/site-packages/numpy/distutils/command/install.py", line 34, in setuptools_run
#42 27.93         return distutils_install.run(self)
#42 27.93       File "/usr/local/lib/python3.9/distutils/command/install.py", line 546, in run
#42 27.93         self.run_command('build')
#42 27.93       File "/usr/local/lib/python3.9/distutils/cmd.py", line 313, in run_command
#42 27.93         self.distribution.run_command(command)
#42 27.93       File "/usr/local/lib/python3.9/distutils/dist.py", line 985, in run_command
#42 27.93         cmd_obj.run()
#42 27.93       File "/usr/local/lib/python3.9/site-packages/numpy/distutils/command/build.py", line 61, in run
#42 27.93         old_build.run(self)
#42 27.93       File "/usr/local/lib/python3.9/distutils/command/build.py", line 135, in run
#42 27.93         self.run_command(cmd_name)
#42 27.93       File "/usr/local/lib/python3.9/distutils/cmd.py", line 313, in run_command
#42 27.93         self.distribution.run_command(command)
#42 27.93       File "/usr/local/lib/python3.9/distutils/dist.py", line 985, in run_command
#42 27.93         cmd_obj.run()
#42 27.93       File "/usr/local/lib/python3.9/site-packages/numpy/distutils/command/build_ext.py", line 316, in run
#42 27.93         self.build_extensions()
#42 27.93       File "/usr/local/lib/python3.9/distutils/command/build_ext.py", line 449, in build_extensions
#42 27.93         self._build_extensions_serial()
#42 27.93       File "/usr/local/lib/python3.9/distutils/command/build_ext.py", line 474, in _build_extensions_serial
#42 27.93         self.build_extension(ext)
#42 27.93       File "/usr/local/lib/python3.9/site-packages/numpy/distutils/command/build_ext.py", line 380, in build_extension
#42 27.93         extra_cflags = ext.extra_c_compile_args or []
#42 27.93     AttributeError: 'Extension' object has no attribute 'extra_c_compile_args'
#42 27.93     INFO:
#42 27.93     ########### EXT COMPILER OPTIMIZATION ###########
#42 27.93     INFO: Platform      :
#42 27.93       Architecture: x64
#42 27.93       Compiler    : gcc
#42 27.93     
#42 27.93     CPU baseline  :
#42 27.93       Requested   : 'min'
#42 27.93       Enabled     : SSE SSE2 SSE3
#42 27.93       Flags       : -msse -msse2 -msse3
#42 27.93       Extra checks: none
#42 27.93     
#42 27.93     CPU dispatch  :
#42 27.93       Requested   : 'max -xop -fma4'
#42 27.93       Enabled     : SSSE3 SSE41 POPCNT SSE42 AVX F16C FMA3 AVX2 AVX512F AVX512CD AVX512_KNL AVX512_KNM AVX512_SKX AVX512_CLX AVX512_CNL AVX512_ICL
#42 27.93       Generated   : none
#42 27.93     INFO: CCompilerOpt.cache_flush[817] : write cache to path -> /tmp/pip-req-build-6n21kyom/build/build/temp.linux-x86_64-3.9/ccompiler_opt_cache_ext.py
#42 27.93     ----------------------------------------
#42 27.93 ERROR: Command errored out with exit status 1: /usr/local/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-6n21kyom/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-6n21kyom/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-iap0qb7t/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.9/Assimulo Check the logs for full command output.
#42 28.13 WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
#42 28.13 You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
#42 ERROR: process "/bin/sh -c pip install git+https://github.com/modelon-community/Assimulo.git@Assimulo-${ASSIMULO_VERSION}" did not complete successfully: exit code: 1
modelonrobinandersson commented 1 year ago

Thank you @jonrkarr for the reported issue. Currently assimulo is only known to work with numpy 1.19.5. We can likely make the requirements for numpy in setup.cfg (https://github.com/modelon-community/Assimulo/blob/master/setup.cfg) stricter.

jschueller commented 1 year ago

that's probably https://github.com/numpy/numpy/issues/20928 which has been fixed since in 1.22.2, no issue on the assimulo side

modelonrobinandersson commented 1 year ago

@jschueller thank you for highlighting this. I will take this into account whenever I update the environment from using numpy>1.19.5.