chipmuenk / pyfda

Python Filter Design Analysis Tool
http://chipmuenk.github.io/
MIT License
648 stars 93 forks source link

Install from pip: ValueError: Unknown projection '3d' #207

Closed hansfbaier closed 2 years ago

hansfbaier commented 2 years ago

pyfdax KeyError: 'V_NMG' [ INFO] [pyfda.pyfda_rc:187] Using 'DejaVu Sans' font. [ INFO] [pyfda.libs.tree_builder:256] Parsing config file '/home/user/.pyfda/pyfda.conf' with sections: [Common] [Input Widgets] [Plot Widgets] [Filter Widgets] [Fixpoint Widgets]

[ INFO] [pyfda.libs.tree_builder:310] Found 3 entries in [Common] [ INFO] [pyfda.libs.tree_builder:336] No valid user directory specified. [ INFO] [pyfda.libs.tree_builder:594] Found 5 classes in [Input Widgets]: pyfda.input_widgets.input_specs.Input_Specs pyfda.input_widgets.input_coeffs.Input_Coeffs pyfda.input_widgets.input_pz.Input_PZ pyfda.input_widgets.input_info.Input_Info pyfda.input_widgets.input_fixpoint_specs.Input_Fixpoint_Specs

[ INFO] [pyfda.libs.tree_builder:594] Found 6 classes in [Plot Widgets]: pyfda.plot_widgets.plot_hf.Plot_Hf pyfda.plot_widgets.plot_phi.Plot_Phi pyfda.plot_widgets.plot_tau_g.Plot_tau_g pyfda.plot_widgets.plot_pz.Plot_PZ pyfda.plot_widgets.plot_impz.Plot_Impz pyfda.plot_widgets.plot_3d.Plot_3D

[ INFO] [pyfda.libs.tree_builder:594] Found 10 classes in [Filter Widgets]: pyfda.filter_widgets.bessel.Bessel pyfda.filter_widgets.butter.Butter pyfda.filter_widgets.cheby1.Cheby1 pyfda.filter_widgets.cheby2.Cheby2 pyfda.filter_widgets.ellip.Ellip pyfda.filter_widgets.equiripple.Equiripple pyfda.filter_widgets.firwin.Firwin pyfda.filter_widgets.ma.MA pyfda.filter_widgets.manual.Manual_FIR pyfda.filter_widgets.manual.Manual_IIR

[ INFO] [pyfda.libs.tree_builder:594] Found 1 classes in [Fixpoint Widgets]: pyfda.fixpoint_widgets.fir_df.fir_df_pyfixp_ui.FIR_DF_pyfixp_UI

[ INFO] [pyfda.input_widgets.input_specs:322] Start filter design using method 'Cheby1.LPman' [ INFO] [pyfda.input_widgets.input_specs:358] Designed filter with order = 10 [WARNING] [pyfda.input_widgets.input_fixpoint_specs:86] No fixpoint filter found for this type of filter! [ INFO] [pyfda.plot_widgets.plot_impz:576] [0.1348 ms]: Calculated transient response [ INFO] [pyfda.plot_widgets.plot_impz:582] [122.9 ms]: Plotted transient response Traceback (most recent call last): File "/usr/lib/python3/dist-packages/matplotlib/projections/init.py", line 58, in get_projection_class return projection_registry.get_projection_class(projection) File "/usr/lib/python3/dist-packages/matplotlib/projections/init.py", line 25, in get_projection_class return self._all_projection_types[name] KeyError: '3d'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/user/.local/bin//pyfdax", line 8, in sys.exit(main()) File "/home/user/.local/lib/python3.8/site-packages/pyfda/pyfdax.py", line 294, in main mainw = pyFDA() File "/home/user/.local/lib/python3.8/site-packages/pyfda/pyfdax.py", line 143, in init self._construct_UI() File "/home/user/.local/lib/python3.8/site-packages/pyfda/pyfdax.py", line 156, in _construct_UI pltTabWidgets = plot_tab_widgets.PlotTabWidgets(self) # plot widgets File "/home/user/.local/lib/python3.8/site-packages/pyfda/plot_widgets/plot_tab_widgets.py", line 36, in init self._construct_UI() File "/home/user/.local/lib/python3.8/site-packages/pyfda/plot_widgets/plot_tab_widgets.py", line 74, in _construct_UI inst = wdg_class() File "/home/user/.local/lib/python3.8/site-packages/pyfda/plot_widgets/plot_3d.py", line 69, in init self._construct_UI() File "/home/user/.local/lib/python3.8/site-packages/pyfda/plot_widgets/plot_3d.py", line 220, in _construct_UI self._init_grid() # initialize grid and do initial plot File "/home/user/.local/lib/python3.8/site-packages/pyfda/plot_widgets/plot_3d.py", line 302, in _init_grid self.draw() # initial plot File "/home/user/.local/lib/python3.8/site-packages/pyfda/plot_widgets/plot_3d.py", line 398, in draw self.draw_3d() File "/home/user/.local/lib/python3.8/site-packages/pyfda/plot_widgets/plot_3d.py", line 405, in draw_3d self.init_axes() File "/home/user/.local/lib/python3.8/site-packages/pyfda/plot_widgets/plot_3d.py", line 316, in init_axes self.ax3d = self.mplwidget.fig.add_subplot(111, projection='3d') File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 1396, in add_subplot self._process_projection_requirements(*args, **kwargs) File "/usr/lib/python3/dist-packages/matplotlib/figure.py", line 1120, in _process_projection_requirements projection_class = projections.get_projection_class(projection) File "/usr/lib/python3/dist-packages/matplotlib/projections/init.py", line 60, in get_projection_class raise ValueError("Unknown projection %r" % projection) ValueError: Unknown projection '3d'

chipmuenk commented 2 years ago

Hm, haven't encountered that one. Could you please try the following steps?

hansfbaier commented 2 years ago

image

chipmuenk commented 2 years ago

So, the cause for the crash seems to be in the plot_3d widget and hence in the 3d submodule of matplotlib. You're using Qt5 and Matplotlib 3.1.2, maybe there is a compatibility issue. The release notes for matplotlib 3.2.2 claim "support new Qt 5 and fix support for Qt 4". Is it possible for you to upgrade to at least that version? I'll setup a new environment with an old matplotlib version in the next few days because I cannot reproduce the error with my current environments.

chipmuenk commented 2 years ago

I can reproduce the crash with matplotlib 3.1.2. Upgrading to 3.2.2 helps indeed, but I'll also fix the root cause which is a missing

from mpl_toolkits.mplot3d import Axes3D .

It seems this import is no longer required for newer matplotlib versions.

(see also https://stackoverflow.com/questions/3810865/matplotlib-unknown-projection-3d-error)

hansfbaier commented 2 years ago

Many thanks!