-
-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
merge cypari and cypari2 #19
Comments
In my view, this is mostly an problem of user interface. It's trivial to support different kinds of builds. But the hard question is: how does the interface work? What should happen when somebody does |
This is why I proposed in the exchange of e-mails to have two packages |
@videlec With regards to |
@NathanDunfield my idea is not completely clear yet :-) I definitely want both versions to install a cypari package. The best I think will be to have cypari-full as a "virtual package" that do the install gmp, pari, cysignals, cypari-mini in that order. If this is the way to go, we would perhaps better use the name cypari for cypari-mini because it would match the Python module names. However, this change would break backward compatibility of Concerning dependencies on cypari, is it possible to have fine dependencies in pip? I imagine something like: "if cypari-mini is there then fine, otherwise install cypari-full". |
A simple implementation of this idea might be to just have a setup.py option which specifies whether to use system libraries or to build the libraries from scratch. The default would be to use system libraries. That way: |
@videlec wrote:
You can achieve this sort of effect by putting some logic in the dependent package's @culler wrote:
One possible issue: support for Linux wheels in pip is pretty new, and so on some distros |
@videlec @culler For example, one concrete possibility would be to have the
|
With your proposal, if I want the minimal version should I do
It is hard to provide reliable tests to see whether one can build |
@videlec wrote:
Yes, that's right.
I agree that figuring out whether |
Also, I was thinking that perhaps we should use slightly more descriptive names, perhaps |
Then, we might want to stick to a unique I am not sure there is a need for intermediate installations. This is the job of distributions. I see one backward compatibility with this proposal for people who used to install the original cypari in source mode. |
So
Putting this together, a concrete plan would be:
What do people think of such a plan? It seems good to me. |
I think Nathan, Matthias and I will be able to handle it. :^) |
That sounds great to me!
- Marc
…On Fri, Jul 21, 2017 at 10:46 AM, NathanDunfield ***@***.***> wrote:
So pip has an --install-option flag which can be used to pass options
down to setup.py. It seems like this would allow us to cover the backward
compatibility case you mention via something like:
pip install --no-binary --install-option=build-own-pari cypari
Putting this together, a concrete plan would be:
1.
Have a single cypari package on PyPI with the the usual 16 or so
cypari-full binary wheels and a source tarball containing the
Cythonized C source files but not the gmp and pari sources.
2.
Have the source tarball default to cypari-mini unless a suitable flag
is set, in which case it fetches the gmp and pari sources and builds its
own copy of pari from scratch.
What do people think of such a plan? It seems good to me.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#19 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABPhP0YkawD8XN10vYkqjgQxCj61gZDAks5sQMfkgaJpZM4Od2xy>
.
|
I thought a bit more this. One important question is: how to link against The problem is that both have significant disadvantages:
|
I guess what I would prefer is to give the user many options, but make nothing the default. In other words, allow |
You can have dynamic libraries inside a wheel. That's what |
I thought we were proposing three options, with linking as follows:
pip install cypari
(installs a wheel with static linking)
pip install --no-binary cypari
(installs from an sdist with dynamic linking)
pip install --no-binary --install-option=static-link cypari
(installs from an sdist but also builds libpari.a and libgmp.a and
statically links against them)
- Marc
…On Fri, Jul 28, 2017 at 9:29 AM, jdemeyer ***@***.***> wrote:
What do people think of such a plan? It seems good to me.
I thought a bit more this. One important question is: how to link against
libpari? Are we doing static linking (like the current cypari) or dynamic
linking?
The problem is that both have significant disadvantages:
- a static library cannot be shared across modules. So, if there are
other packages which link against PARI, they will use a different
independent copy of PARI. In particular, cysignals should *not* be
built with PARI support in this case (I am assuming that cysignals
will still be a separate package, contrary to what cypari does)
- a dynamic library seems fundamentally incompatible with wheel. You
could ship the dynamic library (the .so file) inside the wheel, but
the directory where the library gets installed might not be in the library
search path. For system installs, this might be OK but for a --user
install, this will almost certainly break.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#19 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABPhP8_zlpd3PrxHYwg8-5oqbUXnIjFJks5sSfBKgaJpZM4Od2xy>
.
|
Fernando,
Does that work on Windows as well?
- Marc
…On Fri, Jul 28, 2017 at 9:39 AM, Isuru Fernando ***@***.***> wrote:
You can have dynamic libraries inside a wheel. That's what numpy, scipy
etc does with openblas.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#19 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABPhP9kkPPaFWCnczNMUDAt__9vckPInks5sSfKagaJpZM4Od2xy>
.
|
Yes. |
I just checked what |
@isuruf: Do other python packages use the version of the openblas library that ships with numpy, or does only the numpy module itself use it? If just the latter, then effectively this is no different than an entirely static wheel. Just to clarify, the second option @culler refers to means: pip install --no-binary cypari |
Embedding shared libraries in the wheel would have several advantages. The
most important one is that it allows more flexibility with the
configuration of modules. Currently we are forced to have only one
extension module which is statically linked against libpari because of
pari's global variables (especially the stack). Separate modules which are
both statically linked cannot share Pari objects since they have different
stacks. Dynamic linking solves this problem.
- Marc
…On Fri, Jul 28, 2017 at 9:54 AM, Isuru Fernando ***@***.***> wrote:
Does that work on Windows as well?
Yes.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#19 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABPhP849Gp_ZHvawzTdGlQFJh6dB1cuUks5sSfYYgaJpZM4Od2xy>
.
|
You are right that it fixes this problem, but that's also the only problem that the |
That is possible, but I am not sure. I don't know what mechanism numpy is
using, but I am guessing that they somehow specify a path within their
package to dlload. If one module can do that, then shouldn't other modules
be able to extract the path from the module which contains the library, and
load it in the same way?
…On Fri, Jul 28, 2017 at 10:05 AM, jdemeyer ***@***.***> wrote:
The most important one is that it allows more flexibility with the
configuration of modules.
You are right that it fixes this problem, but that's also the *only*
problem that the numpy approach fixes.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#19 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABPhP9IMH25ipQ6crb9MlEh8MV_Dhmv7ks5sSfiigaJpZM4Od2xy>
.
|
Both scipy and numpy have |
That seems to be the case on Linux at least. I have no idea what happens on other systems (given that dynamic linking is very system-dependent, you cannot really extrapolate from Linux). Suppose that this really works on all systems where we want to build wheels for. Then we could make a Python package |
One way to check: install |
Yes, it works. Removing |
I took a stab at this. On macOS, the analogous directory appears to be
However,
My guess is the former includes Apple's version of blas. For funsies, I did try deleting On Windows, there is no wheel for |
On which system? |
Linux |
Unfortunately, such an approach would cause I believe this distinction really only matters on Linux in the context of individual users installing For an individual Linux user, perhaps doing |
I asked distutils-sig for the correct way to deal with dynamic libraries and wheels and the answer was basically that it's not supported. So as long as Python doesn't fix this, For |
What's the current status here? It would be very handy to have pre-build wheels and Windows support. |
@tobiasdiez Unfortunately, no progress has been made on this, though I think the two versions are still in reasonably close sync (both on Pari 2.11.3). CyPari is now also hosted here on GitHub and we continue to provide pre-built wheels for Windows, Linux, and Macs on PyPI that include Pari itself as a static library. If |
I think this could be resolved in a very simple way. The unified For building distributable wheels (with the included copy of PARI) to be put on PyPI, like the current Users can then choose between installing the "static" and "dynamic" version by just using |
@mkoeppe That's a promising idea. One potential issue is that the current |
I agree. |
This sounds promising. However, I am worried that a "bundled" install might actually deserve the project. Here are two problematic points that I can see
|
The original cypari written by N. Dunfield and M. Culler will be merged with this project to ease maintenance. Though we are facing several incompatibilities
1 - Windows
cypari can be installed on Windows (however not directly from source, they provide wheels on PyPI). This is at the cost of a fork of cysignals and many special casing.
pari_ulongword
type)Note that these issues refer to plain Windows. Under cygwin, there are no such issues.
2 - Static vs dynamic linking / source vs distribution
cypari currently ships gmp, pari and (a fork of) cysignals. cypari2 contains only sources for a Python module. The original cypari has the advantage of being installable on many platforms using wheels (among other it solves the problem of having cysignals built after libpari).
We propose in the merged version to have three possible ways of installation
pip install cypari
: installs a wheel with static linking and embedded cysignals (i.e. what is currently available with the cypari wheels)pip install --no-binary cypari
: installs from an sdist with dynamic linking from gmp/pari on the system and dependency from cysignals (i.e. the cypari2 version)(optional)
pip install --no-binary --install-option=static-link cypari
: installs from an sdist but also builds libpari.a and libgmp.a and statically links against them (intermediate solution)4 - Cython macro
Cython macros (either defined using
DEF
or viacompile_time_env
option of cythonize) modifies the C code generated by Cython from the pyx files. Having many of them imposes to provide a different versions of the generated C files for each possible values of the constants (in order to allow to build from source without Cython).The Python2/Python3 compatibility can be achieved without any of them (as done in cypari2, see #13). However it seems unavoidable for the Windows port.
The text was updated successfully, but these errors were encountered: