Inkscape cannot save as optimized svg (python-scour error)

Bug #1786724 reported by elric
44
This bug affects 6 people
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Medium
Patrick Storz

Bug Description

Here are the details of me trying to debug the problem. I'm not familiar with Python, so I don't know how else to debug the problem:

Ubuntu 18.04
Inkscape 0.92.3 (d244b95, 2018-08-02)
$ snap install inkscape

$ Inkscape save as... (optimized svg)
  Failed to import Python module 'scour'.
  Please make sure it is installed (e.g. using 'pip install scour' or 'sudo apt-get install python-scour') and try again.
  Details:
    cannot import name scourString

$ python -c "import scour"
$ echo $?
  0

$ sudo apt-get install python-scour
  Reading package lists... Done
  Building dependency tree
  Reading state information... Done
  python-scour is already the newest version (0.36-2).

$ pip install scour
  Collecting scour
  Collecting six>=1.9.0 (from scour)
    Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
  Installing collected packages: six, scour
  Successfully installed scour-0.37 six-1.11.0

$ find / -name "scour" -type d 2>/dev/null
  drwxr-xr-x 3 root root /usr/lib/python3/dist-packages/scour
  drwxr-xr-x 2 root root /usr/lib/python2.7/dist-packages/scour
  drwxr-xr-x 2 root root /usr/share/scour
  drwxrwxr-x 3 user user /home/user/.local/lib/python2.7/site-packages/scour

$ python -c 'import sys; print(sys.path)'
  ['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/home/user/.local/lib/python2.7/site-packages', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']

$ Inkscape save as... (optimized svg)
  Failed to import Python module 'scour'.
  Please make sure it is installed (e.g. using 'pip install scour' or 'sudo apt-get install python-scour') and try again.
  Details:
    cannot import name scourString

$ python -c "import scour"
$ echo $?
  0

Revision history for this message
Alvin Penner (apenner) wrote :

possibly related to the fact that it is a snap installation, see:
https://bugs.launchpad.net/inkscape/+bug/1748596

could you try performing a File->Save As (Desktop Cutting Plotter) dxf to see if that also fails?

Patrick Storz (ede123)
tags: added: extensions-plugins packaging snap
removed: optimized scour
Revision history for this message
Patrick Storz (ede123) wrote :

Seems the snap packages did not specify Scour as a dependency, should be fixed in
  https://gitlab.com/inkscape/inkscape/commit/26d08e9c5b607e366c69f368682dcc5e17cae835
and
  https://gitlab.com/inkscape/inkscape/commit/f709311ff1b861fe9ccfd79cc21e233075ee94e2

However I'm not using the Snap package (or Linux for that matter), so somebody else will need to confirm wether it works as expected now.

Changed in inkscape:
milestone: none → 0.92.4
status: New → Fix Committed
importance: Undecided → Medium
assignee: nobody → Patrick Storz (ede123)
Revision history for this message
elric (spiritofelric-z) wrote :

Sorry for the slow reply.

@appener, "File->Save As (Desktop Cutting Plotter) dxf" saves just fine with a snap installation.

Revision history for this message
elric (spiritofelric-z) wrote :

@ede123, thanks for the swift turnaround on the commit. I'll keep an eye out for the updated version and refresh the snap.

$ snap list
  Name Version Rev Tracking Publisher Notes
  inkscape 0.92.3 4274 stable inkscape -

$ snap info inkscape
  refresh-date: 6 days ago, at 22:27 EDT
  channels:
    stable: 0.92.3 (4274) 177MB -
    candidate: 0.92.3 (4274) 177MB -
    beta: ↑
    edge: 0.92+devel (4265) 192MB -
  installed: 0.92.3 (4274) 177MB -

Revision history for this message
Patrick Storz (ede123) wrote :

@Ted Seeing there does not seem to be a manual fix for users do you think it's possible to get an updated Snap package with the missing dependency out? Or is it a lot of work to update?

Revision history for this message
Patrick Storz (ede123) wrote :

Ah, sorry for the noise, just noticed there actually is a newer "candidate" available.

According to https://snapcraft.io/inkscape
  sudo snap install inkscape --candidate
should do the trick

Revision history for this message
Daniel Dudas (daniel-d88) wrote :

I can save dxf without problems.

'sudo snap install inkscape --candidate' triggers a:

snap "inkscape" is already installed, see 'snap help refresh'

Bryce Harrington (bryce)
Changed in inkscape:
status: Fix Committed → Fix Released
Revision history for this message
Rgpublic (rgpublic) wrote :

Happens for me on 20.04. I don't use snap. Inkscape seems to be installed normally (i.e. via apt):

dpkg -l | grep inkscape
ii inkscape 0.92.5-1ubuntu1

Revision history for this message
Mega Volt (megavolt3) wrote :

Same thing as Rgpublic for me. Inkscape installed via apt, same version. Tried to install apt package 'scour', 'python3-scour' or python package 'scour' but all result in the following error while trying to export as Optimized SVG.

Failed to import Python module 'scour'.
Please make sure it is installed (e.g. using 'pip install scour' or 'sudo apt-get install python-scour') and try again.

Details:
No module named scour

Revision history for this message
Mega Volt (megavolt3) wrote :

Update: Forgot to mention that package 'python-scour' no longer exists in apt.
Installing inkscape with inkscape's stable PPA fixed the problem

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

Revision history for this message
Michael J Byrnes (benx0) wrote :

I'm on 20.04 as well here and I was having the same issue. It looks like Inkscape is still using python2 for stuff on the back end which is problematic as everything is moving to python3. As a work around you can install scour for python2 manually. This allowed me to export the svg files.

To install scour for python2:

1) install pip for python2 if its not already installed (https://pip.pypa.io/en/stable/installing/)
2) $ python2 -m pip install scour

