Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#35689 closed defect (fixed)

py27-wxpython: NameError: global name 'log' is not defined

Reported by: cdeil (Christoph Deil) Owned by: jwa@…
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: anddam (Andrea D'Amore), mojca (Mojca Miklavec), petrrr, cdev9@…
Port: py-wxpython

Description

After upgrading from XCode 4.3 to 4.4 on my Lion Macbook, I got the following error:

$ python -c 'import wx'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/__init__.py", line 45, in <module>
    from wx._core import *
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core.py", line 4, in <module>
    import _core_
ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core_.so, 2): no suitable image found.  Did find:
	/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core_.so: mach-o, but wrong architecture
christoph-deils-macbook:Downloads deil$ file /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core_.so
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core_.so: Mach-O bundle i386
christoph-deils-macbook:Downloads deil$ otool -L /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core_.so
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core_.so:
	/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)
	/opt/local/lib/libwx_macu_richtext-2.8.0.dylib (compatibility version 9.0.0, current version 9.0.0)
	/opt/local/lib/libwx_macu_aui-2.8.0.dylib (compatibility version 9.0.0, current version 9.0.0)
	/opt/local/lib/libwx_macu_xrc-2.8.0.dylib (compatibility version 9.0.0, current version 9.0.0)
	/opt/local/lib/libwx_macu_qa-2.8.0.dylib (compatibility version 9.0.0, current version 9.0.0)
	/opt/local/lib/libwx_macu_html-2.8.0.dylib (compatibility version 9.0.0, current version 9.0.0)
	/opt/local/lib/libwx_macu_adv-2.8.0.dylib (compatibility version 9.0.0, current version 9.0.0)
	/opt/local/lib/libwx_macu_core-2.8.0.dylib (compatibility version 9.0.0, current version 9.0.0)
	/opt/local/lib/libwx_base_carbonu_xml-2.8.0.dylib (compatibility version 9.0.0, current version 9.0.0)
	/opt/local/lib/libwx_base_carbonu_net-2.8.0.dylib (compatibility version 9.0.0, current version 9.0.0)
	/opt/local/lib/libwx_base_carbonu-2.8.0.dylib (compatibility version 9.0.0, current version 9.0.0)
	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
	/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 153.0.0)
	/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 17.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
	/System/Library/Frameworks/QuickTime.framework/Versions/A/QuickTime (compatibility version 1.0.0, current version 2315.0.0)
	/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
	/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 41.0.0)

So I tried to uninstall and reinstall

sudo port uninstall py27-wxpython
sudo port uninstall wxWidgets
sudo port install py27-wxpython

but now the py27-wxpython install fails with a

NameError: global name 'log' is not defined

The full log is attached.

Attachments (2)

main.log (113.2 KB) - added by cdeil (Christoph Deil) 12 years ago.
py27-wxpython.main.log (140.1 KB) - added by petrrr 12 years ago.
main.log from a MacOSX 10.5.8 system

Download all attachments as: .zip

Change History (16)

Changed 12 years ago by cdeil (Christoph Deil)

Attachment: main.log added

comment:1 in reply to:  description Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: jwa@… removed
Owner: changed from macports-tickets@… to jwa@…

Replying to Deil.Christoph@…:

After upgrading from XCode 4.3 to 4.4 on my Lion Macbook, I got the following error:

$ python -c 'import wx'
[snip]
ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core_.so, 2): no suitable image found.  Did find:
	/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx-2.8-mac-unicode/wx/_core_.so: mach-o, but wrong architecture

The wxpython software is only available in a 32-bit version. You must therefore run python in 32-bit mode if you want to use wxpython.

$ arch -i386 python -c 'import wx'

but now the py27-wxpython install fails with a

NameError: global name 'log' is not defined

Yes it had problems locating the "log" function for some reason, but more importantly, what it was trying to use the log function to display was the message "Compiling with an SDK that doesn't seem to exist". The SDKs are in a different location in Xcode 4.3 and 4.4 than in earlier versions and the port might need an update to accommodate that.

comment:2 Changed 12 years ago by macports@…

Can you clarify the last response? I have this error as well: what actions do I need to take to work around it? What does it mean that the port "might" need an update?

comment:3 Changed 12 years ago by jmroot (Joshua Root)

Port: py-wxpython added; py27-wxpython removed

wx uses long-deprecated APIs that were finally removed from the headers in 10.7. It thus can only be built on 10.7+ by using the 10.6 SDK. Xcode 4.4 does not have a 10.6 SDK. The only real fix to this mess is for upstream to release a new stable version that doesn't use the removed APIs.

Cf. #35372

