0

My question might not be very concise. Please forgive me for that as I go through my desperate attempts to fix my problem. I might even sound like an idiot at times.

I'm using Inkscape v0.92.4 on a Windows 10 Pro 32-bit computer .

The problem arises when I try to access the "Voronoi Diagram" Extension in Inkscape. As soon as I click apply, this arises:

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

Technical details:
cannot import name etree

It might look like an old, maybe already resolved problem, but looks like all odds are stacked against me.

Attempt 1:

Googling the problem landed me here. Following that I tried adding and modifying the "PYTHONHOME" variable from the Environment Variables option under the Advanced System Settings option of the System settings in Control Panel. As expected, no luck.

Attempt 2:

The second result from the Google Search landed me on a Stack Overflow site. Accordingly, I uninstalled both Inkscape and Python, re-installed Python v3.7.3 (although the guy over there installed a 2.x version of Python), installed lxml wrapper through PIP:

pip install lxml

then re-installed Inkscape while keeping the "Python 2.x" checkbox unchecked during installation. Looks like this time they DID recognize the "lxml wrapper" that I installed, but came up with another error:

Fatal Python error: initfsencoding: unable to load the file system codec
  File "F:\Inkscape\python\Lib\encodings\__init__.py", line 123
    raise CodecRegistryError,\
                            ^
SyntaxError: invalid syntax

Current thread 0x00000940 (most recent call first):

So yeah, no luck again.

Attempt 3:

Pondering on the aforementioned error, I hypothesized that this error came up because Inkscape does not support Python 3.x, so while doing more research on that (looking up "is inkscape compatible with Python 3"), I came across another Stack Overflow article and I thought the problem to be somewhat similar to mine. However, I STILL did not install Python 2.x and tried the same thing but linking back to the Python 3.x interpreter. (I suggest you to visit the link, but if you are in a hurry, well here's what I did: 1. Headed to C:\Users\N\AppData\Roaming\inkscape\prefereces.xml 2. Looked up for a group with an id ëxtensions and added ' python-interpreter="C:\Users\Sirajuddin\AppData\Local\Programs\Python\Python37-32\python.exe" ')

Didn't work (totally expected). Then I tried linking towards the Python directory in the Inkscape directory itself (F:\Inkscape\python). Turns out this time they went back to the very basic "lxml wrapper needed" problem. So I copied the two folders from my Python directory (C:\Users\N\AppData\Local\Programs\Python\Python37-32\Lib\site-packages) and pasted it in F:\Inkscape\python\Lib\site-packages. Guess what, still no luck.

Attempt 4 (The Last Attempt):

This time I finally installed Python v2.7.16 (however, I insisted to keep the Python 3.x version as that's the version I learned to code with and I work with). Going through the same steps as Attempt no.3, now I linked towards the my Python 2.x directory. However, Inkscape again returns to the very basic "lxml wrapper needed" problem. I tested with the Command Prompt and I COULD use both Python 3.x and 2.x separately given that I link to their respective directories. However, if I try to install lxml wrapper through PIP in the Python 2.x directory (hoping to install it again for Python 2.x), it shows that "Requirement already satisfied". I tested in the Python 2.x interpreter whether the lxml wrapper is there or not by:

C:> python
>>> import lxml

and returned with no errors, meaning its there. However, that's not what Inkscape says (Inkscape still says I don't have the lxml wrapper even if I link to the Python 2.x directory). Then I tried to copy the two folders for lxml wrapper from my Python 3.x directory and paste them on my Python 2.x directory, still no luck.

So I went back to the link Inkscape provided in the error message, and downloaded the .whl file applicable for the Python 2.x version, and then pip install "lxml-4.3.4-cp27-cp27m-win32.whl" (pip install the file). However, the Command Prompt returns with this error:

 Requirement 'lxml-4.3.4-cp27-cp27m-win32.whl' looks like a filename, but the file does not exist
lxml-4.3.4-cp27-cp27m-win32.whl is not a supported wheel on this platform.

This now leaves me with one more option that I'm not sure whether it will work or not - uninstall Python 3.x and 2.x and then re-install Python 2.x only, more like forcing me to leave Python 3.x.

I know my question is too long and hard to follow, but I told all that I tried throughout the whole night without sleeping for a second. Could you please try to come up with a solution of my problem? I'm desperate for help as there are many other Extensions and some functionalities that I wouldn't be able to use without this fix. I will be forever grateful to the people who would try to solve my problem at the cost of their valuable time.

UPDATE:

  1. I uninstalled python 3.x, installed pip and lmxl wrapper for python 2.x. Still didn't work. However, following the attempts taken at attempt 3, if I link that with the Python Interpreter 2.X, it does not show the error message. However, the "Please Wait" window vanishes just after 1 sec of clicking Apply, and nothing happens. So yeah, still doesn't work

1 Answers1

1

Uninstall Inkscape.

After uninstalling, delete all files that belong to Inkscape, there are probably some left. This is the most important part.

Undo all changes to your Python environment variables. Fix your preferences file back to its original state or rename it.

The error you see is most likely due to not following the update instructions on the Inkscape website, and updating from a different executable type.

msi cannot be installed over exe. exe cannot be installed over msi. They do not replace each other. One older Inkscape version didn't uninstall all Python files when running the uninstaller. Any of these could be the reason.

The fix is always to remove Inkscape completely, then reinstall.

Inkscape 0.92.4 comes with the lxml python module on Windows. It does not need to be installed.

Moini
  • 1,239
  • 9
  • 10
  • 1
    I did all of these. I always follow site instructions and I downloaded the .msi file. However, I got rid of the problem by uninstalling python 3.x, installing 2.x, and then deleting Inkscape’s “Python” directory or folder manually. Now, can I go back or also install 3.x, or I am stuck with python 2.x? – Abdullah Omar Nasseef Jul 05 '19 at 17:00
  • 1
    Something must be very wrong in your installation. Your system Python should never even be used by Inkscape, which comes with its own Python. I would suggest you join the Inkscape user chat channel at chat.inkscape.org to properly debug the issue, instead of fiddling with your Python installations. Inkscape 0.92.4 needs Python 2. The next versions will also work with Python 3. – Moini Jul 05 '19 at 21:42