Which pyinstaller module is issuing the "ERROR: could not find TCL/TK" message?
Any suggestions for tracking this down?
-- 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
Function find_tk_darwin is looking only in system wide Tcl/Tk
installation. Not in the paths from Homebrew / Macports or similar
packaging systems.
This has to be probably fixed to work with python from Homebrew /
Macports.
PyInstaller/hooks/hook-_tkinter.py
37 TCL_root =
"/System/Library/Frameworks/Tcl.framework/Versions/Current"
38 TK_root =
"/System/Library/Frameworks/Tk.framework/Versions/Current"
By "This probably has to be fixed," are you suggested that support needs to be added to pyinstaller itself?
Do I have any options for getting this to work with my current installation of Python and associated libraries?
Is there any universal way how to get paths to tcl/tk? Or any idea how
it could be detected properly on Mac?
As far as I can tell, the path used to find Tcl is imbedded in _tkinter.so, and I haven't been able to suss out where it is going. Worse, I'm not able to track down any copy of Tcl in the folders used by HomeBrew (/usr/local/Cellar...). Any tips for tracking it down?
otool is installed with XCode.
otool -L /path/to/this/module/_tkinter.so
--
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.
This could probably mean that pyinstaller is not able to handle
frameworks from Mac properly. Files
/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl
/Library/Frameworks/Tk.framework/Versions/8.5/Tk
Should be present in the dist directory. Could you please try to copy
these two files to the dist directory and try if your app is running?
If your app starts working with these files in the dist directory then
please create a bug report for this.
I think that the cause is that pyinstaller is collecting only *.dylib
files, but not framework files like those 'Tcl' and 'Tk'. These files do
not end with .dylib extension.
drwxr-xr-x 7 lynn lynn 238 Mar 14 14:45 Tk.frameworkdrwxr-xr-x 7 lynn lynn 238 Mar 14 14:45 Headersdrwxr-xr-x 7 lynn lynn 238 Mar 14 14:45 PrivateHeadersdrwxr-xr-x 7 lynn lynn 238 Mar 14 14:45 Resources-rw-r--r-- 1 lynn lynn 2107080 Nov 7 11:18 Tcl-rw-r--r-- 1 lynn lynn 5088 Nov 7 11:18 libtclstub8.5.a
I dont know what @executable_path resolves to at run time, but ../dist/appname also contains a copy of Tcl and tk:drwxr-xr-x 8 lynn lynn 272 Mar 14 14:45 Headersdrwxr-xr-x 10 lynn lynn 340 Mar 14 14:45 PrivateHeadersdrwxr-xr-x 6 lynn lynn 204 Mar 14 14:45 Resources-rw-r--r-- 1 lynn lynn 2920948 Nov 7 11:20 Tk-rw-r--r-- 1 lynn lynn 11528 Nov 7 11:20 libtkstub8.5.a
I'm a little baffled by the re.compile call,
but the function is looking for a match with 'Tcl' and then with 'Tk' .
I'm at a loss at to what else to look at right now, so any suggestions would be welcomed.
A little more info. Pyinstaller-1.5.1 works with a framework build and does not include the file hook-_tkinter.py.
It should resolve to the directory containing
myapp_exe_created_by_pyinstaller
In onedir mode it is ./dist/appname directory.
> but ../dist/appname also contains a copy of Tcl and tk:
> -rwxr-xr-x 1 lynn lynn 2107080 Mar 14 14:45 Tcl -rwxr-xr-x 1 lynn
> lynn 2920948 Mar 14 14:45 tk
>
> I'm at a loss at to what else to look at right now, so any suggestions
> would be welcomed.
What are the depencies of files?
@executable_path/Tcl (compatibility version 8.5.0, current version
8.5.11)
@executable_path/Tk (compatibility version 8.5.0, current version
8.5.11)
otool -L ./dist/appname/Tcl
otool -L ./dist/appname/Tk
What architecture is compiled your _tkinter.so file for? i386 or x86_64?
There could be mismatch in the architecture of _tkinter.so, Tcl, Tk or
the created executable. Please try commands:
$ file _tkinter.so
$ file Tcl
$ file Tk
$ file appname_executable
What are the depencies of files?
@executable_path/Tcl (compatibility version 8.5.0, current version
8.5.11)
@executable_path/Tk (compatibility version 8.5.0, current version
8.5.11)
otool -L ./dist/appname/Tcl
otool -L ./dist/appname/Tk
What architecture is compiled your _tkinter.so file for? i386 or x86_64?
There could be mismatch in the architecture of _tkinter.so, Tcl, Tk or
the created executable. Please try commands:
$ file _tkinter.so
$ file Tcl
$ file Tk
$ file appname_executable
git checkout d9b704e08e2Ran pyinstaller and got ERROR: could not find TCL/TK
git checkout 2cf1972b9Ran pyinstaller and got ERROR: could not find TCL/TK
git bisect good d9b704e08e2
error: pathspec 'v1.5.1' did not match any file(s) known to git.
- Is it better to resolve this part of the problem using pyinstaller v1.5.1, or should I ignore that and concentrate on more recent builds?
- Why doesn't changing the entries in config.dat affect this problem? If I do that, when I run the program I still get the version conflict error.
Probably because the frozen executable can't load included Tcl and Tk
binaries and is thus looking for files in system location.
Could you put together a minimum example I could test?
How could I recreate your homebrew environment for testing?
That's a huge improvement over what I struggled through back when Lion was still in beta. As a new installation, the first version of Xcode installed was the current one, 4.3.1 which presents some twists. Support for gcc-4.2 has been dropped, and Xcode is now packaged as an app instead of installing as /Developer/bin.
Libsamplerate 0.1.8 had to be built from source, but didn't cause any issues; pyinstaller needed altgraph-0.9 and modulegraph 0.9, which both built from source without issues. Libsndfile was a nightmare. Everything else together required just a few, but libsndfile has a long list of dependencies and requires a lot of specific tools that aren't found on OS X. Builds are not tested at all on OS X, so a successful build depends on making OS X look like a Unix system.
In the end I couldn't get it to work, and the developer couldn't help because he doesn't use OS X. I ended up using MacPorts to install libsndfile and portmidi, and pip to install scikits.samplerate and scikits.audiolab. Pyportmidi installed using the standard python setup.py install.
At least python and Tcl/Tk are installed in Library/Frameworks as pyinstaller seems to expect. However, when I run pyinstaller I still get exactly the same error. I'll start working my way through the build shortly.
Lynn
I had been building with '-F -w' options, so I removed the options and built again. Looking in the dist folder, I see that Tcl and tk are already there, as I mentioned above. I ran otools on the copy of _tkinter.so there, and got:@executable_path/Tcl (compatibility version 8.5.0, current version 8.5.11)@executable_path/Tk (compatibility version 8.5.0, current version 8.5.11)/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1105.0.0)/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)When I execute ..dist/appname.app/Contents/MacOS/appname I get:ImportError: dlopen(/var/folders/qq/h5gj3f3s0rx41lhd7h0lt2hm0000gn/T/_MEIigFuUi/_tkinter.so, 2): Library not loaded: @executable_path/TclReferenced from: /var/folders/qq/h5gj3f3s0rx41lhd7h0lt2hm0000gn/T/_MEIigFuUi/_tkinter.soReason: image not found
Here are the files created in the TK_error/dist/TK_error folder:
Tcl/Tk is missing here at all. Your log both say: ERROR: could not find TCL/TK
So you need to find you why TK is not found.
this means 'Tcl' file can't be found in the same directory as
_tkinter.so is.
Or another cause is mismatch in architectures - _tkinter.so is 32bit and
Tcl is 64bit or vice versa.
File "/Users/lynn/Documents/python/axeomatic2/pyinstaller/testbuild/build/pyi.darwin/testbuild/out03-PYZ.pyz/distutils.sysconfig", line 370, in _init_posixdistutils.errors.DistutilsPlatformError: invalid Python installation: unable to open /Users/lynn/Documents/python/axeomatic2/pyinstaller/testbuild/dist/testbuild/lib/python2.7/config/Makefile (No such file or directory)
This is caused by a recent change in pyinstaller to set PYTHONHOME to
the directory with frozen application. This change should make frozen
executables fully independent on any python installation on given OS.
However, on Mac OS X this causes some side effects with distutils and
probably other modules.
I'm working on a fix for this. You could expect the fix in a few days.
Lynn Oliver píše v So 31. 03. 2012 v 20:21 -0700:
please try it again. It should be now fixed.
Lynn Oliver píše v So 31. 03. 2012 v 20:21 -0700:
I rewrote my program to remove dependencies on SciKits.audiolab and SciKits.samplerate. If I run pyinstaller on that version in onedir mode, it actually builds and runs. Major progress, thanks! ( I do still have to change hook-_tkinter.py to insert the correct paths for Tcl/Tk.)
If I build in onefile mode, I get the following runtime error:
ImportError: dlopen(/var/folders/qq/h5gj3f3s0rx41lhd7h0lt2hm0000gn/T/_MEIyI7ve3/_tkinter.so, 2): Library not loaded: @executable_path/Tcl
Referenced from: /var/folders/qq/h5gj3f3s0rx41lhd7h0lt2hm0000gn/T/_MEIyI7ve3/_tkinter.so
Reason: image not found
What can cause it to fail in onefile mode but not onedir mode?
Could you compare the content of directory
like /var/folders/qq/h5gj3f3s0rx41lhd7h0lt2hm0000gn/T/_MEIyI7ve3/ with
the onedir mode?
All the files in the onedir tree that were listed in the ArchiveViewer output. Well, except for five copies of '.DS_Store not found', which is a little odd on OS X.
In your app you need to print 'sys._meipass' in console and
use function 'time.sleep()' keep your app running and to prevent
pyinstaller removing that temporary directory.
Hi Oliver, I found out that we have a serious issue with onefile mode
(no matter what OS).
Current development version is not able import included Python
C-extension modules. Top-level modules works but not modules included in
submodules.
e.g: module 'time' is a C extension and on Linux it is file 'time.so'.
Frozen executable in onefile mode is able to find and import this
module.
But the following example won't work:
In wx library we have module 'wx._core_'. This is a C-extension module.
In default python installation it is file 'site-packages/wx/_core_.so'.
In frozen executable this module is renamed to 'wx._core_.so'. Modules
like this cannot be found and imported in onefile mode.
I'm trying to debug it. The broken file is ./PyInstaller/loader/iu.py.
I'm pretty sure the issue you are experiencing is related to this issue.
Please try latest development version if the fix there works for you.
Thanks.
Probably last think to try. Please try to do the following change and
let me know if it works for you:
diff --git a/PyInstaller/depend/dylib.py b/PyInstaller/depend/dylib.py
index 19ce8dd..ccccc06 100644
--- a/PyInstaller/depend/dylib.py
+++ b/PyInstaller/depend/dylib.py
@@ -202,7 +202,7 @@ def mac_set_relative_dylib_deps(libname):
if not util.in_system_path(pth):
# Use relative path to dependend dynamic libraries bases on
# location of the executable.
- return os.path.join('@executable_path',
os.path.basename(pth))
+ return os.path.join('@loader_path', os.path.basename(pth))
# Rewrite mach headers with @executable_path.
dll = MachO(libname)
Will this change eventually make it into the library? How about an update to hook-_tkinter.py?
Thanks again for the help...
Lynn
It is smaller becase in onefile mode all files are zipped.
> so I'll have to run it through some testing to see if everything
> works. It didn't pick up the matplotlibrc file, so I'll have to
> figure out if there is a way to get that loaded into the default
> directory.
>
> Will this change eventually make it into the library?
loader_path needs more testing. i think it breaks pyqt hooks and
qt_plugins loading. need to find out a workaround. maybe something else
is broken.
> How about an update to hook-_tkinter.py?
could you please sumarize the thing with tkinter?
>
> could you please sumarize the thing with tkinter?
hook-_tkinter.py contains the following function:
def find_tk_darwin(binaries):
pattern = re.compile(r'_tkinter')
for nm, fnm in binaries:
mo = pattern.match(nm)
if not mo:
continue
TCL_root = "/System/Library/Frameworks/Tcl.framework/Versions/Current"
TK_root = "/System/Library/Frameworks/Tk.framework/Versions/Current"
return TCL_root, TK_root
On my system it it called with binaries =
[('Tk', '/Library/Frameworks/Tk.framework/Versions/8.5/Tk'), ('Tcl', '/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl')]
The statement mo = pattern.match(nm) does not find a match, and since the last three statements are inside the for loop, they are not executed. I changed it to something like this:
def find_tk_darwin(binaries):
TCL_root = "/System/Library/Frameworks/Tcl.framework/Versions/Current"
TK_root = "/System/Library/Frameworks/Tk.framework/Versions/Current"
for nm, fnm in binaries:
if nm == 'Tk':
TK_root = fnm
elif nm == 'Tcl':
TCL_root = fnm
return TCL_root, TK_root
For reference, here are all of the standard Tcl/Tk install locations that I could find:
OS X 10.7:
/System/Library/Frameworks/Tcl.framework/Versions/Current
/System/Library/Frameworks/Tk.framework/Versions/Current
A user install from binaries goes to:
/Library/Frameworks/Tcl.framework/Versions/Current
/Library/Frameworks/Tk.framework/Versions/Current
The current SDK (4.2) which is now installed as an app package:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Tcl.framework/Versions/Current
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Tcl.framework/Versions/Current
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Tk.framework/Versions/Current
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Tk.framework/Versions/Current
SDK 4.1:
/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Tcl.framework/Versions/Current
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Tcl.framework/Versions/Current
/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Tk.framework/Versions/Current
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Tk.framework/Versions/Current
One idea: we could determine the TCL_root and TK_root just as dirname
from these binaries like:
for lib, fnm in binaries:
if lib == 'Tcl':
TCL_root = os.path.dirname(fnm)
if lib == 'Tk':
TK_root = os.path.dirname(fnm)
I think this might work in most cases.
The binary windows bootloader is not up-to date (not recompiled). Do you
have visual studio on your windows box? Could you try to recompile
windows bootloader?
What is the value of your PATH environment variable?
$ echo %PATH%
Another think is we should probably verify if pyinstaller ignores lower
and uppercase in dll file names:
MSVCR90.dll and msvcr90.dll should be the same file.
On Apr 10, 2012, at 11:42 AM, Martin Zibricky wrote:
> echo %PATH%
Could you try find 'msvcr90.dll' in your OS and put a copy of this file
named 'MSVCR90.dll' somewhere on your system PATH? (probably
c:\windows\system32)
Otherwise it works as expected?
I think pyinstaller is trying to resolve dependencies of all available
matplotlib backends but not all dependencies are fulfilled.
I think if it otherwise works these errors could be ignored.
Lynn
Could you please try latest development version?
Some issues have been fixed recently and I would like to fix the issues
you are experiencing.
On Win7-64 the program builds and runs. I did get one error message and a bunch of CantPackExceptions.
ERROR: lib not found: gdiplus.dll dependency of C:\Python27\lib\site-packages\wx\wxmsw28uh_core_vc.dll
upx: C:\Users\Lynn Oliver\AppData\Roaming\pyinstaller\bincache01\calc_lwork.pyd: CantPackException: can't pack new-exe
upx: C:\Users\Lynn Oliver\AppData\Roaming\pyinstaller\bincache01\calc_lwork.pyd: CantPackException: can't pack new-exe
upx: C:\Users\Lynn Oliver\AppData\Roaming\pyinstaller\bincache01\flapack.pyd: CantPackException: can't pack new-exe
etc.
On WinXP-32 the program builds and runs. I got the following error messages relating to a matplotlib backend that I'm not using, and a couple of upx messages.
ERROR: lib not found: libgdk_pixbuf-2.0-0.dll dependency of C:\Python27\lib\site-packages\matplotlib\backends\_backend_gdk.pyd
ERROR: lib not found: libgobject-2.0-0.dll dependency of C:\Python27\lib\site-packages\matplotlib\backends\_backend_gdk.pyd
ERROR: lib not found: libgdk-win32-2.0-0.dll dependency of C:\Python27\lib\site-packages\matplotlib\backends\_gtkagg.pyd
ERROR: lib not found: libgobject-2.0-0.dll dependency of C:\Python27\lib\site-packages\matplotlib\backends\_gtkagg.pyd
upx: C:\Documents and Settings\Lynn\Application Data\pyinstaller\bincache01\_windowing.pyd: NotCompressibleException
upx: C:\Documents and Settings\Lynn\Application Data\pyinstaller\bincache01\msvcm90.dll: CantPackException: .NET files (win32/.net) are not yet supported
Do you have any suggestions how these "errors" could be eliminated?
My idea is that pyinstaller tries import all backends and include in
hidden imports only those available.
These errors are now gone.
This issue seems really tricky:
- gdiplus.dll is not present on 64bit win7 in C:\Windows\SysWOW64.
- there are several files GdiPlus.dll in C:\Windows\winsxs
- The issue is with wxpython binary because it does not specify assembly
manifest with dependency on GdiPlus.
- without the manifest in wx binaries pyinstaller can't find GdiPlus as
a dependency.
I'm not sure how this should be fixed. Probably pyinstaller would have
to look for dlls in assembly dirs (c:\windows\winsxs) without manifest
files.
Goebel Consult
http://www.goebel-consult.de
Monatliche Kolumne:
http://www.cissp-gefluester.de/2012-02-bring-your-own-life-glosse
Blog:
http://www.goebel-consult.de/blog/20060920
Goebel Consult ist Mitglied bei http://www.7-it.de/
So this is a clear sign that not all required libraries are bundled :-(
Ah... good idea. I will try if I can manually remove it from the exclude list... :)