Trouble running pyinstaller generated executable on different servers

5,532 views
Skip to first unread message

Paul Whipp

unread,
Feb 22, 2012, 9:05:21 PM2/22/12
to pyins...@googlegroups.com
Hi there,

I installed pyinstaller-1.5.1 on my 10.04 Ubuntu system and used it to build two command line utilities with a script as follows:

#!/bin/bash

python pyinstaller-1.5.1/Makespec.py -Fso /tmp orb_development_proxy.py
python pyinstaller-1.5.1/Build.py /tmp/orb_development_proxy.spec
cp /tmp/dist/orb_development_proxy .

python pyinstaller-1.5.1/Makespec.py -Fso /tmp orb_live_proxy.py
python pyinstaller-1.5.1/Build.py /tmp/orb_live_proxy.spec
cp /tmp/dist/orb_live_proxy .

The resulting executables work perfectly on the 10.04 system. Great stuff!

Then I copy the executable to a couple of my servers for testing.

On Centos 5.5 running a fairly typical web hosting setup I get -

/home/evanidus-sandbox/public_html # ls -l | grep orb_proxy
-rwxrwxrwx  1 evanidus-sandbox evanidus-sandbox 3425777 Feb 22 19:35 orb_proxy
-rwxrwxrwx  1 evanidus-sandbox evanidus-sandbox    3706 Jan 17 16:11 orb_proxy.py
/home/evanidus-sandbox/public_html # orb_proxy.py ping merchant merchant
1
/home/evanidus-sandbox/public_html # orb_proxy ping merchant merchant
Error loading Python lib '/tmp/_MEIMkjue6/libpython2.6.so.1.0': /lib/libc.so.6: version `GLIBC_2.7' not found (required by /tmp/_MEIMkjue6/libcrypto.so.0.9.8)

On Ubuntu 11.10 (EC2) I get -

~/python/orb/merchant $ ls -l | grep orb_dev
-rwxr-xr-x  1 ubuntu ubuntu 3425772 2012-02-23 00:50 orb_development_proxy
-rwxrwxr-x  1 ubuntu ubuntu     335 2012-02-23 00:50 orb_development_proxy.py
~/python/orb/merchant $ orb_development_proxy.py ping merchant merchant
1
~/python/orb/merchant $ orb_development_proxy ping merchant merchant
-bash: ./orb_development_proxy: No such file or directory

So in both cases the python script works (these servers have python 2.6.5 and the special modules all set up - this wont be the case on other targets) but the executable produced by pyinstaller fails.

Looking at ldd -

/home/evanidus-sandbox/public_html # ldd orb_proxy
        linux-gate.so.1 =>  (0xffffe000)
        libz.so.1 => /usr/lib/libz.so.1 (0xf7f0b000)
        libdl.so.2 => /lib/libdl.so.2 (0xf7f06000)
        libc.so.6 => /lib/libc.so.6 (0xf7dad000)
        /lib/ld-linux.so.2 (0xf7f28000)

All these dependent files exist on the Centos 5 server.

On the 11.10 server, ldd tells me the orb_development_proxy "is not a dynamic executable" - the executable is identical on all 3 systems (checked with md5sum) - its renamed on the web server for implementation reasons.

My ultimate intention is to distribute the executable for use on a range of web servers running Linux.

I can't see anything untoward in the warnings.

Can someone point me in the right direction to work out how I can get the generated executable to run on these test servers?


Regards,
Paul Whipp

Office: 07 3103 2894
Mobile: 0410 545 357

Do more business with your website!

Joomla, Python, PHP and MySQL web application developer




Hartmut Goebel

unread,
Feb 23, 2012, 3:42:37 AM2/23/12
to pyins...@googlegroups.com
Am 23.02.2012 03:05, schrieb Paul Whipp:
Error loading Python lib '/tmp/_MEIMkjue6/libpython2.6.so.1.0': /lib/libc.so.6: version `GLIBC_2.7' not found (required by /tmp/_MEIMkjue6/libcrypto.so.0.9.8)

Well, this message is quite clear: You need to install glibc 2.7 on this machine. Or maybe you can rebuild libcrypto to use a older version of glibc.

PyInstaller exclude glibc from it's distribution as these are available on all machines.


~/python/orb/merchant $ orb_development_proxy ping merchant merchant
-bash: ./orb_development_proxy: No such file or directory

Bash sometime gives irritating error messages. So this can be caused by another file not found. I was trapped by suche messages at other occasions, too. Try running your program under strace:
strace -f -e trace=file ./orb_development_proxy 2>&1 | less -S

/home/evanidus-sandbox/public_html # ldd orb_proxy
Hmm, this is a different program?!

-- 
Schönen Gruß - Regards
Hartmut Goebel
Dipl.-Informatiker (univ.), CISSP, CSSLP

Goebel Consult 
Spezialist für IT-Sicherheit in komplexen Umgebungen
http://www.goebel-consult.de

Monatliche Kolumne: http://www.cissp-gefluester.de/
Goebel Consult ist Mitglied bei http://www.7-it.de

Martin Zibricky

unread,
Feb 23, 2012, 4:38:48 AM2/23/12
to pyins...@googlegroups.com
Paul Whipp píše v Čt 23. 02. 2012 v 12:05 +1000:

>
> Can someone point me in the right direction to work out how I can get
> the generated executable to run on these test servers?

You could look at our faq: http://www.pyinstaller.org/wiki/FAQ

You need to build your app on the oldest distribution you want to
support (with oldest libc - libc is backward compatible but not
forward). I your case I think it means to build your app on centos 5.