Revision history for this message
Hendy Irawan (ceefour) wrote :

@bryce this can't be "Fix Released" as still happens on 20.04.1 as of 24 Sep 2020.

Revision history for this message
Ted Gould (ted) wrote : Re: [Bug 1786724] Re: Inkscape cannot save as optimized svg (python-scour error)

Works for me. Can you please include the output from:

snap info inkscape
That will show which version of the snap you're running.
On Sep 24 2020, at 11:04 am, Hendy Irawan <email address hidden> wrote:
> @bryce this can't be "Fix Released" as still happens on 20.04.1 as of 24
> Sep 2020.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1786724
>
> Title:
> Inkscape cannot save as optimized svg (python-scour error)
>
> Status in Inkscape:
> Fix Released
>
> Bug description:
> Here are the details of me trying to debug the problem. I'm not
> familiar with Python, so I don't know how else to debug the problem:
>
> Ubuntu 18.04
> Inkscape 0.92.3 (d244b95, 2018-08-02)
> $ snap install inkscape
>
> $ Inkscape save as... (optimized svg)
> Failed to import Python module 'scour'.
> Please make sure it is installed (e.g. using 'pip install scour' or 'sudo apt-get install python-scour') and try again.
> Details:
> cannot import name scourString
>
> $ python -c "import scour"
> $ echo $?
> 0
>
> $ sudo apt-get install python-scour
> Reading package lists... Done
> Building dependency tree
> Reading state information... Done
> python-scour is already the newest version (0.36-2).
>
> $ pip install scour
> Collecting scour
> Collecting six>=1.9.0 (from scour)
> Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
> Installing collected packages: six, scour
> Successfully installed scour-0.37 six-1.11.0
>
> $ find / -name "scour" -type d 2>/dev/null
> drwxr-xr-x 3 root root /usr/lib/python3/dist-packages/scour
> drwxr-xr-x 2 root root /usr/lib/python2.7/dist-packages/scour
> drwxr-xr-x 2 root root /usr/share/scour
> drwxrwxr-x 3 user user /home/user/.local/lib/python2.7/site-packages/scour
>
> $ python -c 'import sys; print(sys.path)'
> ['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/home/user/.local/lib/python2.7/site-packages', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']
>
> $ Inkscape save as... (optimized svg)
> Failed to import Python module 'scour'.
> Please make sure it is installed (e.g. using 'pip install scour' or 'sudo apt-get install python-scour') and try again.
> Details:
> cannot import name scourString
>
> $ python -c "import scour"
> $ echo $?
> 0
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/inkscape/+bug/1786724/+subscriptions
>

Revision history for this message
Thomas Landauer (thomas-landauer) wrote :

Here's my output of `snap info inkscape` on kubuntu 20.04:

name: inkscape
summary: Vector Graphics Editor
publisher: Inkscape Project (inkscape✓)
store-url: https://snapcraft.io/inkscape
contact: https://inkscape.org/en/community/mailing-lists/#inkscape-user
license: GPL-2.0+
description: |
  ...
snap-id: tIrcA87dMWthuDORCCRU0VpidK5SBVOc
channels:
  latest/stable: 1.0.1-0767f8302a-2020-10-17 2020-10-22 (8049) 145MB -
  latest/candidate: 1.0.1-3cb09a5c97-2020-12-24 2020-12-24 (8336) 146MB -
  latest/beta: ↑
  latest/edge: 1.1-dev-adf4d3b3b3-2020-12-27 2020-12-27 (8348) 359MB -

Revision history for this message
Tero Gusto (tero-gusto) wrote :

Thanks a bunch to everyone for making this wonderful software Inkscape, it's among my favorite open Source tools.

I can confirm that installing Inkscape's stable PPA (Comment #10) upgrades from version 0.94 to 1.2 and fixes the issue, and I can export perfectly Optimized SVG's.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.