Inkscape 0.92.2, win64: install additional Python modules

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Inkscape 0.92.2, win64: install additional Python modules

Sebastian Kraft
Hi,

I have written an Inkscape extension
(https://github.com/seebk/LaTeXText) that requires additional python
modules (PyGObject). In previous Inkscape versions on windows, I could
simply install the PyGObject module into the
Inkscape/[...]/python/site-packages subfolder from the official
PyGObject windows builds. However, since 0.92.2 it seems that the
windows build and python version changed and is incompatible to the
PyGObject windows builds.

What would be the recommended way to add modules to the Python distro
bundled with Inkscape on windows?

I tried to use the python module from msys2/mingw64 but did not succeed.
The import of gi fails, it misses some DLLs. Unfortunately, the error
message does not give detailed information what exactly is missing.

Thanks for your help!

Sebastian

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Inkscape-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Reply | Threaded
Open this post in threaded view
|

Re: Inkscape 0.92.2, win64: install additional Python modules

alvinpenner
the python location has moved, not sure when.
the directory C:\Program Files (x86)\Inkscape\python still exists, but is
empty, should probably be deleted.

for a 32 bit build, the current Python location is:
C:\Program Files (x86)\Inkscape\lib\python2.7\site-packages

have you tried installing into this directory, or the 64 bit equivalent?



--
Sent from: http://inkscape.13.x6.nabble.com/Inkscape-Dev-f2781808.html

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Inkscape-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Reply | Threaded
Open this post in threaded view
|

Re: Inkscape 0.92.2, win64: install additional Python modules

Sebastian Kraft


On 27.10.2017 15:18, alvinpenner wrote:
> the python location has moved, not sure when.
> the directory C:\Program Files (x86)\Inkscape\python still exists, but is
> empty, should probably be deleted.
>
> for a 32 bit build, the current Python location is:
> C:\Program Files (x86)\Inkscape\lib\python2.7\site-packages
>
> have you tried installing into this directory, or the 64 bit equivalent?
>

Yes, I installed it to lib\python2.7\site-packages.

Maybe the problem is that the binaries are not compatible? The current
msys2 python and python-gobject are built with GCC 7, but the Inkscape
bundled Python distro is build with GCC 6.

My extension installer does the following:

1) Copy the .py/inx files to \Inkscape\share\extensions

2) Copy the required packages from msys64\lib\python2.7\site-packages to
lib\python2.7\site-packages

3) Copy the missing additional DLLs from msys64\bin to Inkscape\


--
Dipl.-Ing. Sebastian Kraft

Helmut-Schmidt-University
Department of Signal Processing
Holstenhofweg 85, 22043 Hamburg
Germany

Phone: +49 40 6541-2659

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Inkscape-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Reply | Threaded
Open this post in threaded view
|

Re: Inkscape 0.92.2, win64: install additional Python modules

Eduard Braun
In reply to this post by Sebastian Kraft

Hi Sebastian,

it should work *if* you install the correct package(s).

  • First of all make sure to download the package for python2 (not python3!) as this is what ships with Inkscape.
  • Secondly you'll need to figure out what package(s) you actually need for your extension (I never used PyGObject, but isn't it gtk3-only? If that's the case you might even need to download gtk3...)
Dependencies of a package are usually listed in the ".PKGINFO" file, so that might be worth a look.

Relevant packages will be in
http://repo.msys2.org/mingw/x86_64/

Once you tell us what the actual requirements for your extension are I can try to help you with the MSYS2-part. Usually it's pretty straightforward though once the former part is clear..

Best Regards,
Eduard


Am 27.10.2017 um 11:36 schrieb Sebastian Kraft:
Hi,

