Giter Club home page Giter Club logo

Comments (9)

HoLuLuLu avatar HoLuLuLu commented on June 14, 2024 4

You can create a hook file hook-skimage.io.py with the following content:

from PyInstaller.utils.hooks import collect_data_files, collect_submodules

datas = collect_data_files("skimage.io._plugins")`
hiddenimports = collect_submodules('skimage.io._plugins')

From: https://stackoverflow.com/a/35043355

Method 1: (global)

You have to do this method only one time. Your PyInstaller will use the file every time you have a project with skimage.io.
Copy the file in the hooks-folder of your PyInstaller directory (for me it is in ~/.local/lib/python3.6/site-packages/PyInstaller on Ubuntu, C:\Users\username\AppData\Local\Programs\Python\Python36\Lib\site-packages\PyInstaller on Windows).
Now PyInstaller includes the _plugin-folder of your skimage.io package into the generated directory/file and all I/O-operations with skimage will work correctly.

Method 2: (only for current project)

This method is NOT global. Your PyInstaller need to get this file every time you have a project with skimage.io.
Copy the file in a folder near to your project files e.g. hooks.
Then you start PyInstaller use the --additional-hooks-dirattribute like this:

pyinstaller --additional-hooks-dir=./hooks script.py

./hooks must the path to the folder there your hook-skimage.io.py is placed. script.py is your script with the application you want to pack with PyInstaller. You have to call this attribute every time you want to pack this script.

Both methods work for one-file and one-directory mode.
I recommend to use method 1.

I uploaded the file here:
https://drive.google.com/open?id=17Gg3AP000UnxTfIc0PV7wy4IJ15MhTqb

hook-skimage.io.zip

from pyinstaller-hooks-contrib.

chaoxinzheng avatar chaoxinzheng commented on June 14, 2024 1

I solve this by using the solution from pyinstaller/pyinstaller#583

first put these at the top of the 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"),
)

then i added 'skimage_plugins' the so it looks like below:

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

although i am facing other issues at the moment, but at least i got away with the error.

don't follow the stackoverflow solution. it was incorrect. not sure why it was given a tick.

from pyinstaller-hooks-contrib.

DongChen06 avatar DongChen06 commented on June 14, 2024

hi, have you solved it?

from pyinstaller-hooks-contrib.

htgoebel avatar htgoebel commented on June 14, 2024

You need to add the required plugins using --hidden-import.

The stackoverflow solution is wrong since you want to add python modules (I assume) and no data-files.

from pyinstaller-hooks-contrib.

htgoebel avatar htgoebel commented on June 14, 2024

We would appreciate if you'd submit a hook for this. See https://pyinstaller.readthedocs.org/en/latest/hooks.html for more information about how to implement hooks.

from pyinstaller-hooks-contrib.

htgoebel avatar htgoebel commented on June 14, 2024

Somebody to create a real hook for this?

You just need to use collect_data or collect_submodules (please check the other hooks for which one and test) to collect the plugins.

from pyinstaller-hooks-contrib.

chaoxinzheng avatar chaoxinzheng commented on June 14, 2024

from pyinstaller-hooks-contrib.

GenevieveBuckley avatar GenevieveBuckley commented on June 14, 2024

Should this issue be closed now that pyinstaller/pyinstaller#3934 is merged?

from pyinstaller-hooks-contrib.

bwoodsend avatar bwoodsend commented on June 14, 2024

So it can

from pyinstaller-hooks-contrib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.