GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — BLD: add libquadmath to licences and other tweaks by mattip · Pull Request #24753 · numpy/numpy

Conversation

@mattip

@mattip mattip commented Sep 20, 2023

Copy link
Copy Markdown
Member

As pointed out in MacPython/openblas-libs#114, we are bundling libquadmath which is licensed differently than the rest of the gcc runtimes. This PR

  • adds its license, which is complicated. Most of it is copyright "Sun, with use freely granted". But there are a few files licensed under the LGPL2.0 and LGPL2.1, and even one file that is "Public domain". I am not sure what the implications are.
  • Change the canonical location of OpenBlas to https://github.com/OpenMathLib/OpenBLAS
  • Add OpenBLAS and LAPACK licences to macos, they were missing?
  • Remove the msvc runtime licenses from windows, we do not bundle it (anymore?)
  • tweak the locations of the bundles in the site-packages tree.

cc @rgommers for review?

I think this should be backported. While #24613 to use Accelerate for macos-arm64 was backported, I see the 1.26 wheels are still using OpenBLAS, so the license should not change.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mattip
BLD: add libquadmath to licences and other tweaks
7fc9f16
@github-actions github-actions Bot added the 36 - Build Build related PR label Sep 20, 2023
@rgommers

rgommers commented Sep 20, 2023

Copy link
Copy Markdown
Member

adds its license, which is complicated. Most of it is copyright "Sun, with use freely granted". But there are a few files licensed under the LGPL2.0 and LGPL2.1, and even one file that is "Public domain". I am not sure what the implications are.

Where are you seeing that? https://github.com/gcc-mirror/gcc/blob/master/libquadmath/COPYING.LIB looks like a standard LGPL license.

we do not bundle it (anymore?)

Correct, we used to bundle libmsvcrt140.dll (from memory, I may have misspelled that by one letter) but aren't doing that anymore.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip

mattip commented Sep 20, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

I took the libquadmath license from the appropriate section in my (debian) /usr/share/doc/gcc-12-base/copyright. Note that that file mistakenly lists the wrong license for ldexpq.c, so I corrected that (I deleted the exception, it is licenses like the default in that library). I am trying to file a debian bug for that.

Edit: here is the debian bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1052314

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip

mattip commented Sep 20, 2023

Copy link
Copy Markdown
Member Author

Diving into the actual code will show that each file has a license, most are like this

/* e_acoshl.c -- long double version of e_acosh.c.
 * Conversion to long double by Jakub Jelinek, [email protected].
 */

/*
 * ====================================================
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
 *
 * Developed at SunPro, a Sun Microsystems, Inc. business.
 * Permission to use, copy, modify, and distribute this
 * software is freely granted, provided that this notice
 * is preserved.
 * ====================================================
 */
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rgommers

rgommers commented Sep 20, 2023

Copy link
Copy Markdown
Member

I took the libquadmath license from the appropriate section in my (debian) /usr/share/doc/gcc-12-base/copyright

I don't think we need to include very granular per-file copyright statements. The upstream GCC license I linked is standard LGPL as far as I can tell.

Diving into the actual code will show that each file has a license, most are like this

That is perfectly normal, but not really relevant imho. We also have public-domain code in NumPy and SciPy, and since that's BSD-3 compatible we make no attempt to list per-file differences in our own LICENSE.txt.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip

mattip commented Sep 20, 2023

Copy link
Copy Markdown
Member Author

libgfortan, as the LICENSE text in NumPy currently indicates, is released under gpl v3 with an exception. libquadmath, as you point out, is released under lgpl 2.1 and some files are specifically LGPL2.0 or later. So I can simplify the PR to use LGPL2.1 for libquadmath. A single file has a "Public Domain" license, I guess we can put that in the "more permissive" category and not list it separately.

rgommers reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip
BLD simplify libquadmath license to LGPL2.1, from review [skip cirrus…
2ea4d9a
…] [skip azp] [skip actions]
rgommers
rgommers reviewed Sep 21, 2023
View reviewed changes