I have written an Inkscape extension (https://github.com/seebk/LaTeXText) that requires additional python modules (PyGObject). In previous Inkscape versions on windows, I could simply install the PyGObject module into the Inkscape/[...]/python/site-packages subfolder from the official PyGObject windows builds. However, since 0.92.2 it seems that the windows build and python version changed and is incompatible to the PyGObject windows builds.

What would be the recommended way to add modules to the Python distro bundled with Inkscape on windows?

I tried to use the python module from msys2/mingw64 but did not succeed. The import of gi fails, it misses some DLLs. Unfortunately, the error message does not give detailed information what exactly is missing.

Thanks for your help!

Sebastian

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Inkscape-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-devel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Inkscape-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Reply | Threaded
Open this post in threaded view
|

Re: Inkscape 0.92.2, win64: install additional Python modules

Sebastian Kraft
Hi Eduard,

> Dependencies of a package are usually listed in the ".PKGINFO" file, so
> that might be worth a look.
>
> Relevant packages will be in
> http://repo.msys2.org/mingw/x86_64/
>

Thanks, this helped me to get a huge step closer to solvemy problems. I
looked up the old versions of the required packages in above link and
could find everything I needed. Now "import gi" in my extension will
work. What ist not yet working is

from gi.repository import Gtk, Gdk

This fails with

Warning: failed to load shared library libgdk-3-0.dll referenced by
typelib: libgdk-3-0.dll module not found

The package mingw-w64-x86_64-gtk3-3.22.9-1 was installed and
libgdk-3-0.dll is in Inkscape\. Not sure what is still missing here...

BTW: It really is a major problem of MSYS2 that there are no
distributions with a fixed set of library versions :( Or is there any
easy solution to reproduce a certain build environment?

E.g. if Inkscape was built in August 2017 I can only manually collect
the required packages by date to get binary compatible libraries. The
next point release of Inkscape might use different packages of MSYS2 and
I have to start all over again. To make it even worse, there is not real
archive of previous MSYS2 packages, so it is not guaranteed that I can
get the matching libraries a few months after the Inkscape build.

Sebastian

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Inkscape-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Reply | Threaded
Open this post in threaded view
|

Re: Inkscape 0.92.2, win64: install additional Python modules

Eduard Braun
Am 27.10.2017 um 16:57 schrieb Sebastian Kraft:
Warning: failed to load shared library libgdk-3-0.dll referenced by typelib: libgdk-3-0.dll module not found

The package mingw-w64-x86_64-gtk3-3.22.9-1 was installed and libgdk-3-0.dll is in Inkscape\. Not sure what is still missing here...
Latest version is actually
http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-gtk3-3.22.24-1-any.pkg.tar.xz
but it should not really matter..

What *could* be happening is that you hit one of the many relocation issues that are one of the major annoyances when using *nix software on Windows.

Two things you could try:
  1. Add the inkscape root directory to you search path (sometimes modules expect it to be found there...)
  2. Copy the gtk dlls to an inkscape/bin subfolder to get a UNIXoid directory structure and see if it helps.

Also helpful:
http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-ntldd-git-r15.e7622f6-2-any.pkg.tar.xz
(works like Linux ldd but tweaked for mingw-w64; allows you to check what dlls are missing and which dlls are loaded from where)


BTW: It really is a major problem of MSYS2 that there are no distributions with a fixed set of library versions :( Or is there any easy solution to reproduce a certain build environment?

E.g. if Inkscape was built in August 2017 I can only manually collect the required packages by date to get binary compatible libraries. The next point release of Inkscape might use different packages of MSYS2 and I have to start all over again. To make it even worse, there is not real archive of previous MSYS2 packages, so it is not guaranteed that I can get the matching libraries a few months after the Inkscape build.
Indeed, reproducing builds with specific library versions is hard. It's basically the price we have to pay for up-to-date binary builds. There's one trick one can apply: Storing the pacman package database at the time of the build allows to "update" an MSYS2 distribution with the packages that were current at that time (for 0.92.2 I have them stored on my harddisk, if you like I could upload them somewhere). There are no "stable snapshots" or similar though, so typically it's best to just go with the rolling release or download a "matching" version according to modification date.

Good news is that libraries are usually ABI compatible (so few versions back or forth won't matter). Only exception are libraries like poppler/icu which carry a version number in the file name and therefore always require dependent libraries to be rebuilt.

As for a guarantee of library availability: We obviously have all the official mirrors, see
https://github.com/Alexpux/MSYS2-packages/blob/master/pacman-mirrors/mirrorlist.mingw64
and as far as I'm aware old versions are currently stored indefinitely. Beyond that we don't have any securities but it did not seem viable to create a mirror just for the Inkscape project (which might be an alternative but requires a server with enough storage space and somebody willing to maintain the repository).

Regards,
Eduard

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Inkscape-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Reply | Threaded
Open this post in threaded view
|

Re: Inkscape 0.92.2, win64: install additional Python modules

Sebastian Kraft
Am 27.10.2017 um 17:38 schrieb Eduard Braun:
 > Am 27.10.2017 um 16:57 schrieb Sebastian Kraft:
 >> Warning: failed to load shared library libgdk-3-0.dll referenced by
 >> typelib: libgdk-3-0.dll module not found
 >>
 >> The package mingw-w64-x86_64-gtk3-3.22.9-1 was installed and
 >> libgdk-3-0.dll is in Inkscape\. Not sure what is still missinghere...
 > Latest version is actually
 > but it should not really matter..
 >

I think it doesn't matter as long as it is compiled with GCC 6. MSYS
moved to GCC 7 after June 30, so I have to stick with libraries compiled
before this date.

 > Also helpful:
 > http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-ntldd-
 > (works like Linux ldd but tweaked for mingw-w64; allows you to check
 > what dlls are missing and which dlls are loaded from where)
 >

Now I used the Dependency Walker and saw that I missed the libepoxy DLL.
Really hard to manually keep track of all nested dependencies. Finally
it is working!

Thanks,
Sebastian

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Inkscape-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Reply | Threaded
Open this post in threaded view
|

Re: Inkscape 0.92.2, win64: install additional Python modules

Eduard Braun
Am 28.10.2017 um 12:06 schrieb Sebastian Kraft:

> Am 27.10.2017 um 17:38 schrieb Eduard Braun:
> > Am 27.10.2017 um 16:57 schrieb Sebastian Kraft:
> >> Warning: failed to load shared library libgdk-3-0.dll referenced by
> >> typelib: libgdk-3-0.dll module not found
> >>
> >> The package mingw-w64-x86_64-gtk3-3.22.9-1 was installed and
> >> libgdk-3-0.dll is in Inkscape\. Not sure what is still missinghere...
> > Latest version is actually
> > but it should not really matter..
> >
>
> I think it doesn't matter as long as it is compiled with GCC 6. MSYS
> moved to GCC 7 after June 30, so I have to stick with libraries
> compiled before this date.
As I told you, they seem to be ABI compatible...
I did not have issues with my Inkscape builds around the date of the
switch and not all dependencies were rebuilt with GCC7.

>
> > Also helpful:
> > http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-ntldd-
> > (works like Linux ldd but tweaked for mingw-w64; allows you to check
> > what dlls are missing and which dlls are loaded from where)
> >
>
> Now I used the Dependency Walker and saw that I missed the libepoxy
> DLL. Really hard to manually keep track of all nested dependencies.
> Finally it is working!
You could use
https://gitlab.com/inkscape/inkscape/blob/master/buildtools/msys2checkdeps.py
I designed it specifically for the purpose of tracking down missing
dependencies and it will do so recursively.

It uses ntldd internally though (I suggested it before for a reason...)
so you still need to follow my previous advice.

Usage to scan the whole Inkscape directory: "msys2checkdeps.py check
inkscape"
(you can ignore the "wininst" parts)

>
> Thanks,
> Sebastian
>
> ------------------------------------------------------------------------------
>
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Inkscape-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/inkscape-devel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Inkscape-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Reply | Threaded
Open this post in threaded view
|

Re: Inkscape 0.92.2, win64: install additional Python modules

Tobias Ellinghaus
Am Samstag, 28. Oktober 2017, 13:34:57 CEST schrieb Eduard Braun:
> Am 28.10.2017 um 12:06 schrieb Sebastian Kraft:
> > Am 27.10.2017 um 17:38 schrieb Eduard Braun:
> > > Am 27.10.2017 um 16:57 schrieb Sebastian Kraft:

[...]

> > > Also helpful:
> > > http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-ntldd-> > > (works like Linux ldd but tweaked for mingw-w64; allows you to check
> > > what dlls are missing and which dlls are loaded from where)
> >
> > Now I used the Dependency Walker and saw that I missed the libepoxy
> > DLL. Really hard to manually keep track of all nested dependencies.
> > Finally it is working!
>
> You could use
> https://gitlab.com/inkscape/inkscape/blob/master/buildtools/msys2checkdeps.p
> y I designed it specifically for the purpose of tracking down missing
> dependencies and it will do so recursively.
>
> It uses ntldd internally though (I suggested it before for a reason...)
> so you still need to follow my previous advice.
>
> Usage to scan the whole Inkscape directory: "msys2checkdeps.py check
> inkscape"
> (you can ignore the "wininst" parts)
An alternative to get all dependencies recursively:

cygcheck.exe /path/to/program.exe

> > Thanks,
> > Sebastian

Tobias
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Inkscape-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-devel

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Inkscape 0.92.2, win64: install additional Python modules

Eduard Braun
Am 28.10.2017 um 14:32 schrieb Tobias Ellinghaus:
> An alternative to get all dependencies recursively:
>
> cygcheck.exe /path/to/program.exe

cygcheck works very nice in principle, however in my experiments it
failed to show dependencies for 32-bit executables (I use 64-bit MSYS2,
so it might be caused by that).



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Inkscape-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/inkscape-devel