numpy 1.12.0 IndexError
Issue #140
resolved
cannot build fenics 2016.2.0 with numpy 1.12.0
in ffc/tensor/tensorreordering.py,
indexing with a float raises IndexError:
if restrictions[i] == "+":
position = position + [slice(0, dim / 2)]
elif restrictions[i] == "-":
position = position + [slice(dim / 2, dim)]
else:
position = position + [slice(0, dim)]
Comments (5)
-
-
dim / 2
gives afloat
with Python 3 division. -
Right, so should be
dim // 2
and optimally we should havefrom __future__ import division
. -
reporter It is due to a change in numpy's api:
github.com/numpy/numpy/blob/master/doc/release/1.12.0-notes.rst
-- -- Generating form files in demo, test and bench directories. May take some time... -- ---------------------------------------------------------------------------------------- CMake Error at CMakeLists.txt:921 (message): Generation of form files failed: Compiling 1 forms in demo/undocumented/block-matrix/cpp... ffc -l dolfin -s -O -r auto StiffnessMatrix.ufl [...] Compiling 2 forms in demo/undocumented/extrapolation/cpp... ffc -l dolfin -s -O -r auto P2.ufl ffc -l dolfin -s -O -r auto P1.ufl Compiling 1 forms in demo/undocumented/auto-adaptive-navier-stokes/cpp... ffc -l dolfin -s -O -r auto -e AdaptiveNavierStokes.ufl Traceback (most recent call last): File "<...>/cmake/scripts/generate-form-files.py", line 92, in <module> ret = ffc.main(args) File "<...>lib/python3.6/site-packages/ffc/__main__.py", line 234, in main code_h, code_c = compile_ufl_data(ufd, prefix, parameters) File "<...>lib/python3.6/site-packages/ffc/__main__.py", line 90, in compile_ufl_data parameters) File "<...>lib/python3.6/site-packages/ffc/errorcontrol/errorcontrol.py", line 86, in compile_with_error_control code_h, code_c = compile_form(ec_forms + forms, object_names, prefix, parameters) File "<...>lib/python3.6/site-packages/ffc/compiler.py", line 141, in compile_form prefix, parameters, jit) File "<...>lib/python3.6/site-packages/ffc/compiler.py", line 188, in compile_ufl_objects ir = compute_ir(analysis, prefix, parameters, jit) File "<...>lib/python3.6/site-packages/ffc/representation.py", line 187, in compute_ir for (form_id, fd) in enumerate(form_datas)] File "<...>lib/python3.6/site-packages/ffc/representation.py", line 187, in <listcomp> for (form_id, fd) in enumerate(form_datas)] File "<...>lib/python3.6/site-packages/ffc/representation.py", line 450, in _compute_integral_ir parameters) File "<...>lib/python3.6/site-packages/ffc/tensor/tensorrepresentation.py", line 91, in compute_integral_ir reorder_entries(terms[i][j]) File "<...>lib/python3.6/site-packages/ffc/tensor/tensorreordering.py", line 59, in reorder_entries tensor[position] = A0.A0 TypeError: slice indices must be integers or None or have an __index__ method
-
- changed status to resolved
This was fixed in c8ef816ed45336d5fd7e9689c40cb1150d71d71f
- Log in to comment
Could you provide a way how to reproduce the problem?