@rgommers rgommers left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Matti. A few minor comments, and one that looks critical: the path to the bundled libraries for the Windows wheels is indeed numpy.libs\ now and not .libs, however the _distributor_init.py still uses .libs. I don't quite understand how this isn't broken. If you have a Windows machine at hand, can you check?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread tools/wheels/LICENSE_linux.txt Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tools/wheels/LICENSE_osx.txt Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tools/wheels/LICENSE_win32.txt Resolved

Uh oh!

There was an error while loading. Please reload this page.

@rgommers rgommers mentioned this pull request Sep 21, 2023
LICENSES_bundled.txt content not included in license file for wheels in 1.26.0 #24764
Closed
@rgommers rgommers added the 09 - Backport-Candidate PRs tagged should be backported label Sep 21, 2023
@mattip

mattip commented Sep 21, 2023

Copy link
Copy Markdown
Member Author

The path to the bundled libraries for the Windows wheels is indeed numpy.libs\ now and not .libs, however the _distributor_init.py still uses .libs. I don't quite understand how this isn't broken. If you have a Windows machine at hand, can you check?

A bit of magic that came in with the overly-large #23838 and I didn't realize at the time. We now use delvewheel to repair the wheel, which adds this snippet to the beginning of numpy/__init__.py:

# start delvewheel patch
def _delvewheel_patch_1_5_1():
    import os
    libs_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, 'numpy.libs'))
    if os.path.isdir(libs_dir):
        os.add_dll_directory(libs_dir)


_delvewheel_patch_1_5_1()
del _delvewheel_patch_1_5_1
# end delvewheel patch

so actually, we don't need the _developer_init.py rewrite anymore.

rgommers reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip

mattip commented Sep 21, 2023

Copy link
Copy Markdown
Member Author

The _distributor_init.py rewrite changes after the scipy-openblas PR #24749 anyway. If we can use the scipy-openblas wheel at runtime, then all platforms will need a import scipy-openblas in the _dsitributor_init.py, so I won't bother with a cleanup PR to remove the unneeded file change for 1.26.1.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip
BLD: use SPDX short specifiers, fixes from review
446da4e
@mattip

mattip commented Sep 21, 2023

Copy link
Copy Markdown
Member Author

I fixed the review comments and changed all the specifiers to be spdx compliant

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rgommers

rgommers commented Sep 21, 2023

Copy link
Copy Markdown
Member

so actually, we don't need the _developer_init.py rewrite anymore.

We do on Python 3.9: conda/conda#10897 (comment). We should fix _distributor_init.py in 1.26.1, it's a 1 line fix.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip

mattip commented Sep 21, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

For python3.9 or conda, delvewheel does it differently:

# start delvewheel patch
def _delvewheel_patch_1_5_1():
    import ctypes
    import os
    import platform
    import sys
    libs_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, 'numpy.libs'))
    is_conda_cpython = platform.python_implementation() == 'CPython' and (hasattr(ctypes.pythonapi, 'Anaconda_GetVersion') or 'packaged by conda-forge' in sys.version)
    if sys.version_info[:2] >= (3, 8) and not is_conda_cpython or sys.version_info[:2] >= (3, 10):
        if os.path.isdir(libs_dir):
            os.add_dll_directory(libs_dir)
    else:
        load_order_filepath = os.path.join(libs_dir, '.load-order-numpy-1.26.0')
        if os.path.isfile(load_order_filepath):
            with open(os.path.join(libs_dir, '.load-order-numpy-1.26.0')) as file:
                load_order = file.read().split()
            for lib in load_order:
                lib_path = os.path.join(os.path.join(libs_dir, lib))
                if os.path.isfile(lib_path) and not ctypes.windll.kernel32.LoadLibraryExW(ctypes.c_wchar_p(lib_path), None, 0x00000008):
                    raise OSError('Error loading {}; {}'.format(lib, ctypes.FormatError()))


_delvewheel_patch_1_5_1()
del _delvewheel_patch_1_5_1
# end delvewheel patch


Edit: Note .load-order-numpy-1.26.0 contains the mangled name of the DLL libopenblas64__v0.3.23-293-gc2f4bdbb-gcc_10_3_0-65e29aac85b9409a6008e2dc84b1cc09.dll

I agree we should make CI more like delvewheel repair and use numpy.libs in the azure runs.