comment:4 Changed 12 years ago by anddam (Andrea D'Amore)

Cc: and.damore@… added

Cc Me!

comment:5 Changed 12 years ago by cdev9@…

I am also having this same problem but I am on Leopard, 10.5.8, and I am trying to re-install. Same messages.

info:build building '_core_' extension :info:build Traceback (most recent call last): :info:build File "setup.py", line 1053, in <module> :info:build other_kw :info:build File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 152, in setup :info:build dist.run_commands() :info:build File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands :info:build self.run_command(cmd) :info:build File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command :info:build cmd_obj.run() :info:build File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build.py", line 127, in run :info:build self.run_command(cmd_name) :info:build File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command :info:build self.distribution.run_command(command) :info:build File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command :info:build cmd_obj.run() :info:build File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build_ext.py", line 339, in run :info:build self.build_extensions() :info:build File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build_ext.py", line 448, in build_extensions :info:build self.build_extension(ext) :info:build File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/build_ext.py", line 498, in build_extension :info:build depends=ext.depends) :info:build File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/ccompiler.py", line 572, in compile :info:build self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts) :info:build File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-wxpython/py27-wxpython/work/wxPython-src-2.8.12.1/wxPython/config.py", line 784, in _compile :info:build compiler_so = _darwin_compiler_fixup(compiler_so, cc_args + extra_postargs) :info:build File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-wxpython/py27-wxpython/work/wxPython-src-2.8.12.1/wxPython/config.py", line 768, in _darwin_compiler_fixup :info:build log.warn("Compiling with an SDK that doesn't seem to exist: %s", :info:build NameError: global name 'log' is not defined :info:build Command failed: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-wxpython/py27-wxpython/work/wxPython-src-2.8.12.1/wxPython" && /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 setup.py --no-user-cfg build :info:build Exit code: 1 :error:build org.macports.build for port py27-wxpython returned: command execution failed :debug:build Error code: CHILDSTATUS 27259 1 :debug:build Backtrace: command execution failed

while executing

"system -nice 15 $fullcmdstring"

("eval" body line 1) invoked from within

"eval system $notty $nice \$fullcmdstring"

invoked from within

"command_exec build"

(procedure "portbuild::build_main" line 8) invoked from within

"$procedure $targetname" :info:build Warning: targets not executed for py27-wxpython: org.macports.activate org.macports.build org.macports.destroot org.macports.install :notice:build Please see the log file for port py27-wxpython for details:

/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-wxpython/py27-wxpython/main.log

comment:6 in reply to:  5 ; Changed 12 years ago by petrrr

Replying to cdev9@…:

I am also having this same problem but I am on Leopard, 10.5.8, and I am trying to re-install. Same messages.

The same problem here, same OS (MacOSX, 10.5.8), Xcode 3.1.4 so it seems not to be related only to Xcode 4.4 update. I'll attach a full main.log from a 10.5.8 system.

[urquell:~] petr% xcodebuild -version
Xcode 3.1.4
Component versions: DevToolsCore-1204.0; DevToolsSupport-1186.0
BuildVersion: 9M2809

Changed 12 years ago by petrrr

Attachment: py27-wxpython.main.log added

main.log from a MacOSX 10.5.8 system

comment:7 in reply to:  6 Changed 12 years ago by petrrr

Replying to Peter.Danecek@…:

Replying to cdev9@…:

I am also having this same problem but I am on Leopard, 10.5.8, and I am trying to re-install. Same messages.

The same problem here, same OS (MacOSX, 10.5.8), Xcode 3.1.4 so it seems not to be related only to Xcode 4.4 update. I'll attach a full main.log from a 10.5.8 system.

By the way: py26-wxpython subport builds fine on the same system! I know, it has quite different dependencies. Let me know if you are interested in an mail.log from this build as well.

comment:8 Changed 11 years ago by mojca (Mojca Miklavec)

Cc: mojca@… added

Cc Me!

comment:9 Changed 11 years ago by mojca (Mojca Miklavec)

Cc: Peter.Danecek@… cdev9@… added
Owner: changed from jwa@… to jwa@…
Version: 2.1.2

comment:10 Changed 11 years ago by mojca (Mojca Miklavec)

Are you still able to reproduce the error?

This actually seems like two unrelated errors here. The one on 10.5 tries to use:

log.warn("Compiling with an SDK that doesn't seem to exist: %s",

and I suspect that wxPython might be smart for you with something like

cflags.append("/Developer/SDKs/MacOSX10.3.9.sdk")

but on the other hand it might indeed be a problem that "log" doesn't exist.

I think I removed setting any SDK on anything else but Lion, but it would be helpful if those experiencing the problem could try to test again with the new port py27-wxpython-2.8 +carbon (or +gtk for that matter).

comment:11 Changed 11 years ago by mojca (Mojca Miklavec)

I reported the bug upstream: http://trac.wxwidgets.org/ticket/15462

Unless I'm mistaken, hitting this error means that there is probably a problem on your OS anyway (like SDK which disappeared - even though wxWidgets should still work in that case), but it still seems like a bug that is still present in the wxPyton 2.9.4.0. Since nobody reported it for 2.9.4, I'll simply wait for the upstream to fix the bug, while I will blindly try to fix 2.8.12.1 by importing the log module.

comment:12 Changed 11 years ago by mojca (Mojca Miklavec)

Resolution: fixed
Status: newclosed

Untested commit r110469 (probably not sufficient for upstream though). Please report back if there are still problems. There are a number of places where log.warn is also used in wxPython sources and I didn't attempt to fix those. I hope these problems will be fixed upstream.

comment:13 Changed 11 years ago by mf2k (Frank Schima)

@mojca: FYI, Trac only allows a single email address for the owned by field.

comment:14 Changed 11 years ago by cdeil (Christoph Deil)

I just wanted to confirm that the issue is solved for me on Mac OS X 10.7 and 10.8. @mojca Thank you for your work!

Note: See TracTickets for help on using tickets.