24

I would think this is an easy question, but I haven't found an answer yet, so I'm posting here.

I have a Python 3 app, that I package into a platform wheel. I have the setup.py and everything works as expected. The only thing I can't figure out is the generated wheel always includes an ABI tag (like"cp34m"), and when that's included I find that I can't actually install the wheel via pip. (My build script installs the latest pip, setuptools, and wheel before running.)

The solution is simple. I just change the file name of the wheel to change "cp34m" to "none". This is obviously easy to add into my build script, but I wonder if it's possible to set an option for bdist_wheel or something so that the .whl file that's generated has none set on its own?

The command I use to create the wheel is (for example on x64):

python setup.py bdist_wheel --plat-name win_amd64

That creates a wheel like:

mpf_mc-0.30.0.dev269-cp34-cp34m-win_amd64.whl

Which I then rename before uploading to PyPI to:

mpf_mc-0.30.0.dev269-cp34-none-win_amd64.whl

Everything seems to work fine by manually renaming it. But I wonder if this the right way to do it, or am I missing something?

Machavity
  • 30,841
  • 27
  • 92
  • 100
Brian Madden
  • 951
  • 1
  • 8
  • 21
  • I have the same question and I'm puzzled by this. http://stackoverflow.com/questions/35005870/christoph-gohlke-naming-convention-for-unofficial-windows-binaries-for-python-ex?rq=1 didn't enlight me either. – Stephan Aug 12 '16 at 06:52

2 Answers2

1

This is difficult to answer without seeing your setup.py file, but I will give my thought:

  • the naming of the wheel postfix is a combination of the python tag, ABI tag, and platform tag, as shown here. But it sounds like you already knew that.

Reason Your Solution Works

So, I would guess the reason things do not work when you use the original name and do work once you change the name is:

  1. pip will not let you install things using the m part of the ABI tag... probably because it has not been vetted, and not because of any real problem, and/or
  2. you are not actually using any aspects of Cython that depend upon malloc.

Reason The ABI Tag Is Being Added

Now, if we assume that there is no real need for the m tag, as I said, then the reason it is probably being added is that you have a dependency in your setup file that needs it.

I am primarily a data scientist, so I will use a common example from there: numpy is compiled down to C code and has many Python calls to that lower level language to boost speed. Even if I write pure Python 3 code, and do not even use numpy anywhere, if I have a dependency in my setup file that asks for numpy, then I will have a platform-specific build. However, more common is that I am in fact using numpy, but I may not be using any aspects of it that rely upon C. (in numpy, that is rare, as all array initializations happen in C, but I hope you get the idea.) I do not know what forces ABI-specific builds, but I would guess you have some dependency asking for it, but which is never really used.

Mike Williamson
  • 4,915
  • 14
  • 67
  • 104
0

It seems like something has changed since you posted your question - I just tried your command to create a wheel file on my own project:

~$ python setup.py bdist_wheel --plat-name win_amd64

and the result file is:

my_project-1.0.0-py2-none-win_amd64.whl
kchomski
  • 2,872
  • 20
  • 31