TexText using Inkscape0.48

Anonymous avatarAnonymous created an issue

I tried to use TexText in Inkscape 0.48 with Windows XP and was not able to run it.

The following fault message was shown starting TexText from Inkscape: **** textext.py:55: DeprecationWarning: the md5 module is deprecated; use hashlib instead

import os, sys, tempfile, traceback, glob, re, md5, copy

Traceback (most recent call last):

File "textext.py", line 306, in <module>

raise RuntimeError("Neither pygtk nor Tkinter is available!")

RuntimeError: Neither pygtk nor Tkinter is available! ****

I used the instructions from the TexText side for Inkscape 0.46 because for later versions no insructions are available.

I have done the following steps (WinXP): Install Pstoedit 350 (Ghostscript was already installed before) Set Environment Variabel in Windows (starting pdflatex from MikTex folder and PStoedit was successfull) Install TexText 0.4.4 Try to run TexText in Inkscape failed getting the error message shown abowe.

Can anybody help me?

Best regards, Christoph

Comments (44)

  1. Anonymous

    Temporarily it can be resolved on windows by:

    1. Move C:\Program Files (x86)\Inkscape\python to C:\Program Files (x86)\Inkscape\python_backup

    2. Copy your C:\Python26 to C:\Program Files (x86)\Inkscape

    3. Rename C:\Program Files (x86)\Inkscape\Python26 to C:\Program Files (x86)\Inkscape\python

    4. Restart inkscape

    This is very dirty fix, though.

  2. jameshet

    Hi,

    I have the exact same two problems when running textext in inkscape: 1)Hashlib error and 2)Neither pygtk nor Tkinter is available!

    System is: Windows 7 32 bit, Inkscape 0.4.8, python 2.6 installed in c:\python26, miktex 2.8, pstoedit 3.50 installed and working, textext 0.4.4

    Both of your solutions have worked for me. Thanks for posting!

    For the hashlib problem, instead of the bitbucket site I found less cryptic (for me) instructions at this link

    http://pascalschulthess.de/inkscape-and-textext-deprecation-warning/

    As did you, I copied my entire c:\pthon26 directory into the python directory in the inkscape folder. Now textext works without any warnings or errors.

    Seems like there must be an easy fix to replace this "dirty fix", but I don't have the expertise to figure it out.

  3. Anonymous

    I have the same problem (windows xp). Installed Inkscape 0.48, install textext and it doesn't work. I can solve the hashlib problem following pascalschulthes link, but copying another python does not help. Now the message always "The fantastic lxml wrapper for libxml2 is required by inkex.py and therefore this extension. Please download and install the latest version from http://cheeseshop.python.org/pypi/lxml/, or install it through your package manager by a command like: sudo apt-get install python-lxml"

    Inkscape 0.47 did not show this behavior, just install 0.47, install textext and it works. For the time being, I uninstalled o.48, then reinstalled again 0.47 and textext. , very sad cannot use the latest version 0.48 with textext.

  4. jameshet

    Although not an expert at python, I can add a few more comments that might help.

    When you run the textext extension in Inkscape there is a GUI window that opens in which you type your LaTeX markup. From what I've read, when writing Python code to create such a GUI there are a number of different GUI libraries that can be used. One is Tcl/Tk and another is GTK, and there are others too. If you look at the Python code in the textext.py file you'll see that the textext GUI can be rendered using either Tcl/Tk or GTK. The code is such that it first looks for the python GTK module, pygtk. (I assume it is looking in the C:\ program files\inkscape\python folder and subfolders.) If it can't find the GTK module then it will look for the Tcl/Tk module, tkinter.

    The original error message running textext 0.4.4 in Inkscape 0.48 is, "Neither pygtk nor Tkinter is available!". I assume it's not finding the necessary modules for either Tcl/Tk or GTK in the python folder installed by Inkscape 0.48.

    Now, there may be some other python modules that are also needed, such as this "lxml wrapper" referred to in your error message.

    I'm guessing that if a python distribution with all the needed modules in the correct subfolders is copied over the python folder that comes with Inkscape then textext will work.

    The trick is having all the necessary modules in your python distribution.

    I tried copying a basic python into the inkscape\python folder and got the same "...lxml wrapper..." error that you got. By basic I mean the python installed on your system by running one of the windows installers for python 2.6 or 2.7 that can be downloaded from www.python.org. (I can't remember if I tried 2.6 or 2.7.)

    However, I also have the Enthought Python distribution installed on my system. This includes basic python 2.6 and lots of other python packages. When I copied the entire distribution from c:\python26 over into c:\program files\inkscape\python I had success. Textext worked in Inkscape 0.48.

    Apparently, the Enthought python distribution has all the necessary modules.

    I'll add that textext ran with a Tcl/Tk GUI, not the GTK GUI. Since textext.py searches for GTK first, this means the Enthought python has Tcl/TK but not GTK.

    Someone who knows a bit more about all of this could tell us exactly which files/folders/packages/modules or whatever need to be present in the \inkscape\python folder. But this is all I have to offer. Hope it helps some.

  5. Anonymous

    I had a same problem: "The fantastic lxml wrapper for libxml2 is required....."

    Fortunately the python distribution of Inkscape 0.48 itself contains that library but the python distribution already installed in windows may not. Therefore, after you copy the new python to inkscape....

    Let say you had renamed the original Inkscape python as C:\Program Files\Inkscape\python_backup

    Then just copy the lxml directory C:\Program Files\Inkscape\python_backup\Lib\site-packages\lxml to C:\Program Files\Inkscape\python\Lib\site-packages\

    That worked for me!

  6. Anonymous

    Hello,

    My system is: Windows 7 64 bit, Inkscape 0.4.8, python 2.6 installed in c:\python26, miktex 2.8, pstoedit 3.50 installed and working, textext 0.4.4

    I have use the trick here: http://pascalschulthess.de/inkscape-and-textext-deprecation-warning/

    I have also copy my python 2.6 and then copy back the lxm like in the previous post.

    After that I can open Textext in Inkscape and type my equation but when I want to validate I have this:

    Traceback (most recent call last):
    
      File "textext.py", line 937, in <module>
    
        e.affect()
    
      File "C:\Program Files (x86)\Inkscape\share\extensions\inkex.py", line 215, in affect
    
        self.effect()
    
      File "textext.py", line 369, in effect
    
        asker.ask(lambda t, p, s: self.do_convert(t, p, s,
    
      File "textext.py", line 293, in ask
    
        self.callback(self.text, self.preamble_file, self.scale_factor)
    
      File "textext.py", line 370, in <lambda>
    
        converter_cls, old_node))
    
      File "textext.py", line 388, in do_convert
    
        new_node = converter.convert(text, preamble_file, scale_factor)
    
      File "textext.py", line 756, in convert
    
        new_node = self.svg_to_group()
    
      File "textext.py", line 778, in svg_to_group
    
        tree = etree.parse(self.tmp('svg'))
    
      File "lxml.etree.pyx", line 2692, in lxml.etree.parse (src/lxml/lxml.etree.c:49594)
    
      File "parser.pxi", line 1500, in lxml.etree._parseDocument (src/lxml/lxml.etree.c:71364)
    
      File "parser.pxi", line 1529, in lxml.etree._parseDocumentFromURL (src/lxml/lxml.etree.c:71647)
    
      File "parser.pxi", line 1429, in lxml.etree._parseDocFromFile (src/lxml/lxml.etree.c:70742)
    
      File "parser.pxi", line 975, in lxml.etree._BaseParser._parseDocFromFile (src/lxml/lxml.etree.c:67740)
    
      File "parser.pxi", line 539, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:63824)
    
      File "parser.pxi", line 625, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:64745)
    
      File "parser.pxi", line 565, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:64088)
    
    lxml.etree.XMLSyntaxError: Document is empty, line 1, column 1
    

    And nothing is printed.

    What should I do?

  7. Anonymous

    Dear Anonymous; check your path to pdflatex. This was the error I had. Now it works. cheers. LT

  8. Anonymous

    i am having the same problem as described 3 posts above. i've tried different python versions and so on.

    Plesae, does anybody has an idea how to fix the e.affect.... error? I've worked myselft through about 10 different errors today and want this thing to work already!

  9. Anonymous

    I do not really understand how this should help the problem described above error. It adds another extension (which does not work either) and changes nothing about the problem mentioned by #8

  10. Anonymous

    Hey.

    Have exactly the same problem as in #8.

    My system: Windows 7 64 bit, Inkscape 0.4.8, python 2.6.6 installed in c:\python26 and copied to inkscape, miktex 2.9, pstoedit 3.50 installed and working, textext 0.4.4.

    I had all the problems described in this thread. Hope there is someone out there with the next solution!

  11. Anonymous

    I hame problem than #8 with Windows 7 64bits. It's related to the 32/64 bits stuff, because this not happen with W7 32bits..

  12. Anonymous

    For Extensions -> Render -> LaTeX formula: Both TeXLive 2010 and MikTex 2.8 work. Install Inkscape 0.47, ghostscript 8.71, ghostview 4.9, pstoedit 3.50.

    For Extensions -> Tex Text: TeXLive does *NOT* work, only MikTex 2.8, probably and 2.9. Install Inkscape 0.47, ghostscript 8.71, ghostview 4.9, pstoedit 3.50, textext 0.4.4.

    TeXLive/MikTex, ghostscript, ghostview and pstoedit MUST be added to PATH, or nothing will work.

    This is response to the long comment around 10 comments above.

    Tested on desktop machine and two laptops, Windows XP SP3.

  13. Anonymous

    Forgot something. If Extensions -> Render -> LaTeX formula gives an error, change TEMP and TMP variables to C:\Temp or something less than 8 letters, sometimes it gives an error (sometimes it works fine).

    Variables PATH, TEMP, TMP, etc are in Control Panel -> System -> Advanced -> Environment variables.

    If you want to set GTK (GIMP, Inkscape, etc) to a specific language, add a variable LANG and set it to C (ANSI - English) or some other language.

  14. Anonymous

    All the information gathered within this thread was very valuable. Now everything works properly.

    Thank you!

  15. Anonymous

    I had the similar problem. My configuration was : Windows Vista Home Premium (64bit) Inkscape 0.48 pstoedit 3.5 textext 0.4.4

    I performed the instructions of Wiki macro error: User '#15' not found. (installing python 2.6, and pygtk, pyobject, and pycairo. + doing the copy operation). Then I followed the instructions on the following website.

    http://pascalschulthess.de/inkscape-and-textext-deprecation-warning/

    It worked all fine after these two fixes. I get no warnings.

  16. Anonymous

    ---REPEATING PREVIOUS POST due to bad link--- I had the similar problem. My configuration was : Windows Vista Home Premium (64bit) Inkscape 0.48, pstoedit 3.5, textext 0.4.4.

    I performed the instructions of #15 (installing python 2.6, and pygtk, pyobject, and pycairo. + doing the copy operation). Then I followed the instructions on the following website.

    http://pascalschulthess.de/inkscape-and-textext-deprecation-warning/

    It worked all fine after these two fixes. I get no warnings.

  17. Anonymous

    Hi all

    For Win 7, Inkscape 0.48 and textext 0.4.4 the following process worked for me (thanks to all previous contributions by various authors!). See web pages at end.

    Configuration Win 7, MikTex 2.9, Textext 0.4.4:

    1. Install the Latex distribution, e.g. MikTex 2.9

    2. Install Inkscape (inkscape-0.48.0-1.exe)

    3. Install pstoedit (pstoeditsetup350.exe)

    4. Install Ghostscript (gs900w32.exe)

    5. Install TeXtext add-in for Inkscape (textext-0.4.4.exe)

    6. Copy contents of libxml2-2.7.7.win32.zip file to C:\Program Files\Inkscape\libxml2-2.7.7 folder (I am not sure this is needed, but installed anyway)

    7. Open the file site-packages.zip and copy the contents to the C:\Program Files\Inkscape\python\Lib folder (it will overwrite some files -> OK!)

    8. Install GraphicsMagick-1.3.12-Q8-windows-dll.exe and copy the CORE_RL_magick_.dll and CORE_RL_Magick++_.dll files into your pstoedit folder C:\Program Files\pstoedit

    9. Edit the file C:\Program Files\Inkscape\share\extensions\textext.py

    -> change line 55 to "import os, sys, tempfile, traceback, glob, re, copy" without the quotes

    -> add line 56 "import hashlib" without the quotes

    Ensure that the PATH environment variable contains C:\Program Files\Inkscape\libxml2-2.7.7.win32;c:\program files\graphicsmagick-1.3.12-q8;C:\Program Files\MiKTeX 2.9\miktex\bin.

    In Inkscape, access the TeX text feature in Extensions -> Tex Text

    Source of files:

    MikTeX: http://www.miktex.org

    Inkscape: http://www.inkscape.org

    Pstoedit: http://www.pstoedit.net/pstoedit

    Ghostscript: http://pages.cs.wisc.edu/~ghost/

    Textext: http://pav.iki.fi/software/textext/

    Libxml2: http://www.zlatkovic.com/libxml.en.html

    Site-packages.zip: http://dgleich.wordpress.com/2010/10/26/fixing-textext-on-inkscape-for-windows/

    Graphicsmagick: http://sourceforge.net/projects/graphicsmagick/files/

    Best regards Terry Frangakis

  18. Anonymous

    Reply to #18 about TexText not working with TeX Live on Windows:

    I experienced this also, and in my case it's a security feature of TeX Live. Basically latex won't write its output anywhere besides the current working directory so the call 'pdflatex some-path-here
    tmp.tex -some-options-here' fails to create tmp.pdf. The solution is simply to modify textext.py to run pdflatex in the correct working directory.

    The following modifications should resolve this issue (note that this should be done after applying the instructions from http://laconsigna.wordpress.com/2010/11/13/fixing-textext-on-inkscape-0-48/)

    Change line 581 to read: def exec_command(cmd, ok_return_value=0, combine_error=False, wd=None): Add a comma at the end of line 590. Add after line 590: cwd=wd) Change line 729 to read: exec_command(['pdflatex', self.tmp_base,'.tex'] + latexOpts, wd=self.tmp_path)

    Basically I added one optional input variable to specify the current working directory when executing a command, so we change to the created temporary directory first then run pdflatex.

  19. Anonymous

    As a clarification to the above post, lines 587 to 591 of textext.py should read (after the change):

                p = subprocess.Popen(cmd,
                                     stdout=subprocess.PIPE,
                                     stderr=subprocess.PIPE,
                                     stdin=subprocess.PIPE,
                                     cwd=wd)
    
  20. Anonymous

    I followed every step laid out by #27 and #30 to the letter, but I still get the following error:

    The fantastic lxml wrapper for libxml2 is required by inkex.py and therefore this extension. Please download and install the latest version from http://cheeseshop.python.org/pypi/lxml/, or install it through your package manager by a command like: sudo apt-get install python-lxml

    The latest version is there, and I have made sure the PATH variable was set to

    C:\Program Files\Inkscape\libxml2-2.7.7.win32;C:\program files\GraphicsMagick-1.3.12-Q8;C:\Program Files\MiKTeX 2.9\miktex\bin

    And it still wouldn't recognize that I have the libmxl2. Not sure what to do now. Any help?

  21. Anonymous

    I have done all of these steps and I get this error:

    Traceback (most recent call last): File "textext.py", line 211, in cb_ok self.callback(self.text, self.preamble_file, self.scale_factor) File "textext.py", line 370, in <lambda> converter_cls, old_node)) File "textext.py", line 388, in do_convert new_node = converter.convert(text, preamble_file, scale_factor) File "textext.py", line 756, in convert new_node = self.svg_to_group() File "textext.py", line 778, in svg_to_group tree = etree.parse(self.tmp('svg')) File "lxml.etree.pyx", line 2692, in lxml.etree.parse (src/lxml/lxml.etree.c:49594) File "parser.pxi", line 1500, in lxml.etree._parseDocument (src/lxml/lxml.etree.c:71364) File "parser.pxi", line 1529, in lxml.etree._parseDocumentFromURL (src/lxml/lxml.etree.c:71647) File "parser.pxi", line 1429, in lxml.etree._parseDocFromFile (src/lxml/lxml.etree.c:70742) File "parser.pxi", line 975, in lxml.etree._BaseParser._parseDocFromFile (src/lxml/lxml.etree.c:67740) File "parser.pxi", line 539, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:63824) File "parser.pxi", line 625, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:64745) File "parser.pxi", line 565, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:64088) XMLSyntaxError: Document is empty, line 1, column 1

    How should I fix it?

  22. Anonymous

    If you get the "XMLSyntaxError: Document is empty, line 1, column 1" (like in comments #8 and #33 above) on Windows 7 64bit then this is most likely due to pstoedit not finding ghostscript.

    Most likely you have installed a 64bit version of ghostscript but pstoedit is searching for gswin32c (the 32bit version). You can check that by typing "pstoedit -gstest" into a cmd.exe window. If it throws up an error then this is probably the issue. De-install your 64bit ghostscript (and gsview if you have that) and replace them by the 32bit versions. Then run the "pstoedit -gstest" command again to check that it has fixed the error.

    Now textext should work (provided you have fixed the pygtk issue mentioned above).

    By the way: if you install only the basic pstoedit install then there is no need for graphicsmagick. Also, libxml2 is definitely not needed if you use the pygtk provided by David Gleich (see comment #15 above). In that case you also don't need the additional full python install and you don't need to copy lxml. The md5 deprecated warning is independent of all that and needs to be fixed by editing textext.py if it annoys you (see comment #8 above).

  23. Anonymous

    Hi,

    I get this error:

    The fantastic lxml wrapper for libxml2 is required by inkex.py and therefore this extension. Please download and install the latest version from http://cheeseshop.python.org/pypi/lxml/, or install it through your package manager by a command like: sudo apt-get install python-lxml

    On my computer I have: - Windows 7 - Miktex 2.9 - GraphicsMagick-1.3.12-Q16 - gsview32.exe version 4.9 - Ghostscript 9.02

    I followed the steps of post #6. Then I have checked on cmd pdflatex.exe and pstoedit.exe, both work fine. I have also add the follwing line to my path:

    C:\Program Files (x86)\Inkscape\python\Lib\site-packages\lxml;C:\Program Files (x86)\pstoedit;c:\program files (x86)\graphicsmagick-1.3.12-q16;C:\Program Files (x86)\MiKTeX 2.9\miktex\bin

    But textext is still not working! Could you help me please?

  24. Anonymous

    (Same author of post #35)

    I forgot to say that I have installed pstoeditsetup350.exe. First I tried pstoeditsetup_x64.exe but it does not work for me.

  25. Anonymous

    I have a issue with 0.48 inkscape and textext 0.44. I did all the modification, I can write the equations but I cannot compile the equations. Error message:

    Traceback (most recent call last): File “textext.py”, line 212, in cb_ok self.callback(self.text, self.preamble_file, self.scale_factor) File “textext.py”, line 371, in converter_cls, old_node)) File “textext.py”, line 389, in do_convert new_node = converter.convert(text, preamble_file, scale_factor) File “textext.py”, line 753, in convert self.pdf_to_svg() File “textext.py”, line 767, in pdf_to_svg raise NotImplementedError NotImplementedError****

    does anyone else have the similar problem? and how to solve it?

  26. Anonymous

    GUYS: seriously, just follow the suggestion of post #29

    I was having exactly the same problems and now all is running smooth!!!

  27. Anonymous

    There is only one good way to solve this problem. Uninstall windows and use a proper operating system. With Linux it works flawlessly...

  28. Anonymous

    That is a stupid solution, that is like telling a linux user trying to instal Office 2007 through WINE they should just get Windows. I rather have someone tell me how to use WINE and not get all superior about their operating system.

  29. Anonymous

    The main problem is that inkscape installs its own version of python. To work around this you need to make a hard link (linux style in windows) within the inscape directory pointing to your install of python.

    1) Change C:\...\Inkscape\python to C:\...\Inkscape\python_bak

    2) Make hard link to your python install with MKLINK command example: MKLINK /H /J C:\...\Inkscape\python C:\Python27

    Now Inkscape will use your main python installation. You will need to have any modules that it complains installed such as PyGTK for Microsoft Windows using the all-in-one installer (google it to find download link) lxml egg: http://pypi.python.org/pypi/lxml/2.3

    If you get any other module/import errors, just google the module, download and install to your default python directory. (if you are really lazy, just get pythonxy and set it to install everything and you will get every module out there).

    Technetium

  30. Anonymous

    One more thing, make sure to edit your windows PATH environmental variable to include pstoedit.exe parent directory in the path. You may also want to include the Ghostscript (gswin32.exe) in the path as well (but this is in the original directions). So you should be able to go to a comand prompt (run cmd.exe) and type the following and get a response from windows: pdflatex latex gswin32 pstoedit

    Good luck

    Technetium

  31. Anonymous

    Brilliant! #80 solved my problems with 'directory not empty' -

    - however, I had some problems getting it to work... primarily because I didn't copy and paste, I attempted to manually insert the changes, not noticing a little comma in: self.tmp_base,('.tex')

    copy exactly!

  32. Anonymous

    Thank you very much. I could completely solve the problem in using TexText with TexLive following the procedure addressed (#30).

  33. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.