Sason Torosean
Sason Torosean

Reputation: 572

PyInstaller created exc. does not run on virtualbox with ubuntu

I used PyInstaller to create an executable from a GUI script I wrote (using wx.python) using this command...

   python /home/torosean/pyinstaller/pyinstaller.py -F -w My_GUI_login_simplified.py

I can run the executable on the host computer w/o any problems by cd-ing into the dist folder and running...

 ./My_GUI_login_simplified

Now when I test the executable in ubuntu (using virtual box) I get the error shown below. I would like to test the executable on several os's before handing it to my colleagues preferably on ubuntu and later on mac in vb again. Anyways here is the error.

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/torosean/pyinstaller/PyInstaller/loader/pyi_importers.py", line 270, in load_module
  File "/home/torosean/Documents/python_funcs/uploader/build/My_GUI_login_simplified/out00-PYZ.pyz/wx", line 45, in <module>
  File "/home/torosean/pyinstaller/PyInstaller/loader/pyi_importers.py", line 270, in load_module
  File "/home/torosean/Documents/python_funcs/uploader/build/My_GUI_login_simplified/out00-PYZ.pyz/wx._core", line 4, in <module>
  File "/home/torosean/pyinstaller/PyInstaller/loader/pyi_importers.py", line 409, in load_module
ImportError: /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1: undefined symbol: _glapi_tls_Dispatch

Now my questions are?

1). Is this a problem having to do with how PyInstaller compiles the script into an executable. In other words from the error shown can one say what went wrong if anything with the PyInstaller making the exec. ( I personally don't "feel" like that is the case but I don't know for sure)?

2). Is this a virtual box/ubuntu problem? Any suggestions on how to fix it, so far i haven't found anything useful.

3). for people who create executables from python scripts, how do you go about testing the executable, do you use virtual machines or is there something better out there?

Any suggestions would be most appreciated. SPECS: host os (Fedora 18 64 bit) guest os (ubuntu 12.04 LTS 64 bit) virtual machine: virtual box (4.2.12) python 2.7.3

Thank you all To the moderator: Sorry if this question doesn't belong here, I thought if there is something that PyInstaller does that causes this error, someone else might benefit knowing about it.

EDIT: Same result with OpenSUSE on vb.... EDIT: Did three things and it worked... 1).Installed the virtualbox from oracles website. 2). Performed an update and things seemed to magically work!

Upvotes: 2

Views: 1346

Answers (1)

Brian K
Brian K

Reputation: 567

I can give you half of an answer...

This happens when the application you're writing depends on libGL, but pyinstaller didn't include it when it packaged up the "binary".

In the pyinstaller "spec" file, you need to define additional libraries & append them to the list of binaries that are returned by the Analysis step. In my application, I've done the following:

additionalLibs = [] 
additionalLibs.append( ("libGL.so.1", "/usr/lib64/libGL.so.1", 'BINARY') )

# yada yada

a = Analysis(['myApp.py'],
             pathex=['/path/to/myAppDir'],
             hiddenimports=[],
             hookspath=None)
pyz = PYZ(a.pure)
exe = EXE(pyz,
          a.scripts,
          a.binaries + additionalLibs,
          a.zipfiles,
          a.datas,
          name=os.path.join('dist', 'myApp'),
          icon="myApp.ico",
          debug=False,
          strip=None,
          upx=True,
          console=console )

This will then include the libGL in your packaged binary -- which works great on all systems that either have no libGL.so.1 or have a compatible libGL.so.1. On systems that have an incompatible libGL.so.1 (as can be the case if your system is up to date & the target system is not, or vice versa), then you'll get a similar error... hence "half an answer"

I was trying to find an answer to the other half (making it always work) when I found your question.

Upvotes: 2

Related Questions