If you depend on newer python version than the one on centos 5 then the
challenge is to build python yourself on centos 5.

Or another option is to look at http://pypi.python.org/pypi/myppy. With
python from myppy you should be able to create executables on your
ubuntu 10 which could work even on centos5.

Paul Whipp

unread,
Feb 27, 2012, 4:45:03 AM2/27/12
to pyins...@googlegroups.com

Thanks very much for the help and feedback.

I've learned a lot trying to get this working. I tried building on an older OS (Centos 5.4) but I could not get it working right (probably because Python 2.6 which is needed for the app).

After building the bootloader as suggested and copying the relevant files (the build was on a 32 bit version of Centos 5.4 with GCLIB at 2.5 as per the target 64bit Centos server - I built using the new build files on the 32 bit development system), I still got the same issue on the Centos system. Building the bootloaders as per the manual (and faq) did not make any difference to the reported error.

Reading around I discovered that the problem on the ubuntu 11.10 system was a result of the ia32-libs not being installed by default. Installing that fixed the issue there - phew - one down.

As building the bootloaders did not work, I tried myppy. However this project seems to be languishing and it failed to initialise on 10.04 Ubuntu -

~/python/orb/dev $ sudo pip install myppy
Downloading/unpacking myppy
  Running setup.py egg_info for package myppy
Installing collected packages: myppy
  Running setup.py install for myppy
    changing mode of /usr/local/bin/myppy to 755
Successfully installed myppy
~/python/orb/dev $ cd ../merchant/
~/python/orb/merchant $ myppy myppy_env init
FETCHING apbuild_base
DOWNLOADING http://autopackage.googlecode.com/files/autopackage-1.4.2-x86.tar.bz2
BUILDING apbuild_base
INSTALLING apbuild_base
Traceback (most recent call last):
  File "/usr/local/bin/myppy", line 6, in <module>
    res = myppy.main(sys.argv)
  File "/usr/local/lib/python2.6/dist-packages/myppy/__init__.py", line 163, in main
    res = cmd.run(target,args) or 0
  File "/usr/local/lib/python2.6/dist-packages/myppy/__init__.py", line 178, in run
    target.init()
  File "/usr/local/lib/python2.6/dist-packages/myppy/envs/base.py", line 110, in init
    self.install(dep,initialising=True)
  File "/usr/local/lib/python2.6/dist-packages/myppy/envs/base.py", line 169, in install
    self.install(dep,initialising=initialising)
  File "/usr/local/lib/python2.6/dist-packages/myppy/envs/base.py", line 176, in install
    r.install()
  File "/usr/local/lib/python2.6/dist-packages/myppy/recipes/linux.py", line 147, in install
    open(os.path.join(self.target.PREFIX,"lib","apbuild-base--installed.txt"),"wb").close()
IOError: [Errno 2] No such file or directory: u'/home/paul/python/orb/merchant/myppy_env/local/lib/apbuild-base--installed.txt'

So… I tried to run everything by using python 2.6 alongside 2.4.3 on the Centos system. It built an executable but -

~/python/orb/merchant $ ./orb_development_proxy ping merchant merchant
Traceback (most recent call last):
  File "<string>", line 24, in <module>
  File "/home/paul/python/orb/merchant/orb_proxy.py", line 57, in do_command
    getattr(self, command)(*command_args)
  File "/home/paul/python/orb/merchant/orb_proxy.py", line 120, in ping
    if self.get_proxy(username, password).safePing():
  File "/home/paul/python/orb/merchant/orb_proxy.py", line 79, in get_proxy
    8667)
  File "/home/paul/python/orb/client/proxy.py", line 17, in __init__
    ServerProxy.__init__(self, uri, allow_none = True, use_datetime = True)
  File "/home/paul/python/orb/myxmlrpclib.py", line 1469, in __init__
    import urllib
  File "/home/paul/python/orb/merchant/pyinstaller-1.5.1/iu.py", line 455, in importHook
    raise ImportError, "No module named %s" % fqname
ImportError: No module named urllib
~/python/orb/merchant $ python26
Python 2.6.5 (r265:79063, Feb 28 2011, 21:55:45) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib
>>> 

Not sure why the module would appear to be missing when python 2.6 can see it (python 2.4 can too for that matter). The python script runs fine (in python 2.6).

So I'm still stuck. I suspect that trying cxfreeze et al will reveal the same problem. I need to find a solution so I will keep looking.

Any further suggestions or pointing out any errors I'm making would be appreciated. I am surprised that 'building the bootloaders' did not make a difference given that its mentioned as a fix in the FAQ.

Cheers,

Paul






--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To post to this group, send email to pyins...@googlegroups.com.
To unsubscribe from this group, send email to pyinstaller...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pyinstaller?hl=en.


Martin Zibricky

unread,
Feb 27, 2012, 8:36:06 AM2/27/12
to pyins...@googlegroups.com
Paul Whipp píše v Po 27. 02. 2012 v 19:45 +1000:

>
> Not sure why the module would appear to be missing when python 2.6 can
> see it (python 2.4 can too for that matter). The python script runs
> fine (in python 2.6).
>
> So I'm still stuck. I suspect that trying cxfreeze et al will reveal
> the same problem. I need to find a solution so I will keep looking.

Cxfreeze or similar would definitely reveal the same problem.

> Any further suggestions or pointing out any errors I'm making would be
> appreciated. I am surprised that 'building the bootloaders' did not
> make a difference given that its mentioned as a fix in the FAQ.

You could try
- experiment with variable PYTHONHOME
- development version of pyinstaller
- development version of myppy

Reply all
Reply to author
Forward
0 new messages