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

'six' is required; worked fine with previous version of pyinstaller #1773

Closed
txtsd opened this issue Jan 17, 2016 · 17 comments · Fixed by #1790
Closed

'six' is required; worked fine with previous version of pyinstaller #1773

txtsd opened this issue Jan 17, 2016 · 17 comments · Fixed by #1790
Assignees
Labels
area:hooks Caused by or effecting some hook @high version:develop Related to the current development branch

Comments

@txtsd
Copy link

txtsd commented Jan 17, 2016

I get this when I run the built executable. It worked fine when built with the previous version of pyinstaller.

Traceback (most recent call last):
  File "<string>", line 11, in <module>
  File "/usr/lib/python3.5/site-packages/PyInstaller/loader/pyimod03_importers.py", line 363, in load_module
    exec(bytecode, module.__dict__)
  File "/usr/lib/python3.5/site-packages/pkg_resources/__init__.py", line 48, in <module>
    from pkg_resources.extern import six
  File "/usr/lib/python3.5/site-packages/pkg_resources/extern/__init__.py", line 60, in load_module
    "distribution.".format(**locals())
ImportError: The 'six' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.
pyi_rth_pkgres returned -1
@opqopq
Copy link

opqopq commented Jan 18, 2016

To solve, in spec file, I hadd to add the followings in hidden imports:

hiddenimports=['six','packaging', 'packaging.version', 'packaging.specifiers'],

@htgoebel htgoebel added the version:develop Related to the current development branch label Jan 18, 2016
@htgoebel
Copy link
Member

This seams to be an issue with setuptools 19.3, see #1772 (comment). Please try downgrading setuptools to 19.2 and report back if this solved the issue in your case, too.

@htgoebel htgoebel added the state:need info Need more information for solve or help. label Jan 18, 2016
@pythonic64
Copy link

Downgrading to setuptools==19.2 fixed this issue for me.

@Bluehorn
Copy link

Same problem here, I fixed this with a new hook script for the vendor hack inside pkg_resources:

(loco2-precise)torsten.landschoff@horatio:~/opensrc/pyinstaller$ git diff --cached
diff --git a/PyInstaller/hooks/hook-pkg_resources.py b/PyInstaller/hooks/hook-pkg_resources.py
new file mode 100644
index 0000000..cff9036
--- /dev/null
+++ b/PyInstaller/hooks/hook-pkg_resources.py
@@ -0,0 +1,6 @@
+def list_vendored_modules():
+    from pkgutil import walk_packages
+    import pkg_resources._vendor
+    return ["pkg_resources._vendor.{1}".format(*x) for x in walk_packages(pkg_resources._vendor.__path__)]
+
+hiddenimports = list_vendored_modules()

@htgoebel
Copy link
Member

@Bluehorn Would you pleas be so kind submitting a pull-request, so you'll get the credits for this fix. (I'm going to prepare release 3.1.1 in the meanwhile).

@htgoebel htgoebel added this to the PyInstaller 3.1.1 milestone Jan 21, 2016
@htgoebel htgoebel added @high area:hooks Caused by or effecting some hook and removed state:need info Need more information for solve or help. labels Jan 21, 2016
@htgoebel htgoebel self-assigned this Jan 21, 2016
@htgoebel
Copy link
Member

@Bluehorn Just a quick question: This code basically collects pkg_resources._vendor and all sub-modules? Correct? So if you are going to issue a pull-request, please use

from PyInstaller.utils.hooks import collect_submodules
hiddenimports = collect_submodules('pkg_resources._vendor')

@Bluehorn
Copy link

@htgoebel Thanks, I did not know of collect_submodules.

Bluehorn added a commit to Bluehorn/pyinstaller that referenced this issue Jan 21, 2016
The-Compiler added a commit to qutebrowser/qutebrowser that referenced this issue Jan 23, 2016
htgoebel added a commit that referenced this issue Jan 26, 2016
@blueprintarchitect
Copy link

The fix doesn't solve the issue to me.

