ImportError: No module named _core_

I've just built wxPython-2.8.7.1 on a Solaris 10 box,
successfully it would seem. But when trying to run the
demo I get:

$ python demo.py
Traceback (most recent call last):
   File "demo.py", line 3, in ?
     import Main
   File "/proj/minsat/Sol10-3pp/src/wxPython-src-2.8.7.1/wxPython/demo/Main.py", line 34, in ?
     import wx # This module uses the new wx namespace
   File "/proj/minsat/Sol10-3pp/src/wxPython-src-2.8.7.1/wxPython/wx/__init__.py", line 45, in ?
     from wx._core import *
   File "/proj/minsat/Sol10-3pp/src/wxPython-src-2.8.7.1/wxPython/wx/_core.py", line 4, in ?
     import _core_
ImportError: No module named _core_

Any ideas?

/Lars Stavholm

Lars Stavholm wrote:

I've just built wxPython-2.8.7.1 on a Solaris 10 box,
successfully it would seem. But when trying to run the
demo I get:

$ python demo.py
Traceback (most recent call last):
  File "demo.py", line 3, in ?
    import Main
  File "/proj/minsat/Sol10-3pp/src/wxPython-src-2.8.7.1/wxPython/demo/Main.py", line 34, in ?
    import wx # This module uses the new wx namespace
  File "/proj/minsat/Sol10-3pp/src/wxPython-src-2.8.7.1/wxPython/wx/__init__.py", line 45, in ?
    from wx._core import *
  File "/proj/minsat/Sol10-3pp/src/wxPython-src-2.8.7.1/wxPython/wx/_core.py", line 4, in ?
    import _core_
ImportError: No module named _core_

Any ideas?

From the path names above it looks like you are trying to use wxPython from the build folder and not an installed version. Correct? If so, did you build using "build_ext --inplace" on setup.py command line? That is what is needed to put the binary extension modules into the in-tree wx package. Otherwise you'll want to use the setup.py install command and then make sure that your sys.path is such that it will find the installed wx package before the one in the build tree.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

(For searches) On Ubuntu I solved this by forcing the build to install to the
"standard" locations with the following command:

sudo python build-wxpython.py --build_dir=../bld --wxpy_installdir=/usr
--installdir=/usr

···

--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/ImportError-No-module-named-core-tp2367370p5544677.html
Sent from the wxPython-users mailing list archive at Nabble.com.

Just ran into this error myself. The diagnosis is accurate, I was trying to run the demo from the build folder. But, I was merely following the directions spit out out at the end of the build which said:

------------ BUILD FINISHED ------------

To run the wxPython demo you may need to:

  • set your PYTHONPATH variable to /Users/foobar/Downloads/wxPython-src-2.9.4.0/wxPython
  • set your DYLD_LIBRARY_PATH to /Users/foobar/Downloads/wxPython-src-2.9.4.0/bld/cocoa/lib

And then:

  • Run python demo/demo.py

Since this is the first Python package I’ve ever built, I was clueless until I read this post. After I reset the environment variables to the installed location (see below), the demo finally ran!! (I’ve been fighting with wx, & wxPython for days. This is the first version that has actually run correctly on OS X 10.8… 64-bit/Cocoa only)

PYTHONPATH:
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx-2.9.4-osx_cocoa/wx

DYLD_LIBRARY_PATH:
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/wx-2.9.4-osx_cocoa/wx/lib

Hope this additional information helps those who land on this page in the future.

D.

···

On Wednesday, March 7, 2012 11:33:57 AM UTC-5, GAndrewStone wrote:

(For searches) On Ubuntu I solved this by forcing the build to install to the
“standard” locations with the following command:
sudo python build-wxpython.py --build_dir=…/bld --wxpy_installdir=/usr
–installdir=/usr


View this message in context: http://wxpython-users.1045709.n5.nabble.com/ImportError-No-module-named-core-tp2367370p5544677.html
Sent from the wxPython-users mailing list archive at Nabble.com.

On Wednesday, March 7, 2012 11:33:57 AM UTC-5, GAndrewStone wrote:

(For searches) On Ubuntu I solved this by forcing the build to install to the
“standard” locations with the following command:
sudo python build-wxpython.py --build_dir=…/bld --wxpy_installdir=/usr
–installdir=/usr


View this message in context: http://wxpython-users.1045709.n5.nabble.com/ImportError-No-module-named-core-tp2367370p5544677.html
Sent from the wxPython-users mailing list archive at Nabble.com.