Open
Description
📝 Description of the feature
Allow for installation with conda, using i.e. conda intall -c conda-forge ansys-fluent-visualization
.
This should allow for better handling of dependencies and prevent conflicts in dependency versions. Conda is also the typical way of installing Jupyter notebooks, and it seems common to run pyfluent-visualization from Jupyter notebooks.
I have an issue where the post_processing_exhaust_manifold.ipynb
example is not running properly because of incompatible dependencies between ansys-fluent-core, pyvista, vtk, and numpy:
mesh1.surfaces_list = [
"in1",
"in2",
"in3",
"out1",
"solid_up:1",
"solid_up:1:830",
"solid_up:1:830-shadow",
]
mesh1.display("window-1")
{
"name": "AttributeError",
"message": "module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations",
"stack": "---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[6], line 10
1 mesh1.surfaces_list = [
2 \"in1\",
3 \"in2\",
(...)
8 \"solid_up:1:830-shadow\",
9 ]
---> 10 mesh1.display(\"window-1\")
File ~/miniconda3/envs/pyFluent/lib/python3.12/site-packages/ansys/fluent/core/post_objects/meta.py:111, in Command.__init__.<locals>._execute(_self, *args, **kwargs)
107 if arg_value < minimum or arg_value > maximum:
108 raise DisallowedValuesError(
109 arg, arg_value, allowed_values
110 )
--> 111 return method(_self.obj, *args, **kwargs)
File ~/miniconda3/envs/pyFluent/lib/python3.12/site-packages/ansys/fluent/visualization/pyvista/pyvista_objects.py:74, in Mesh.display(self, window_id, overlay)
61 @Command
62 def display(self, window_id: Optional[str] = None, overlay: Optional[bool] = False):
63 \"\"\"Display mesh graphics.
64
65 Parameters
(...)
72 The default is ``False``.
73 \"\"\"
---> 74 pyvista_windows_manager.plot(
75 self, window_id=window_id, overlay=overlay, fetch_data=True
76 )
File ~/miniconda3/envs/pyFluent/lib/python3.12/site-packages/ansys/fluent/visualization/pyvista/pyvista_windows_manager.py:593, in PyVistaWindowsManager.plot(self, object, window_id, fetch_data, overlay)
591 window_id = self._get_unique_window_id()
592 if in_notebook() or get_config()[\"blocking\"]:
--> 593 self._plot_notebook(object, window_id, fetch_data, overlay)
594 else:
595 self._open_and_plot_console(object, window_id, fetch_data, overlay)
File ~/miniconda3/envs/pyFluent/lib/python3.12/site-packages/ansys/fluent/visualization/pyvista/pyvista_windows_manager.py:781, in PyVistaWindowsManager._plot_notebook(self, obj, window_id, fetch_data, overlay)
779 window.fetch_data = fetch_data
780 window.overlay = overlay
--> 781 window.plot()
File ~/miniconda3/envs/pyFluent/lib/python3.12/site-packages/ansys/fluent/visualization/pyvista/pyvista_windows_manager.py:148, in PyVistaWindow.plot(self)
146 \"\"\"Display graphics.\"\"\"
147 self.fetch()
--> 148 self.render()
File ~/miniconda3/envs/pyFluent/lib/python3.12/site-packages/ansys/fluent/visualization/pyvista/pyvista_windows_manager.py:116, in PyVistaWindow.render(self)
114 plotter.clear()
115 if obj.__class__.__name__ == \"Mesh\":
--> 116 self._display_mesh(obj, plotter)
117 elif obj.__class__.__name__ == \"Surface\":
118 self._display_surface(obj, plotter)
File ~/miniconda3/envs/pyFluent/lib/python3.12/site-packages/ansys/fluent/visualization/pyvista/pyvista_windows_manager.py:443, in PyVistaWindow._display_mesh(self, obj, plotter)
438 mesh = pv.PolyData(
439 mesh_data[\"vertices\"],
440 lines=mesh_data[\"faces\"],
441 )
442 else:
--> 443 mesh = pv.PolyData(
444 mesh_data[\"vertices\"],
445 faces=mesh_data[\"faces\"],
446 )
447 color_size = len(self._colors.values())
448 color = list(self._colors.values())[surface_id % color_size]
File ~/miniconda3/envs/pyFluent/lib/python3.12/site-packages/pyvista/core/pointset.py:800, in PolyData.__init__(self, var_inp, faces, n_faces, lines, n_lines, strips, n_strips, deep, force_ext, force_float, verts, n_verts)
798 # First parameter is points
799 if isinstance(var_inp, (np.ndarray, list, _vtk.vtkDataArray)):
--> 800 self.SetPoints(vtk_points(var_inp, deep=deep, force_float=force_float))
802 else:
803 msg = f\"\"\"
804 Invalid Input type:
805
(...)
812
813 Instead got: {type(var_inp)}\"\"\"
File ~/miniconda3/envs/pyFluent/lib/python3.12/site-packages/pyvista/core/utilities/points.py:93, in vtk_points(points, deep, force_float)
91 points = np.require(points, requirements=['C'])
92 vtkpts = _vtk.vtkPoints()
---> 93 vtk_arr = _vtk.numpy_to_vtk(points, deep=deep)
94 vtkpts.SetData(vtk_arr)
96 return vtkpts
File ~/miniconda3/envs/pyFluent/lib/python3.12/site-packages/vtkmodules/util/numpy_support.py:164, in numpy_to_vtk(num_array, deep, array_type)
161 result_array.SetNumberOfTuples(shape[0])
163 # Ravel the array appropriately.
--> 164 arr_dtype = get_numpy_array_type(vtk_typecode)
165 if numpy.issubdtype(z.dtype, arr_dtype) or \\
166 z.dtype == numpy.dtype(arr_dtype):
167 z_flat = numpy.ravel(z)
File ~/miniconda3/envs/pyFluent/lib/python3.12/site-packages/vtkmodules/util/numpy_support.py:94, in get_numpy_array_type(vtk_array_type)
92 def get_numpy_array_type(vtk_array_type):
93 \"\"\"Returns a numpy array typecode given a VTK array type.\"\"\"
---> 94 return get_vtk_to_numpy_typemap()[vtk_array_type]
File ~/miniconda3/envs/pyFluent/lib/python3.12/site-packages/vtkmodules/util/numpy_support.py:74, in get_vtk_to_numpy_typemap()
72 def get_vtk_to_numpy_typemap():
73 \"\"\"Returns the VTK array type to numpy array type mapping.\"\"\"
---> 74 _vtk_np = {vtkConstants.VTK_BIT:numpy.bool,
75 vtkConstants.VTK_CHAR:numpy.int8,
76 vtkConstants.VTK_SIGNED_CHAR:numpy.int8,
77 vtkConstants.VTK_UNSIGNED_CHAR:numpy.uint8,
78 vtkConstants.VTK_SHORT:numpy.int16,
79 vtkConstants.VTK_UNSIGNED_SHORT:numpy.uint16,
80 vtkConstants.VTK_INT:numpy.int32,
81 vtkConstants.VTK_UNSIGNED_INT:numpy.uint32,
82 vtkConstants.VTK_LONG:LONG_TYPE_CODE,
83 vtkConstants.VTK_LONG_LONG:numpy.int64,
84 vtkConstants.VTK_UNSIGNED_LONG:ULONG_TYPE_CODE,
85 vtkConstants.VTK_UNSIGNED_LONG_LONG:numpy.uint64,
86 vtkConstants.VTK_ID_TYPE:ID_TYPE_CODE,
87 vtkConstants.VTK_FLOAT:numpy.float32,
88 vtkConstants.VTK_DOUBLE:numpy.float64}
89 return _vtk_np
File ~/miniconda3/envs/pyFluent/lib/python3.12/site-packages/numpy/__init__.py:324, in __getattr__(attr)
319 warnings.warn(
320 f\"In the future `np.{attr}` will be defined as the \"
321 \"corresponding NumPy scalar.\", FutureWarning, stacklevel=2)
323 if attr in __former_attrs__:
--> 324 raise AttributeError(__former_attrs__[attr])
326 if attr == 'testing':
327 import numpy.testing as testing
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations"
}
💡 Steps for implementing the feature
No response
🔗 Useful links and references
No response