I get the same issue using pyinstaller 3.1.1 and python 3.5.1 using Anaconda.
It works only after downgrading to setuptools==19.2 as suggested by pythonic64

@nealkruis
Copy link

I am seeing the same issue as @smartswdeveloper using pyinstaller 3.1.1 and python 2.7.11 with Anaconda on both Windows and Mac OS X. Needed to downgrade setuptools in order to get it to run correctly.

I suggest re-opening this issue, or I can create a new one.

@Insoleet
Copy link
Contributor

Insoleet commented Apr 6, 2016

Same problem, python 3.5.1 with Anaconda on Windows. I think we should re-open this issue.

@bpteague
Copy link
Contributor

bpteague commented Apr 6, 2016

+1 for re-opening. Anaconda distribution of Python 2.7.11 on Windows; downgrading setuptools to 19.2 fixed the problem for me.

@bjones1
Copy link
Contributor

bjones1 commented Apr 25, 2016

Doing a bit of looking, on my Windows PC and current PyInstaller (see below), hook-pkg_resources.py invokes collect_submodules, which incorrectly returns an empty list. This is because pkg_resources is installed in an egg:

>>> import pkg_resources
>>> print(pkg_resources.__file__)
e:\enki_all\codechat\setuptools-20.9.0-py3.4.egg\pkg_resources\__init__.py
>>>

Deleting the .egg file shown above causes Python to find the non-.egg version:

>>> import pkg_resources
>>> pkg_resources.__file__
'C:\\Users\\bjones\\Downloads\\WinPython-32bit-3.4.4.1Qt5\\python-3.4.4\\lib\\site-packages\\pkg_resources\\__init__.py'
>>>

After this, the error goes away. Long term fix: rewrite collect_submodules to support .eggs. The code from @Bluehorn above might provide a base for this.

Version info:

78 INFO: PyInstaller: 3.2.dev0+g8e0a51f.mod
78 INFO: Python: 3.4.4
78 INFO: Platform: Windows-10-10.0.10240

smondet added a commit to smondet/biopam that referenced this issue May 11, 2016
On a recent Ubuntu (16.04), we were hitting this error:
<pyinstaller/pyinstaller#1773>

This should work-around the problem.
@salvoip
Copy link

salvoip commented May 21, 2016

Dear devs,

I have faced the same issue with python 3.5.1 using miniconda 3. My fix is just to extract setuptools-20.3-py3.5.egg as setuptools in site-packages, and change the setuptools.pth file to ".\setuptools". Building successful with pyinstaller 3.1.1 (why does pyinstaller 3.2 fail to look for binary dependencies of several api-ms dlls with the same code?).

Can this considered a valid solution or extracting the setuptools-20.3-py3.5.egg can trigger additional side-effects?

All the best and thank you!

@bjones1
Copy link
Contributor

bjones1 commented May 27, 2016

@salvoip, I think 08020fd fixes this. Would you test?

@ronanpaixao
Copy link

ronanpaixao commented Sep 3, 2016

@bjones1 This may be a workaround for a simple package, but I'm getting errors for a program which doesn't use NumPy: https://github.com/ronanpaixao/PyPDFTK/

When generating it also goes from 13MB (with setuptools 19.2, working) to 30MB (with setuptools 26.1.1, non-working). Maybe it's importing some troublesome package?

PyPDFTK is pretty much PyQt and PyPDF2. I'm also trying my spec file in a simpler project and it works fine. Maybe PyPDF2 is another culprit?

@bjones1
Copy link
Contributor

bjones1 commented Sep 5, 2016

First follow the steps at https://github.com/pyinstaller/pyinstaller/wiki/How-to-Report-Bugs. It's hard to tell if this is related or not.

@ebadali
Copy link

ebadali commented Oct 21, 2016

@smartswdeveloper Your fix, resolved my issue.
But i can only run exe from Cmd, Clicking it doesn't do anything.

Any idea ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area:hooks Caused by or effecting some hook @high version:develop Related to the current development branch
Projects
None yet
Development

Successfully merging a pull request may close this issue.