pgsql-io/multicorn2

Cannot install wheel using pip3

ShaheedHaque opened this issue · 12 comments

If I try to install using pip3 like this:

sudo -H pip3 install https://github.com/pgsql-io/multicorn2/archive/refs/heads/main.zip

I get the following output:

$ sudo -H pip3 install https://github.com/pgsql-io/multicorn2/archive/refs/heads/main.zip
Collecting https://github.com/pgsql-io/multicorn2/archive/refs/heads/main.zip
  Using cached https://github.com/pgsql-io/multicorn2/archive/refs/heads/main.zip
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: multicorn
  Building wheel for multicorn (setup.py) ... done
  Created wheel for multicorn: filename=multicorn-_VERSION_-cp310-cp310-linux_x86_64.whl size=56930 sha256=cbd0f43a5e49549daa894ce760e882db87b7ba55cbef8ec6128ed0edcd991f3f
  Stored in directory: /tmp/pip-ephem-wheel-cache-h8shfyj5/wheels/41/71/78/a662473feed8fa50cd3e50cb521dd2a03c4e4882a89bf26b41
  WARNING: Built wheel for multicorn is invalid: Metadata 1.2 mandates PEP 440 version, but '-VERSION-' is not
Failed to build multicorn
Installing collected packages: multicorn
  Running setup.py install for multicorn ... done
  DEPRECATION: multicorn was installed using the legacy 'setup.py install' method, because a wheel could not be built for it. A possible replacement is to fix the wheel build issue reported above. Discussion can be found at https://github.com/pypa/pip/issues/8368
Successfully installed multicorn--VERSION-

I assume this is related to this line:

version='__VERSION__',

But I'm not sure I understand how the string constant is supposed to be set up. AFAICS, the result is not correctly installed in the sense that /usr/share/postgresql/13/extension/multicorn.control is missing, and the extension cannot be used.

This is on Ubuntu 22.04 using postgres-13 installed from the Postgres-project install (not the default Ubuntu 22.04 install).

luss commented

kewl, I'll take a look this afternoon.

luss commented

I had another thought... Does the original Multicorn work the way you are asking? Because multicorn2 itself is a postgresql extension, I'm not so sure it makes sense to install via pip. FDW's that use multicorn2 are (usually) pure python and therefore are installable (usually) via PIP.

On Ubuntu (and I suppose on other Debians), it isn't terribly clear because apt is used to install standard packages as well as python packages (even pure Python). I presume this is because dependency handling uses just one model, and indeed a model which is historically more complete than say pip.

Using pip on top of apt-installed packages is a bit odd, but the real kicker is that many of the apt python packages are FAR older that what pypi.org has.

So, while I take your point, I would say that pip is used for many Python packages which wrap C libraries, and using pip for them is fine too. Finally, I would say that the very presence of a setup.py suggests treating it as such was the intent.

luss commented

I'm not sure I see a real difference between your 3) and your 4). Firstly, any C based Python package will need the compile step to be supported by the corresponding headers and libs. Second, the only alternative is to have support for the native package format for say .rpm,.deb, Windows and Mac.

For all its flaws, a modern pip installable is actually a reasonable, portable answer! This true both for the user and the maintainer, even with the need to ensure that the necessary headers and library devel support is present.

One last thought. This fix does not require that multicorn2 be published via PyPi: all it does it to allow the user to build and install it with current pip tooling. For that reason if no other, please consider merging.

luss commented

@luss I don't mean to be pushy, but a merge sooner rather than later would be great. OTOH, if you are not going to get to it for a while, it'd be good to know that and I can plan my migration to pg14 accordingly.

luss commented

Gulp, not sure what I'm signing myself up for, but OK!

luss commented
luss commented

I have invited you to the team with Write priv's. Now we can chat offlist, and you are free to commit things we discuss to the project. And so it begins. :-)