Search code examples
python-3.xnumpyopenmdao

openMDAO numpy.zeros issue


I need that to run some analysis on openaerostruct, so I'm currently reading documentation to understand openMDAO functionalities. When running examples taken by the official documentation (such as the following constrained optimizations: http://openmdao.readthedocs.io/en/1.7.3/usr-guide/tutorials/paraboloid-tutorial.html and http://openmdao.readthedocs.io/en/1.7.3/usr-guide/tutorials/sellar.html) I get the following error from exec_comp module at line 273:

J[(u, param)] = numpy.zeros((jval.size, psize)) AttributeError: 'float' object has no attribute 'size'

Seems like a problem related to numpy.zeros function but I couldn't find clues of the function changing over time and thus generating an error. What can I do?

Note that openMDAO version I'm using is 1.7.3


Solution

  • You should try getting OpenMDAO 1.7.4, which fixes some compatibility issues that later versions of numpy introduced.

    Note: The new version really just pins the required numpy to 1.13.1 or greater (you may be using 1.13 which had problems). So, you can probably also fix the problem by upgrading numpy to that version or later.