t-oster / VisiCut

A userfriendly tool to prepare, save and send Jobs to Lasercutters
https://visicut.org
Other
235 stars 115 forks source link

Inkscape extension doesn't work when Inkscape is installed via Ubuntu Snap #621

Open Jorgininho opened 3 years ago

Jorgininho commented 3 years ago

Hello,

I'm working on a fresh install of inkscape and visicut, but the export from inkscape to visicut via extension menu doesn't seems to be working. Here is the configuration : OS : Ubuntu 20.04.3 LTS Inkscape : 1.1 Visicut : 1.9-102

When I try to export a design from inkscape to visicut, i get this :

Traceback (most recent call last):
  File "visicut_export.py", line 267, in <module>
    VISICUTBIN = which("VisiCut.Linux", [VISICUTDIR, "/usr/share/visicut"])
  File "visicut_export.py", line 118, in which
    raise Exception("Cannot find executable {0} in PATH={1}.\n\n"
Exception: Cannot find executable 'VisiCut.Linux' in PATH=['/usr/share/visicut', '/usr/share/visicut', '/snap/inkscape/9090/bin', '/snap/inkscape/9090/usr/sbin', '/snap/inkscape/9090/usr/bin', '/snap/inkscape/9090/sbin', '/snap/inkscape/9090/bin', '/usr/local/sbin', '/usr/local/bin', '/usr/sbin', '/usr/bin', '/sbin', '/bin', '/usr/games', '/usr/local/games', ''].

Please report this bug on https://github.com/t-oster/VisiCut/issues

For a quick fix: Set VISICUTDIR and INKSCAPEDIR in /home/cervin/.config/inkscape/extensions/visicut_export.py

I don't see how to apply the quick fix solution, since the executable are indeed present in the mentioned folders

Thanks

mgmax commented 3 years ago

My guess is that you have installed Inkscape as a "snap package". As far as I understand, snap packages are very locked down and can not call outside applications. As far as I understand, you even require special permission to call one snap application from another, and there is no way to launch non-snap applications -- not the best design...

The extension should at least be fixed to include a warning if "/snap/..." is on the PATH and Visicut can not be found.

You can try two workarounds:

sebastian-schmid commented 3 years ago

For Ubuntu (and Distros based on Ubuntu) I recommend to install inkscape via ppa as described here: https://inkscape.org/release/inkscape-1.1.1/gnulinux/ubuntu/ppa/dl/

sudo add-apt-repository ppa:inkscape.dev/stable
sudo apt update
sudo apt install inkscape
Jorgininho commented 2 years ago

Hello, thanks for your answer but seems doesn't work for me, What I've done is to clear completely install of Visicut & Inkscape on my computer, to run Inkscape 1.1 as an executable AppImage, then I've installed Visicut 1.9-70 (last available in release of the GIT), all run well on an Ubuntu 20.04.4 LTS I've tried the same on an Ubuntu 22.04.1 LTS, but got the following error message when I try to use Visicut extension via Inkscape : /tmp/.mount_InkscaHVklmq/usr/bin/python3.8: can't open file 'visicut_export.py': [Errno 2] No such file or directory

mgmax commented 2 years ago

A newer VisiCut version is available via https://download.visicut.org/ .

Please try the basic case of installing Inkscape via the standard way (technically as a DEB package via APT), not anything special like Appimage or snap.

I'm not sure why your Inkscape finds the extension menu entry (.inx file) but not the corresponding .py file. You could have a look at the user and system extension directory, if the files are there, and if the content is readable with some text editing program. These paths are shown in Inkscape: Edit - Preferences - System - (User) extensions.

Jorgininho commented 2 years ago

So I've installed Inkscape vi command line

sudo add-apt-repository ppa:inkscape.dev/stable
sudo apt update
sudo apt install inkscape

then installed the last package of visicut sudo apt install ./visicut_1.9-142-gc05b03f5-1_all.deb

Then I've run the install of the extension via Visicut

So when I try to use the extension I got the following error message : /usr/bin/python3: can't find '__main__' module in '/home/bocal/.' (bocal is the username)

the 4 extension files are present in the exentension folder

I can read all of them with a text editor. noticing that the option "add in visicut" && "open in visicut" extension in inkscape appears twice

mgmax commented 2 years ago

I tried the same and it works, both with Inkscape 1.1 and 1.2:

Please try to clean your user extension directory. Probably you have an old broken version of the extension in it.

With the snap version of Inkscape, visicut doesn't even install the extension into the right directory, so the extension is not found. But the extension does not work anyway. We should add a warning message in Visicut -- check if which inkscape starts with /snap/ and then inform the user that "snap" is currently not supported. (edit: upstream bug: https://gitlab.com/inkscape/inkscape/-/issues/2490 )

mgmax commented 2 weeks ago

We have the following problems:

So for now there's nothing we can do except detect the situation and show some instructions for a workaround.