deeplook / svglib

Read SVG files and convert them to other formats.
GNU Lesser General Public License v3.0
315 stars 80 forks source link

Demo code fails on fresh install. #267

Closed patrick-brian-mooney closed 3 years ago

patrick-brian-mooney commented 3 years ago

I'm unable to follow through the first snippet of sample code here after a fresh install (Python 3.5, Linux Mint 20 x64):

$ python3.5 -m pip install svglib
Collecting svglib
  Downloading svglib-1.0.1.tar.gz (900 kB)
     |████████████████████████████████| 900 kB 2.1 MB/s 
Requirement already satisfied: reportlab in /usr/lib/python3/dist-packages (from svglib) (3.5.34)
Requirement already satisfied: lxml in ./.local/lib/python3.5/site-packages (from svglib) (4.3.0)
Collecting tinycss2>=0.6.0
  Downloading tinycss2-1.0.2-py3-none-any.whl (61 kB)
     |████████████████████████████████| 61 kB 376 kB/s 
Collecting cssselect2>=0.2.0
  Downloading cssselect2-0.3.0-py3-none-any.whl (31 kB)
Requirement already satisfied: webencodings>=0.4 in /usr/lib/python3/dist-packages (from tinycss2>=0.6.0->svglib) (0.5.1)
Requirement already satisfied: setuptools>=39.2.0 in ./.local/lib/python3.5/site-packages (from tinycss2>=0.6.0->svglib) (45.2.0)
Building wheels for collected packages: svglib
  Building wheel for svglib (setup.py) ... done
  Created wheel for svglib: filename=svglib-1.0.1-py3-none-any.whl size=24365 sha256=cba319d153f51f47ab6eda101ba5336a7e9c1f79434f99c5bcfa17a4f65c51f1
  Stored in directory: /home/patrick/.cache/pip/wheels/03/3d/e5/0d9ad640e61e531215a439253728bad8cabe655ba58054b7d1
Successfully built svglib
Installing collected packages: tinycss2, cssselect2, svglib
Successfully installed cssselect2-0.3.0 svglib-1.0.1 tinycss2-1.0.2
14:44:34 patrick@liniscious ~$ python3.5
Python 3.5.10 (default, Sep  8 2020, 23:19:44) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from svglib.svglib import svg2rlg
>>> from reportlab.graphics import renderPDF, renderPM
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/reportlab/graphics/renderPM.py", line 28, in <module>
    from reportlab.graphics import _renderPM
ImportError: cannot import name '_renderPM'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/reportlab/graphics/renderPM.py", line 33, in <module>
    https://pairlist2.pair.net/mailman/listinfo/reportlab-users""")
ImportError: No module named _renderPM
it may be badly or not installed!
You may need to install development tools
or seek advice at the users list see
https://pairlist2.pair.net/mailman/listinfo/reportlab-users

Surely it should be possible, with pip, to install all supporting libraries correctly?

claudep commented 3 years ago

Reportlab dropped support for Python 3.5 recently: https://hg.reportlab.com/hg-public/reportlab/rev/0d3835d23cdc You should install Reportlab 3.5.54 or older.

And you should think about upgrading Python sooner or later, as Python 3.5 is no longer an officially-supported version. svglib might also drop it soon.

patrick-brian-mooney commented 3 years ago

Thanks. I was trying to maintain Python 3.5 compatibility in an existing project so as not to force users into upgrading, but I guess that that's not plausible here.