cx_Freeze 4.3.3 : ImportError: libwx_gtk2u_adv-suse.so.1: No such file or directory

Hi there,

I’m trying to create a binary file with cx_Freeze 4.3.3 on openSuse 42.1 (I use wxPython3.0), but on an empty openSuse system, I can’t run my program…

When I try to run my binary program on an empty system opensuse (without wxPython installed on it), I get this error :

Traceback(most recent call last):
File"/usr/lib64/python2.7/site-packages/cx_Freeze/initscripts/Console.py", line 27,in<module>
File"MyProject.py", line 4,in<module>
File"/usr/lib64/python2.7/site-packages/wx-3.0-gtk2/wx/init.py", line 45,in<module>
File"/usr/lib64/python2.7/site-packages/wx-3.0-gtk2/wx/core.py", line 4,in<module>
File"ExtensionLoader_wx__core
.py", line 22,in<module>
File"ExtensionLoader_wx__core_.py", line 14,in bootstrap
ImportError: libwx_gtk2u_adv-suse.so.1: cannot open shared object file:No such file or directory

But that file “libwx_gtk2u_adv-suse.so.1” is indeed at root of the directory containing the binaries files :

-rwxrwx—1 regis users 191896025 oct.2015 libwx_gtk2u_adv-suse.so.1
-rwxrwx—1 regis users 57552825 oct.2015 libwx_gtk2u_aui-suse.so.1
-rwxrwx—1 regis users 578064025 oct.2015 libwx_gtk2u_core-suse.so.1

Any idea on what’s going on ?

Note :
when generating binaries files with cx_Freeze 4.3.3, I had warnings about “lib-dynload”, because in the directory /usr/lib64/python2.7/lib-dynload all the files can’t be executed.
I tried to put all these files with execution rights with chmod command, but the probleme remains…

I don’t really understand what the directory lib-dynload is usefull for ? It seems contain base libraries?..

Thx a lot

By the way,
here is my setup.py file :

import sys
from cx_Freeze import setup,Executable

path = sys.path
path +="/usr/lib64"]

includes =]
excludes =‘PyQt4’,‘PyQt5’,‘Tkinter’,‘FixTk’,‘tcl’,‘tk’,’_tkinter’,‘collections.abc’]
packages =‘matplotlib.backends.backend_wxagg’,‘numpy’]

includefiles =’./data/’,’./images/’,’./html/’,’./locale/’,’./logs/’]

binpathincludes =]

if sys.platform ==“linux2”:
binpathincludes +="/usr/lib64"]
binpathincludes +="/usr/lib"]

base =‘Console’

options ={“path”: path,
“includes”: includes,
“excludes”: excludes,
“packages”: packages,
“include_files”: includefiles,
“bin_path_includes”: binpathincludes,
“optimize”:0,
“silent”:True
}

executables =
Executable(‘MyProjetc.py’, base=base)
]

setup(name=‘MyProject’,
version=‘1.0’,
description=‘My Project’,
executables=executables,
options={‘build_exe’: options}
)

If you’re developing on your machine,
You should either install Python3 from the official Python repo or
Add the special openSUSE 42.3 Python repo as follows, then update your system with the new packages

zypper ar -f http://download.opensuse.org/repositories/devel:/languages:/python3/openSUSE_Leap_42.3/ LEAP_42.3_devel:Python3

Then update your system

zypper up

Then, try building again.
In general, they libraries in a default install are sufficient to run most apps, but if you do any coding you should always install the special repo for that language.

TSU

Thanks for your answer TSU.

Sorry to reply with delay, but I wanted to have time to investigate on my side.
I have yet developed my program with python2.7, and don’t have time to adapt it to version 3.

So I tried to adapt your solution with that command :

zypper ar -f http://download.opensuse.org/repositories/devel:/languages:/python/openSUSE_Leap_42.3/ LEAP_42.3_devel:Python

Unfortunately, there was no file to update on my system… the problem was still present.

So I searched on the internet, and found out the " patchelf " command.
As my binary files (generated with cx_Freeze) were in the same directory than my executable file, I created the script :


for i in *so*
do
     patchelf --set-rpath '.' $i
done

Since, my standalone application can be launched on an “empty” openSuse system… rotfl!

Note:

  • this solution works with cx_Freeze 4.3.x, but don’t with the 5.x versions
  • I successfully created standalone application (for this same program) on various other linux platform (Debian, Mint, Ubuntu, Mageia, Fedora, CentOS) without any kind of problem.
    Only openSuse has needed this kind of operation so my standalone program can work out… I can’t explain why.

May be this post could help some else.

Thanks again TSU for your help. :wink: