Giter VIP home page Giter VIP logo

Comments (7)

todofixthis avatar todofixthis commented on August 16, 2024 2

No worries; I think we're on the right track. Many of the answers and linked Github issues on the above StackOverflow page seem to point to using a PyInstaller hook to resolve this issue. I think something like this will address the issue:

  1. Find or create the file hooks-phx-filters.py (you'll need to do a bit of experimentation/research to find the right location; https://stackoverflow.com/a/52898981/5568265 suggests a possible location).
    • Discovering where the hooks files get created will teach you a bit about how PyInstaller works under-the-hood, and if you're unable to determine the correct location you can alternatively specify --additional-hooks-dir to load hooks from a directory of your choosing (see https://stackoverflow.com/a/28023347/5568265 for more info).
  2. Add the following content to hooks-phx-filters.py:
    from PyInstaller.utils.hooks import copy_metadata
    datas = copy_metadata('phx-filters')

Let me know if you're able to get this working; I see that it is possible to add PyInstaller hooks directly to a package — if the custom hook fixes the issue I'll see about adding it to the phx-filters library 😺

from iota.py.

policmajsterdev avatar policmajsterdev commented on August 16, 2024 1

Hello! I did as you wrote and it seems that something has moved :)
But I got another error:

Traceback (most recent call last): 
File "gam.py", line 12, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
   File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked

  File "c:\pythonx\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)

  File "iotaconn.py", line 5, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked

  File "c:\pythonx\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)

  File "iota\__init__.py", line 43, in <module>
  File "pkg_resources\__init__.py", line 899, in require
  File "pkg_resources\__init__.py", line 785, in resolve

pkg_resources.DistributionNotFound: The 'PyOTA' distribution was not found and is required by the application
[13752] Failed to execute script gam

But..
For PyOTA I did exactly like for phx-filters and it works!

datas = copy_metadata('phx-filters')
datas += copy_metadata('PyOTA')

Thank you very much!
Greetings! :)

from iota.py.

todofixthis avatar todofixthis commented on August 16, 2024

Hi @policmajsterdev thanks for reporting this issue!

The key line from the traceback is this one:

pkg_resources.DistributionNotFound: The 'phx-filters' distribution was not found and is required by the application

These pages may be relevant to the issue you're experiencing:

Could you post the exact pyinstaller command you are running to create the exe file?

from iota.py.

policmajsterdev avatar policmajsterdev commented on August 16, 2024

Thank you for your answer. My command looks like this:
pyinstaller --noconfirm --onefile --console --add-data "C:/Users/eimea/Desktop/gfx/game/data;data/" "C:/Users/eimea/Desktop/gfx/game/gam.py"

from iota.py.

todofixthis avatar todofixthis commented on August 16, 2024

🤔 I note that the same issue occurred in #193 — I wonder if this is because the phx-filters lib has a self-referential require statement:
https://github.com/todofixthis/filters/blob/2.0.2/filters/__init__.py#L3

This is a common practice, so I imagine that pyinstaller users will run into this issue from time to time.

Possibly one of the answers to this StackOverflow post may be helpful here:
https://stackoverflow.com/q/40076795/5568265

Also, double-check that you have the most up-to-date version of pyinstaller; see pyinstaller/pyinstaller#1515 (comment)

from iota.py.

policmajsterdev avatar policmajsterdev commented on August 16, 2024

Thanks for your help but I still have a problem. I uninstalled the entire python environment several times, installed it in various combinations, and then nothing.
My version of pyinstaller is 4.1.
I noticed that the boot always stops in the same place when importing a module using 'pyota'.

As you wrote, the problem is somewhere here:
__version__ = require('phx-filters')[0].version

Unfortunately, I'm not that advanced in python and I don't know what to do next.
Thank you for your help, I will keep trying.

from iota.py.

todofixthis avatar todofixthis commented on August 16, 2024

Sweeeet as. Great to see you got it working! I'll make a note of this, so that we can make future versions of PyOTA (and phx-filters 😁) PyInstaller-compatible out-of-the-box.

from iota.py.

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.