Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with bundling scikits-image / skimage #583

Closed
pyinstaller-tickets-migration opened this issue Oct 18, 2014 · 3 comments
Closed
Assignees
Labels
kind:support version:develop Related to the current development branch

Comments

@pyinstaller-tickets-migration

Original date: 2012/07/30
Original reporter: *nordenmark AND gmail DOT COOM *

Hi, I'm trying to bundle an application that includes scikits-image among other packages and I've discovered a problem. skimage.io._plugins/plugin.py is looking for its plugins in the following manner:

pd = os.path.dirname(__file__)
ini = glob(os.path.join(pd, '*.ini'))

However, __file__ returns

/Users/nicklas/Downloads/pyinstaller/sasdm/dist/sasdm/sasdm?45256/skimage/io/_plugins/plugin.pyc

which actually isn't an existing directory.

So why is it looking in that particular directory and how can I make sure scikits-image can read the plugins from within the bundled application?

Regards,

Nicklas

@pyinstaller-tickets-migration pyinstaller-tickets-migration added kind:support version:develop Related to the current development branch labels Oct 18, 2014
@the-vindicar
Copy link

Any luck on dealing with this one so far?

@htgoebel
Copy link
Member

htgoebel commented Jun 2, 2015

So chance to handle this in PyInstaller. skimage.io._plugins/plugin.py has to be adapted to being "frozen" or use another "official" way to find its plugins. There is nothing we can do on PyInstallers side here. Sorry.

@htgoebel htgoebel closed this as completed Jun 2, 2015
@the-vindicar
Copy link

Well, you're right. But since people usually need to "have it working, in whatever way possible, now!", then for the sake of googleability I'll leave the following hack that worked for me.
Put into your spec file:

from distutils.sysconfig import get_python_lib
from os import path 
skimage_plugins = Tree(
    path.join(get_python_lib(), "skimage","io","_plugins"), 
    prefix=path.join("skimage","io","_plugins"),
    )

And later you can use this Tree during COLLECT:

coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               skimage_plugins,
               strip=None,
               upx=True,
               name='foobar')

If you use onedir mode, it will grab the skimage plugins directory and put it where skimage expects to find it.
Of course, it's a hack, and rather dirty one to boot.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind:support version:develop Related to the current development branch
Projects
None yet
Development

No branches or pull requests

3 participants