4.0.0b2 -- undefined symbol: _Py_ZeroStruct

I’m trying to update my Python package to (finally) use Python 3+, coming from 2.7. I wasn’t the one who set up our environment originally, but by word of mouth I’ve heard we used the apt-get approach to install wxPython previously.

After not finding wxPython in the apt-get repositories, I figured I’d try the (personally, preferable) approach of using pip. I installed the prerequisites found HERE. I dealt with a RAM limitation (on a Raspberry Pi) by adding a swap. And, after a few hours or so, the installation finished. I didn’t think to turn on verbose printing, so I don’t have the whole log for it on hand, at least that I’m aware of.

The incantation was:

$ sudo pip3 install --upgrade --find-links Index of /wxPython4/extras/linux/gtk3/ubuntu-16.04 wxPython

The --find-links came from the main wxPython website HERE. We’re running Ubuntu MATE 16.04.

Here is info on the installation:

$ pip3 show wxPython

Name: wxPython

Version: 4.0.0b2

Summary: Cross platform GUI toolkit for Python, “Phoenix” version

Home-page: http://wxPython.org/

Author: Robin Dunn

Author-email: robin@alldunn.com

License: wxWindows Library License (The wxWindows Library Licence – Open Source Initiative)

Location: /usr/local/lib/python3.5/dist-packages

Requires: six

As mentioned, the previous wxPython installation was done using apt-get, so doing a “pip show” doesn’t give anything. However, doing a help(wx) after importing tells me the path to it is:

/usr/lib/python2.7/dist-packages/wx-3.0-gtk2/wx/__init__.py

However, now when I try to “import wx”, I get the following:

Python 3.5.2 (default, Sep 14 2017, 22:51:06)

[GCC 5.4.0 20160609] on linux

Type “help”, “copyright”, “credits” or “license” for more information.

import wx

Traceback (most recent call last):

File “”, line 1, in

File “/usr/local/lib/python3.5/dist-packages/wx/init.py”, line 17, in

from wx.core import *

File “/usr/local/lib/python3.5/dist-packages/wx/core.py”, line 12, in

from ._core import *

ImportError: /usr/local/lib/python3.5/dist-packages/wx/_core.cpython-35m-arm-linux-gnueabihf.so: undefined symbol: _Py_ZeroStruct

Have I missed a step somewhere? Is it still trying to use something from the old installation, which is still around?

Erik Johnson wrote:

I’m trying to update my Python package to (finally) use
Python 3+, coming from 2.7. I wasn’t the one who set up our environment
originally, but by word of mouth I’ve heard we used the apt-get approach to install wxPython previously.

After not finding wxPython in the apt-get repositories, I figured I’d try the (personally, preferable) approach of using pip. I installed the prerequisites found HERE .
I dealt with a RAM limitation (on a Raspberry Pi) by adding a swap. And, after a few hours or so, the installation finished. I didn’t think to turn on verbose printing, so I don’t have the whole log for it on hand, at least that I’m aware of.

The incantation was:

$ sudo pip3 install --upgrade --find-links wxPython

The --find-links came from the main wxPython website HERE . We’re running
Ubuntu MATE 16.04.

Here is info on the installation:

$ pip3 show wxPython

Name: wxPython

Version: 4.0.0b2

Summary: Cross platform GUI toolkit for Python, “Phoenix” version

Home-page:

Author: Robin Dunn

Author-email:

License: wxWindows Library License ()

Location: /usr/local/lib/python3.5/dist-packages

Requires: six

As
mentioned, the previous wxPython installation was done using apt-get, so doing a “pip show” doesn’t give anything. However, doing a help(wx) after importing tells me the path to it is:

/usr/lib/python2.7/dist-packages/wx-3.0-gtk2/wx/__init__.py

However,
now when I try to “import wx”, I get the following:

Python 3.5.2 (default, Sep 14 2017, 22:51:06)

[GCC 5.4.0 20160609] on linux

Type “help”, “copyright”, “credits” or “license” for more information.

import wx

Traceback
(most recent call last):

File “”, line 1, in

File “/usr/local/lib/python3.5/dist-packages/wx/init.py”, line 17, in

from wx.core import *

File “/usr/local/lib/python3.5/dist-packages/wx/core.py”, line 12, in

from ._core import *

ImportError: /usr/local/lib/python3.5/dist-packages/wx/_core.cpython-35m-arm-linux-gnueabihf.so:
undefined symbol: _Py_ZeroStruct

Did you build that instance of Python yourself? If so, did you configure
it with --enable-shared? If so, is that libpython shared library being loaded at runtime when _core is imported? You can check the last item by running:

ldd /usr/local/lib/python3.5/dist-packages/wx/_core.cpython-35m-arm-linux-gnueabihf.so

