ImportWarning: DynamicImporter.exec_module() not found and mathplotlib depreciation warning
mofosyne opened this issue · comments
inkscape console:
<frozen importlib._bootstrap>:671: ImportWarning: DynamicImporter.exec_module() not found; falling back to load_module()
<frozen importlib._bootstrap>:671: ImportWarning: DynamicImporter.exec_module() not found; falling back to load_module()
/home/mofosyne/.local/lib/python3.10/site-packages/matplotlib/backends/_backend_gtk.py:146: DeprecationWarning: Gtk.Window.set_wmclass is deprecated
self.window.set_wmclass("matplotlib", "Matplotlib")
logfile:
Inkscape 1.3 (1:1.3+202307231459+0e150ed6c4)
Inkex: 1.3.0
Inkscape-Silhouette: 1.28
Path: /usr/share/inkscape/extensions/sendto_silhouette.py
Python: /usr/bin/python3
Version: 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]
Platform: linux
Arguments: sendto_silhouette.py --id=path1 --active-tab=logdump --x_off=0.00 --y_off=0.00 --cuttingmat=cameo_12x12 --toolholder=1 --tool=default --media=300 --speed=0 --pressure=0 --depth=-1 --preview=true --dashes=false --autocrop=false --bbox-only=false --multipass=1 --reversetoggle=false --endposition=start --end_offset=0.0 --regmark=true --regsearch=true --regoriginx=0.0 --regoriginy=0.0 --regwidth=0.0 --reglength=0.0 --wait_done=false --sharpencorners=false --sharpencorners_start=0.1 --sharpencorners_end=0.1 --overcut=0.5 --strategy=zorder --orient_paths=natural --fuse_paths=true --sw_clipping=true --logfile=/tmp/silhouette.log --log_paths=false --append_logs=false --inc_queries=false --dry_run=false --force_hardware=DETECT --bladediameter=0.9 /tmp/ink_ext_XXXXXX.svgJW4CA2
Using Registration Mark:: mark distance from document: Left=0mm, Top=0mm; mark to mark distance: X=210.0mm, Y=297.0mm;
Preview aborted.
done. 0 min 1 sec
OS Spec (via neofetch --off
):
OS: Linux Mint 21.2 x86_64
Kernel: 5.15.0-79-generic
Shell: bash 5.1.16
DE: Cinnamon 5.8.4
WM: Mutter (Muffin)
WM Theme: Mint-Y-Dark-Aqua (Mint-Y)
Theme: Mint-Y-Dark-Aqua [GTK2/3]
Similar ticket #212
Tried to solve it by using sudo pip3 install --upgrade matplotlib
no luck. Not sure on the cause
this looks like a matplotlib issue. you may upgrade your matplotlib installation.
Tried python3 -m pip install -r requirements.txt
and I see that the latest version is v3.7.2 which matches what this website says https://pypi.org/project/matplotlib/ .
~/git/inkscape-silhouette$ python3 -m pip install -r requirements.txt
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: numpy>=1.21.5 in /usr/lib/python3/dist-packages (from -r requirements.txt (line 1)) (1.21.5)
Requirement already satisfied: pyusb>=1.2.1 in /usr/lib/python3/dist-packages (from -r requirements.txt (line 2)) (1.2.1.post1)
Requirement already satisfied: lxml>=4.8.0 in /usr/lib/python3/dist-packages (from -r requirements.txt (line 3)) (4.8.0)
Requirement already satisfied: xmltodict>=0.13.0 in /home/mofosyne/.local/lib/python3.10/site-packages (from -r requirements.txt (line 4)) (0.13.0)
Requirement already satisfied: cssselect>=1.1.0 in /usr/lib/python3/dist-packages (from -r requirements.txt (line 5)) (1.1.0)
Requirement already satisfied: tinycss2>=1.1.1 in /usr/lib/python3/dist-packages (from -r requirements.txt (line 6)) (1.1.1)
Requirement already satisfied: matplotlib>=3.7.2 in /home/mofosyne/.local/lib/python3.10/site-packages (from -r requirements.txt (line 7)) (3.7.2)
Requirement already satisfied: webencodings>=0.4 in /usr/lib/python3/dist-packages (from tinycss2>=1.1.1->-r requirements.txt (line 6)) (0.5.1)
Requirement already satisfied: contourpy>=1.0.1 in /home/mofosyne/.local/lib/python3.10/site-packages (from matplotlib>=3.7.2->-r requirements.txt (line 7)) (1.1.0)
Requirement already satisfied: cycler>=0.10 in /home/mofosyne/.local/lib/python3.10/site-packages (from matplotlib>=3.7.2->-r requirements.txt (line 7)) (0.11.0)
Requirement already satisfied: fonttools>=4.22.0 in /home/mofosyne/.local/lib/python3.10/site-packages (from matplotlib>=3.7.2->-r requirements.txt (line 7)) (4.41.1)
Requirement already satisfied: kiwisolver>=1.0.1 in /home/mofosyne/.local/lib/python3.10/site-packages (from matplotlib>=3.7.2->-r requirements.txt (line 7)) (1.4.4)
Requirement already satisfied: packaging>=20.0 in /usr/lib/python3/dist-packages (from matplotlib>=3.7.2->-r requirements.txt (line 7)) (21.3)
Requirement already satisfied: pillow>=6.2.0 in /usr/lib/python3/dist-packages (from matplotlib>=3.7.2->-r requirements.txt (line 7)) (9.0.1)
Requirement already satisfied: pyparsing<3.1,>=2.3.1 in /usr/lib/python3/dist-packages (from matplotlib>=3.7.2->-r requirements.txt (line 7)) (2.4.7)
Requirement already satisfied: python-dateutil>=2.7 in /home/mofosyne/.local/lib/python3.10/site-packages (from matplotlib>=3.7.2->-r requirements.txt (line 7)) (2.8.2)
Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil>=2.7->matplotlib>=3.7.2->-r requirements.txt (line 7)) (1.16.0)
Still getting the same error. What version of mathplotlib you got?
3.7.2 here
after a quick code analysis this looks heavily related to your Gtk version used in python.
see https://github.com/matplotlib/matplotlib/blob/56732ffcf7a8eb2f4cdbe6835fdc985207c44e09/lib/matplotlib/backends/_backend_gtk.py#L146
or try
from gi.repository import Gtk
Gtk.get_major_version()
as long as you rely on Gtk 3 this warning will appear. with Gtk 4 this will be gone...
How do I switch to gtk4?
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from gi.repository import Gtk
<stdin>:1: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded.
>>> Gtk.get_major_version()
3
Yup it's gtk v3. I attempted to install gtk v4
sudo apt install libgtk-4-1
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libgtk-4-1 is already the newest version (4.6.9+ds-0ubuntu0.22.04.1).
The following packages were automatically installed and are no longer required:
linux-headers-5.15.0-78 linux-headers-5.15.0-78-generic linux-image-5.15.0-78-generic linux-modules-5.15.0-78-generic linux-modules-extra-5.15.0-78-generic
Use 'sudo apt autoremove' to remove them.
0 to upgrade, 0 to newly install, 0 to remove and 8 not to upgrade.
I then ran the version check again and still got v3 for gtk, so not sure how to switch global python gtk version.
you don't need to take any action. This is a warning to the matplotlib maintainers and the distro maintainers.
With future distro upgrades the dependencies gtk version will be upgraded once gtk3 is fading out...
If you'd like to give it a try you can also dig further and upgrade manually... maybe your installation misses gir1.2-gtk-4.0