How to build a snap for Ubuntu 18.04 - not a supported wheel on this platform

I’m trying to build a wxPython based snap on my Ubuntu 18.04 system and getting the error "not a supported wheel on this platform"

$ snapcraft

Pulling testsnap-py

wxPython-4.0.4-cp37-cp37m-linux_x86_64.whl is not a supported wheel on this platform.

Failed to run ‘/home/andy/Devel/snap-examples/v_0.5.1/parts/testsnap-py/install/usr/bin/python3 -m pip download --disable-pip-version-check --dest /home/andy/Devel/snap-examples/v_0.5.1/parts/testsnap-py/python-packages https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04/wxPython-4.0.4-cp37-cp37m-linux_x86_64.whl’: Exited with code 1.

``

The project is a simple one that I found here where the snapcraft.yaml contained:

https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04/wxPython-4.0.1-cp35-cp35m-linux_x86_64.whl

``

which I changed to refer to a 18.04 and Python 3.7 wheel, since I’m running those later versions.

https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04/wxPython-4.0.4-cp37-cp37m-linux_x86_64.whl

``

I thought that would work, since that is the wheel I successfully installed wxPython with:

pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04 wxPython

``

Any idea on why all these wheels get rejected by the snapcraft tool?

https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04/wxPython-4.0.4-cp37-cp37m-linux_x86_64.whl

https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04/wxPython-4.0.3-cp37-cp37m-linux_x86_64.whl

https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04/wxPython-4.0.2-cp37-cp37m-linux_x86_64.whl

``

My platform matches those wheels - doesn’t it?

$ python3 -c “import pip; print(pip.pep425tags.get_platform())”

linux_x86_64

$ python3 -c “import pip; print(pip.pep425tags.get_abi_tag())”

cp37m

$ python3 -c “from pip import pep425tags;print(pep425tags.supported_tags)”

[(‘cp37’, ‘cp37m’, ‘manylinux1_x86_64’), (‘cp37’, ‘cp37m’, ‘linux_x86_64’), (‘cp37’, ‘abi3’, ‘manylinux1_x86_64’), (‘cp37’, ‘abi3’, ‘linux_x86_64’), (‘cp37’, ‘none’, ‘manylinux1_x86_64’), (‘cp37’, ‘none’, ‘linux_x86_64’), (‘cp36’, ‘abi3’, ‘manylinux1_x86_64’), (‘cp36’, ‘abi3’, ‘linux_x86_64’), (‘cp35’, ‘abi3’, ‘manylinux1_x86_64’), (‘cp35’, ‘abi3’, ‘linux_x86_64’), (‘cp34’, ‘abi3’, ‘manylinux1_x86_64’), (‘cp34’, ‘abi3’, ‘linux_x86_64’), (‘cp33’, ‘abi3’, ‘manylinux1_x86_64’), (‘cp33’, ‘abi3’, ‘linux_x86_64’), (‘cp32’, ‘abi3’, ‘manylinux1_x86_64’), (‘cp32’, ‘abi3’, ‘linux_x86_64’), (‘py3’, ‘none’, ‘manylinux1_x86_64’), (‘py3’, ‘none’, ‘linux_x86_64’), (‘cp37’, ‘none’, ‘any’), (‘cp3’, ‘none’, ‘any’), (‘py37’, ‘none’, ‘any’), (‘py3’, ‘none’, ‘any’), (‘py36’, ‘none’, ‘any’), (‘py35’, ‘none’, ‘any’), (‘py34’, ‘none’, ‘any’), (‘py33’, ‘none’, ‘any’), (‘py32’, ‘none’, ‘any’), (‘py31’, ‘none’, ‘any’), (‘py30’, ‘none’, ‘any’)]

``

Or is this a question for the snapcraft people?

Also - see the issue I raised on this matter in the GitHub repo where I found the wxPython snapcraft example.

I don’t know much about snaps, but are you sure snapcraft is using the exact same Python that you are testing with?

···

On Thursday, February 28, 2019 at 9:05:57 PM UTC-8, Andy Bulka wrote:

I’m trying to build a wxPython based snap on my Ubuntu 18.04 system and getting the error "not a supported wheel on this platform"

Robin

That’s a point. Ubuntu 18.04 comes with Python 3.6 by default, and I had to install Python 3.7 myself with sudo apt install python3.7. Sure, I’ve made Python 3.7 the default, via

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2

sudo update-alternatives --config python3

``

and fixed an associated pip3 issue

cd /usr/lib/python3/dist-packages

sudo ln -s apt_pkg.cpython-{36m,37m}-x86_64-linux-gnu.so

sudo apt install python3-pip

``

so maybe yes, perhaps snap is picking up Python 3.6 instead of Python 3.7? The yaml spec file simply refers to

python-version: python3

Perhaps my installation of Python 3.7 is flawed in some way that affects snap. (not sure why installing Python 3.7 is so tricky under linux esp. the hack I had to do above).

I’ll do some more experimentation and report back.

I think a definitive example of a wxPython app distributed as a snap app would be helpful to developers wanting to distribute their apps to Linux systems with a one click install experience for users. So if I can get the example working, it would be a good thing.

Turns out that snaps are a complex area. Even a virgin Ubuntu 18.04 with default Python 3.6 referencing
https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04/wxPython-4.0.4-cp36-cp36m-linux_x86_64.whl

``

fails to build a snap, with an error “The linker version ‘2.23’ used by the base ‘core’ is incompatible with files in this snap:”.

I can build a snap OK on Ubuntu 16.04 though. Looks like all the snap stuff is 16.04 based. Though to be fair, they have recently switched to some sort of multipass virtual machine approach which can target 18.04 using a directive “base: core18”, however there are changes to the snapcraft.yaml file required, which is beyond me at the moment, especially as the snap documentation and terminology is complex and confusing to me.

I could probably achieve what I want by building on my success in 16.04, however there is no official wxPython wheel for Python 3.7 under 16.04. Is this a real technical limitation or just because nobody has bothered to create it? My attempts to build that wheel myself using “pip wheel wxpython” under various environments have failed, and the resulting log files disappear before I can view them.

Does anyone have a wxPython wheel for Python 3.7 under 16.04 that they can share?

I’ve added a builder for Py37 on Ubuntu-16.04, and just uploaded some binaries for 4.0.4 to the usual place.

···

On Sunday, March 3, 2019 at 5:07:18 PM UTC-8, Andy Bulka wrote:

Does anyone have a wxPython wheel for Python 3.7 under 16.04 that they can share?

Robin

Brilliant, thanks Robin!

I’ve written a detailed article on my experiences in getting a wxpython app into the Ubuntu App Store using snap technology.
https://medium.com/@abulka/getting-python-and-wxpython-apps-into-the-ubuntu-app-store-ccca7ae537a3
It’s been a huge learning curve. Hopefully the article will help other wxpython users.