If not, then you can probably fix it by setting LD_LIBRARY_PATH or editing /etc/ld.so.conf

···

https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04http://wxPython.org/robin@alldunn.comhttps://opensource.org/licenses/wxwindows.php

Robin Dunn

Software Craftsman

http://wxPython.org

I don’t believe we built it, no. It should be what came with Ubuntu MATE.

The output of the ldd seems to be okay with libpython3.5:

$ ldd /usr/local/lib/python3.5/dist-packages/wx/_core.cpython-35m-arm-linux-gnueabihf.so

    linux-vdso.so.1 =>  (0x7efea000)

    /usr/lib/arm-linux-gnueabihf/libarmmem.so (0x76894000)

    libwx_gtk3u_core-3.0.so.0 => /usr/local/lib/python3.5/dist-packages/wx/libwx_gtk3u_core-3.0.so.0 (0x764b3000)

    libwx_baseu_net-3.0.so.0 => /usr/local/lib/python3.5/dist-packages/wx/libwx_baseu_net-3.0.so.0 (0x76473000)

    libwx_baseu-3.0.so.0 => /usr/local/lib/python3.5/dist-packages/wx/libwx_baseu-3.0.so.0 (0x762b2000)

    **libpython3.5m.so.1.0 => /usr/lib/arm-linux-gnueabihf/libpython3.5m.so.1.0 (0x75f5c000)**

    libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0x75e4e000)

    libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0x75dd5000)

    libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0x75dad000)

    libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0x75cc1000)

    libgtk-3.so.0 => /usr/lib/arm-linux-gnueabihf/libgtk-3.so.0 (0x75785000)

    libgdk-3.so.0 => /usr/lib/arm-linux-gnueabihf/libgdk-3.so.0 (0x756ed000)

    libpangocairo-1.0.so.0 => /usr/lib/arm-linux-gnueabihf/libpangocairo-1.0.so.0 (0x756d3000)

    libpango-1.0.so.0 => /usr/lib/arm-linux-gnueabihf/libpango-1.0.so.0 (0x7568e000)

    libcairo.so.2 => /usr/lib/arm-linux-gnueabihf/libcairo.so.2 (0x755d6000)

    libgdk_pixbuf-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libgdk_pixbuf-2.0.so.0 (0x755ad000)

    libgobject-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libgobject-2.0.so.0 (0x75565000)

    libglib-2.0.so.0 => /lib/arm-linux-gnueabihf/libglib-2.0.so.0 (0x7548c000)

    libX11.so.6 => /usr/lib/arm-linux-gnueabihf/libX11.so.6 (0x7539b000)

    libXxf86vm.so.1 => /usr/lib/arm-linux-gnueabihf/libXxf86vm.so.1 (0x75387000)

    libSM.so.6 => /usr/lib/arm-linux-gnueabihf/libSM.so.6 (0x75371000)

    libpng12.so.0 => /lib/arm-linux-gnueabihf/libpng12.so.0 (0x75349000)

    libjpeg.so.8 => /usr/lib/arm-linux-gnueabihf/libjpeg.so.8 (0x75310000)

    libtiff.so.5 => /usr/lib/arm-linux-gnueabihf/libtiff.so.5 (0x752ab000)

    libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0x75287000)

    /lib/ld-linux-armhf.so.3 (0x54b90000)

    libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0x75265000)

    libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0x75252000)

    libexpat.so.1 => /lib/arm-linux-gnueabihf/libexpat.so.1 (0x75229000)

    libutil.so.1 => /lib/arm-linux-gnueabihf/libutil.so.1 (0x75216000)

    libgmodule-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libgmodule-2.0.so.0 (0x75203000)

    libXi.so.6 => /usr/lib/arm-linux-gnueabihf/libXi.so.6 (0x751e9000)

    libXfixes.so.3 => /usr/lib/arm-linux-gnueabihf/libXfixes.so.3 (0x751d5000)

    libcairo-gobject.so.2 => /usr/lib/arm-linux-gnueabihf/libcairo-gobject.so.2 (0x751be000)

    libatk-1.0.so.0 => /usr/lib/arm-linux-gnueabihf/libatk-1.0.so.0 (0x75197000)

    libatk-bridge-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libatk-bridge-2.0.so.0 (0x75168000)

    libepoxy.so.0 => /usr/lib/arm-linux-gnueabihf/libepoxy.so.0 (0x750bd000)

    libpangoft2-1.0.so.0 => /usr/lib/arm-linux-gnueabihf/libpangoft2-1.0.so.0 (0x7509e000)

    libfontconfig.so.1 => /usr/lib/arm-linux-gnueabihf/libfontconfig.so.1 (0x75060000)

    libgio-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libgio-2.0.so.0 (0x74f5e000)

    libXinerama.so.1 => /usr/lib/arm-linux-gnueabihf/libXinerama.so.1 (0x74f54000)

    libXrandr.so.2 => /usr/lib/arm-linux-gnueabihf/libXrandr.so.2 (0x74f3d000)

    libXcursor.so.1 => /usr/lib/arm-linux-gnueabihf/libXcursor.so.1 (0x74f2e000)

    libXcomposite.so.1 => /usr/lib/arm-linux-gnueabihf/libXcomposite.so.1 (0x74f22000)

    libXdamage.so.1 => /usr/lib/arm-linux-gnueabihf/libXdamage.so.1 (0x74f10000)

    libxkbcommon.so.0 => /usr/lib/arm-linux-gnueabihf/libxkbcommon.so.0 (0x74ed1000)

    libwayland-cursor.so.0 => /usr/lib/arm-linux-gnueabihf/libwayland-cursor.so.0 (0x74eba000)

    libwayland-egl.so.1 => /usr/lib/arm-linux-gnueabihf/libwayland-egl.so.1 (0x74ea8000)

    libwayland-client.so.0 => /usr/lib/arm-linux-gnueabihf/libwayland-client.so.0 (0x74e8f000)

    libmirclient.so.9 => /usr/lib/arm-linux-gnueabihf/libmirclient.so.9 (0x74e16000)

    libXext.so.6 => /usr/lib/arm-linux-gnueabihf/libXext.so.6 (0x74dfb000)

    librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0x74de5000)

    libfreetype.so.6 => /usr/lib/arm-linux-gnueabihf/libfreetype.so.6 (0x74d6e000)

    libthai.so.0 => /usr/lib/arm-linux-gnueabihf/libthai.so.0 (0x74d57000)

    libpixman-1.so.0 => /usr/lib/arm-linux-gnueabihf/libpixman-1.so.0 (0x74cce000)

    libxcb-shm.so.0 => /usr/lib/arm-linux-gnueabihf/libxcb-shm.so.0 (0x74cbb000)

    libxcb-render.so.0 => /usr/lib/arm-linux-gnueabihf/libxcb-render.so.0 (0x74ca4000)

    libxcb.so.1 => /usr/lib/arm-linux-gnueabihf/libxcb.so.1 (0x74c80000)

    libXrender.so.1 => /usr/lib/arm-linux-gnueabihf/libXrender.so.1 (0x74c68000)

    libffi.so.6 => /usr/lib/arm-linux-gnueabihf/libffi.so.6 (0x74c52000)

    libpcre.so.3 => /lib/arm-linux-gnueabihf/libpcre.so.3 (0x74bf5000)

    libICE.so.6 => /usr/lib/arm-linux-gnueabihf/libICE.so.6 (0x74bd4000)

    libuuid.so.1 => /lib/arm-linux-gnueabihf/libuuid.so.1 (0x74bc0000)

    liblzma.so.5 => /lib/arm-linux-gnueabihf/liblzma.so.5 (0x74b9f000)

    libjbig.so.0 => /usr/lib/arm-linux-gnueabihf/libjbig.so.0 (0x74b84000)

    libatspi.so.0 => /usr/lib/arm-linux-gnueabihf/libatspi.so.0 (0x74b56000)

    libdbus-1.so.3 => /lib/arm-linux-gnueabihf/libdbus-1.so.3 (0x74b17000)

    libharfbuzz.so.0 => /usr/lib/arm-linux-gnueabihf/libharfbuzz.so.0 (0x74ac7000)

    libselinux.so.1 => /lib/arm-linux-gnueabihf/libselinux.so.1 (0x74aa2000)

    libresolv.so.2 => /lib/arm-linux-gnueabihf/libresolv.so.2 (0x74a82000)

    libmircommon.so.7 => /usr/lib/arm-linux-gnueabihf/libmircommon.so.7 (0x74a45000)

    libmirprotobuf.so.3 => /usr/lib/arm-linux-gnueabihf/libmirprotobuf.so.3 (0x749ea000)

    libcapnp-0.5.3.so => /usr/lib/arm-linux-gnueabihf/libcapnp-0.5.3.so (0x7497a000)

    libmircore.so.1 => /usr/lib/arm-linux-gnueabihf/libmircore.so.1 (0x74964000)

    libboost_system.so.1.58.0 => /usr/lib/arm-linux-gnueabihf/libboost_system.so.1.58.0 (0x74951000)

    libprotobuf-lite.so.9 => /usr/lib/arm-linux-gnueabihf/libprotobuf-lite.so.9 (0x7491f000)

    libdatrie.so.1 => /usr/lib/arm-linux-gnueabihf/libdatrie.so.1 (0x7490a000)

    libXau.so.6 => /usr/lib/arm-linux-gnueabihf/libXau.so.6 (0x748ff000)

    libXdmcp.so.6 => /usr/lib/arm-linux-gnueabihf/libXdmcp.so.6 (0x748eb000)

    libsystemd.so.0 => /lib/arm-linux-gnueabihf/libsystemd.so.0 (0x74894000)

    libgraphite2.so.3 => /usr/lib/arm-linux-gnueabihf/libgraphite2.so.3 (0x7486d000)

    libboost_filesystem.so.1.58.0 => /usr/lib/arm-linux-gnueabihf/libboost_filesystem.so.1.58.0 (0x7484c000)

    libkj-0.5.3.so => /usr/lib/arm-linux-gnueabihf/libkj-0.5.3.so (0x74821000)

    libgcrypt.so.20 => /lib/arm-linux-gnueabihf/libgcrypt.so.20 (0x7478e000)

    libgpg-error.so.0 => /lib/arm-linux-gnueabihf/libgpg-error.so.0 (0x74770000)
···

On Tuesday, November 28, 2017 at 3:47:16 PM UTC-6, Robin Dunn wrote:

Erik Johnson wrote:

I’m trying to update my Python package to (finally) use
Python 3+, coming from 2.7. I wasn’t the one who set up our environment
originally, but by word of mouth I’ve heard we used the apt-get approach to install wxPython previously.

After not finding wxPython in the apt-get repositories, I figured I’d try the (personally, preferable) approach of using pip. I installed the prerequisites found HERE .
I dealt with a RAM limitation (on a Raspberry Pi) by adding a swap. And, after a few hours or so, the installation finished. I didn’t think to turn on verbose printing, so I don’t have the whole log for it on hand, at least that I’m aware of.

The incantation was:

$ sudo pip3 install --upgrade --find-links https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04
wxPython

The --find-links came from the main wxPython website HERE . We’re running
Ubuntu MATE 16.04.

Here is info on the installation:

$ pip3 show wxPython

Name: wxPython

Version: 4.0.0b2

Summary: Cross platform GUI toolkit for Python, “Phoenix” version

Home-page: http://wxPython.org/

Author: Robin Dunn

Author-email: ro...@alldunn.com

License: wxWindows Library License (https://opensource.org/licenses/wxwindows.php)

Location: /usr/local/lib/python3.5/dist-packages

Requires: six

As
mentioned, the previous wxPython installation was done using apt-get, so doing a “pip show” doesn’t give anything. However, doing a help(wx) after importing tells me the path to it is:

/usr/lib/python2.7/dist-packages/wx-3.0-gtk2/wx/__init__.py

However,
now when I try to “import wx”, I get the following:

Python 3.5.2 (default, Sep 14 2017, 22:51:06)

[GCC 5.4.0 20160609] on linux

Type “help”, “copyright”, “credits” or “license” for more information.

import wx

Traceback
(most recent call last):

File “”, line 1, in

File “/usr/local/lib/python3.5/dist-packages/wx/init.py”, line 17, in

from wx.core import *

File “/usr/local/lib/python3.5/dist-packages/wx/core.py”, line 12, in

from ._core import *

ImportError: /usr/local/lib/python3.5/dist-packages/wx/_core.cpython-35m-arm-linux-gnueabihf.so :
undefined symbol: _Py_ZeroStruct

Did you build that instance of Python yourself? If so, did you configure
it with --enable-shared? If so, is that libpython shared library being loaded at runtime when _core is imported? You can check the last item by running:

ldd /usr/local/lib/python3.5/dist-packages/wx/_[core.cpython-35m-arm-linux-gnueabihf.so](http://core.cpython-35m-arm-linux-gnueabihf.so)

If not, then you can probably fix it by setting LD_LIBRARY_PATH or editing /etc/ld.so.conf


Robin Dunn

Software Craftsman

http://wxPython.org

There is no such beast as _Py_ZeroStruct in Python3, which means your so was built incorrectly. You must somehow be getting the python2 headers into your build. Maybe you have an explicit INCLUDE path in your environment at the time you invoke the compiler, either from your shell or from some python startup script? Sometimes when this happens to me I force an error into the header files, “#error crash and burn” so that building the so will fail, you would need to find all the boolobject.h Python2 headers in your system and add that line to them

···

On Tuesday, 28 November 2017 23:36:44 UTC+2, Erik Johnson wrote:

I’m trying to update my Python package to (finally) use Python 3+, coming from 2.7. I wasn’t the one who set up our environment originally, but by word of mouth I’ve heard we used the apt-get approach to install wxPython previously.


ImportError: /usr/local/lib/python3.5/dist-packages/wx/_core.cpython-35m-arm-linux-gnueabihf.so: undefined symbol: _Py_ZeroStruct