rgommers reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mattip added 2 commits September 21, 2023 10:33
@mattip
BLD: only use openblas_support.make_init() in CI, fix paths
0b2f48a
@mattip
fix wheel building on aarch64 [skip actions][skip cirrus][wheel build]
b22dceb
@mattip mattip mentioned this pull request Sep 21, 2023
REL: fix license concatenation for wheels we distribute [wheel build] #24765
Closed
mattip and others added 4 commits September 21, 2023 10:46
@mattip
linting [wheel build]
14ae2d6
@mattip
fix github CI dll copy path, fix calling script on cirrus [wheel build]
0d4b78d
@rgommers @mattip
REL: fix license concatenation for wheels we distribute [wheel build]
6d8db6c
Closes numpygh-24764
@mattip
fix windows CI [wheel build][skip azp]
607b8c6
@mattip

mattip commented Sep 21, 2023

Copy link
Copy Markdown
Member Author

I cherry-picked the change from #24765 into this PR

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip

mattip commented Sep 21, 2023

Copy link
Copy Markdown
Member Author

Closes #24764

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip
fix aarch64 wheel build [wheel build][skip azp]
0abf5ec
@rgommers rgommers added this to the 2.0.0 release milestone Sep 21, 2023
rgommers
rgommers approved these changes Sep 21, 2023
View reviewed changes

@rgommers rgommers left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks Matti! I'll squash-merge this for ease of backporting.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rgommers
rgommers merged commit 085665c into numpy:main Sep 21, 2023
@charris

charris commented Sep 21, 2023

Copy link
Copy Markdown
Member

This is an uncertain backport due to the changes made during the testing cleanup. I'm tempted to just take all the changes into 1.26.x, but that requires some checking that nothing gets lost . 2.0.0 and 1.26.x do build the same wheels at this point.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rgommers

rgommers commented Sep 23, 2023

Copy link
Copy Markdown
Member

It looks like all changes are okay to backport here, except possibly the env var removal in linux.yml - but that's unrelated to the rest of this PR so can be discarded.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

charris pushed a commit to charris/numpy that referenced this pull request Sep 23, 2023
@mattip @charris
BLD: add libquadmath to licences and other tweaks (numpy#24753)
1564b42
Other improvements:

- use SPDX short specifiers, fixes from review
- only use `openblas_support.make_init()` in CI, fix paths
- fix license concatenation for wheels we distribute

Closes numpygh-24764
@charris charris mentioned this pull request Sep 23, 2023
BLD: add libquadmath to licences and other tweaks (#24753) #24785
Merged
charris pushed a commit to charris/numpy that referenced this pull request Sep 24, 2023
@mattip @charris
BLD: add libquadmath to licences and other tweaks (numpy#24753)
e6a9786
Other improvements:

- use SPDX short specifiers, fixes from review
- only use `openblas_support.make_init()` in CI, fix paths
- fix license concatenation for wheels we distribute

Closes numpygh-24764
charris added a commit that referenced this pull request Sep 24, 2023
@charris
Merge pull request #24785 from charris/backport-24753
2d2d856
BLD: add libquadmath to licences and other tweaks (#24753)
@rgommers rgommers mentioned this pull request Sep 25, 2023
MAINT: fix licence path win #24793
Merged
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Sep 26, 2023
@charris charris removed this from the 2.0.0 release milestone Sep 26, 2023
charris pushed a commit to charris/numpy that referenced this pull request Nov 11, 2023
@mattip @charris
BLD: add libquadmath to licences and other tweaks (numpy#24753)
a7315a3
Other improvements:

- use SPDX short specifiers, fixes from review
- only use `openblas_support.make_init()` in CI, fix paths
- fix license concatenation for wheels we distribute

Closes numpygh-24764
@mattip mattip mentioned this pull request Jul 30, 2024
Discrepancy between library information displayed by "pip show numpy" and actual installation #27080
Closed
@TimotheusBachinger TimotheusBachinger mentioned this pull request Nov 25, 2024
fix build #27836
Closed
@rgommers rgommers mentioned this pull request Jun 2, 2025
DOC: Wrong SPDX identifier for OpenBLAS and LAPACK scipy/scipy#23061
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@rgommers rgommers rgommers approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

36 - Build Build related PR

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@mattip @rgommers @charris
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.