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

pkg_resources.DistributionNotFound: The 'PyInstaller' distribution was not found and is required by the application #4651

Closed
kivdev opened this issue Jan 28, 2020 · 9 comments

Comments

@kivdev
Copy link

kivdev commented Jan 28, 2020

Windows 10 x64
Python 3.8.1 x32
PyInstaller==4.0.dev0+55c8855d9d
CMD: pyinstaller --onefile test_for_build.py
test_for_build.py:

import PyInstaller.__main__

PyInstaller.__main__.run([
    '--name=test',
    '--onefile',
    '--windowed',
    '--icon=icon.ico',
    os.path.join('my_package', 'main.py'),
])

main.py:

print('Hello World')
input()

test_for_build.exe:

Traceback (most recent call last):
  File "test_for_build.py", line 1, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "c:\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 489, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\PyInstaller\__init__.py", line 55, in <module>
  File "site-packages\pkg_resources\__init__.py", line 481, in get_distribution
  File "site-packages\pkg_resources\__init__.py", line 357, in get_provider
  File "site-packages\pkg_resources\__init__.py", line 900, in require
  File "site-packages\pkg_resources\__init__.py", line 786, in resolve
pkg_resources.DistributionNotFound: The 'PyInstaller' distribution was not found and is required by the application
[5292] Failed to execute script test_for_build
@Legorooj
Copy link
Member

Umm what exactly are you trying to do? Run compile PyInstaller using PyInstaller? And compile stuff with that?

@kivdev
Copy link
Author

kivdev commented Feb 21, 2020

Umm what exactly are you trying to do? Run compile PyInstaller using PyInstaller? And compile stuff with that?

I want to create an executable file that takes the name of the script through a parameter, collects everything necessary for it(images, files, etc.) and builds it.

@Legorooj
Copy link
Member

That won't work - PyInstaller collects stuff from your environment when building. That means that if your script has a library import your exe doesn't, it won't work. Sorry, but we can't offer support for this use of PyInstaller because it won't work.

@kivdev
Copy link
Author

kivdev commented Feb 22, 2020

Do you know what is the most interesting? I had a version of Python 3.7.2 and everything worked, then I replaced it with 3.8, I got an error, I rolled back completely to 3.7.2 - it did not help, I installed all versions of setuptools to the version released before the release of 3.7.2, this did not solve my problem ... It worked, it stopped right now, it's a bug.

P.s. Perhaps an important clarification, the version of PyInstaller did not change during my updates and rollbacks.

@Legorooj
Copy link
Member

@kivdev I had that at one point - it's a windows caching error. If the PyInstaller build was failing, then try the --clean option.

@kivdev
Copy link
Author

kivdev commented Feb 22, 2020

Windows 10 x64
Python 3.7.2 x32
PyInstaller==4.0.dev0+d08a42c612
CMD: pyinstaller --onefile --clean test_for_build.py
test_for_build.py:


import PyInstaller.__main__
import os
PyInstaller.__main__.run([
    '--name=test',
    '--clear',
    '--icon=icon.ico',
    os.path.join('main.py'),
])
print(1)
input()

The error has not changed.

@Legorooj
Copy link
Member

To do this you'd need a hook for PyInstaller - we don't have one and won't create one. You'd also need to mod the bootloader process, create runtime hooks, and loads more. We can't, won't and don't support or encourage this.

@kivdev
Copy link
Author

kivdev commented Feb 22, 2020

Suppose I need hooks, but how did it work before, if it cannot work without them?
There is also such a section in the documentation, but it turns out that it works only on behalf of python?
https://pyinstaller.readthedocs.io/en/stable/usage.html#running-pyinstaller-from-python-code

@dasiimwe
Copy link

dasiimwe commented Jun 2, 2020

Run into a similar issue. found out pyinstaller is not yet supported on python 3.8. #4311

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants