Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #111918 > unrolled thread

Re: pyinstaller

Started byLarry Martell <larry.martell@gmail.com>
First post2016-07-26 21:15 -0400
Last post2016-07-27 07:25 -0400
Articles 3 — 2 participants

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: pyinstaller Larry Martell <larry.martell@gmail.com> - 2016-07-26 21:15 -0400
    Re: pyinstaller Christian Gollwitzer <auriocus@gmx.de> - 2016-07-27 08:23 +0200
      Re: pyinstaller Larry Martell <larry.martell@gmail.com> - 2016-07-27 07:25 -0400

#111918 — Re: pyinstaller

FromLarry Martell <larry.martell@gmail.com>
Date2016-07-26 21:15 -0400
SubjectRe: pyinstaller
Message-ID<mailman.2.1469582162.10276.python-list@python.org>
On Tue, Jul 26, 2016 at 8:49 PM, Tom Brown <nextstate@gmail.com> wrote:
> I used pyinstaller quite a bit 3 years ago. I could brush off the cobwebs
> and see if I can help if you have not solved it already.
>
> What is the issue you are having?

If I import the requests module, then when I run the executable I get:

ImportError: No module named 'requests.packages.chardet'

I tried to post to the pyinstaller group, but it said my post had to
be approved by the moderator, and it apparently never was. I have no
idea who the moderator is, so there was no one I could contact about
that. I posted an issue to github
(https://github.com/pyinstaller/pyinstaller/issues/2060) and some
suggestions were made, but none fixed the problem. I am on RHEL 7.2
with Python 2.7.5, and it's reproducible, just by having a 1 line
script that has "import requests". Thanks for any help you could
provide.




>
> On Jun 21, 2016 16:57, "Larry Martell" <larry.martell@gmail.com> wrote:
>>
>> Anyone here have any experience with pyinstaller? I am trying to use
>> it, but I'm not having much success. I tried posting to the
>> pyinstaller ML but it said my post had to be approved first, and that
>> hasn't happened in a while. I'll post details if someone here thinks
>> they can help.
>> --
>> https://mail.python.org/mailman/listinfo/python-list

[toc] | [next] | [standalone]


#111926

FromChristian Gollwitzer <auriocus@gmx.de>
Date2016-07-27 08:23 +0200
Message-ID<nn9k1m$uku$1@dont-email.me>
In reply to#111918
Am 27.07.16 um 03:15 schrieb Larry Martell:
> On Tue, Jul 26, 2016 at 8:49 PM, Tom Brown <nextstate@gmail.com> wrote:
>> I used pyinstaller quite a bit 3 years ago. I could brush off the cobwebs
>> and see if I can help if you have not solved it already.
>>
>> What is the issue you are having?
>
> If I import the requests module, then when I run the executable I get:
>
> ImportError: No module named 'requests.packages.chardet'

That's a classic issue. pyinstaller does static analysis of the program, 
which modules must be included. If the code computes a module 
dynamically, it can not always succeed. The solution is to tell 
pyinstaller to add this module. In previous versions, you could add 
these by "pyinstaller --hidden-import=requests.packages.chardet" or 
similar. If this doesn't work, you need to edit the spec file. See here:

https://pythonhosted.org/PyInstaller/when-things-go-wrong.html#listing-hidden-imports

	Chrstian

[toc] | [prev] | [next] | [standalone]


#111932

FromLarry Martell <larry.martell@gmail.com>
Date2016-07-27 07:25 -0400
Message-ID<mailman.7.1469620118.10276.python-list@python.org>
In reply to#111926
On Wed, Jul 27, 2016 at 2:23 AM, Christian Gollwitzer <auriocus@gmx.de> wrote:
> Am 27.07.16 um 03:15 schrieb Larry Martell:
>>
>> On Tue, Jul 26, 2016 at 8:49 PM, Tom Brown <nextstate@gmail.com> wrote:
>>>
>>> I used pyinstaller quite a bit 3 years ago. I could brush off the cobwebs
>>> and see if I can help if you have not solved it already.
>>>
>>> What is the issue you are having?
>>
>>
>> If I import the requests module, then when I run the executable I get:
>>
>> ImportError: No module named 'requests.packages.chardet'
>
>
> That's a classic issue. pyinstaller does static analysis of the program,
> which modules must be included. If the code computes a module dynamically,
> it can not always succeed. The solution is to tell pyinstaller to add this
> module. In previous versions, you could add these by "pyinstaller
> --hidden-import=requests.packages.chardet" or similar. If this doesn't work,
> you need to edit the spec file. See here:
>
> https://pythonhosted.org/PyInstaller/when-things-go-wrong.html#listing-hidden-imports

Yes, I had seen that and I tried it with:

--hidden-import=requests.packages.chardet

and I got the same error at run time:

$ dist/pyi_test/pyi_test
Traceback (most recent call last):
File "pyi_test.py", line 1, in
import requests
File "/usr/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py",
line 389, in load_module
exec(bytecode, module.dict)
File "requests/init.py", line 58, in
File "/usr/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py",
line 389, in load_module
exec(bytecode, module.dict)
File "requests/utils.py", line 26, in
File "/usr/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py",
line 389, in load_module
exec(bytecode, module.dict)
File "requests/compat.py", line 7, in
File "requests/packages/init.py", line 95, in load_module
ImportError: No module named 'requests.packages.chardet'

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web