Skip to content
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

sagelib: Generate pyproject.toml and setup.cfg [install_requires], requirements.txt, Pipfile, and src/Pipfile #30913

Closed
mkoeppe opened this issue Nov 14, 2020 · 207 comments

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Nov 14, 2020

After #29500, it is possible to install Python packages built by the Sage distribution into user-defined venvs.

As of Sage 9.3.beta8, sagelib is published as a source distribution on PyPI (https://pypi.org/project/sagemath-standard), but the package does not have proper dependency information yet.

As part of bootstrap, we now generate (1) the pyproject.toml (PEP 517 metadata) and install_requires information, (2) requirements.txt and (3) Pipfile using m4 from the information added in #30719. These files provide 3 distinct ways of setting up a user-defined venv.

(Adding pyproject.toml does not change how the Sage distribution installs sagelib because build/pkgs/sagelib/spkg-install uses setup.py install directly.)

To test - use ./bootstrap and then configure and build the Sage distribution. Then follow the instructions in build/pkgs/sagelib/src/tox.ini:

    #
    # SUPPORTED ENVIRONMENTS:
    #
    # Build dependencies according to requirements.txt (all versions fixed).
    # Use ONLY the wheels built and stored by the Sage distribution (no PyPI):
    #
    #   ./sage -sh -c '(cd build/pkgs/sagelib/src && tox -v -v -v -e python-sagewheels-nopypi)'
    #
    python-sagewheels-nopypi,
    #
    # Build and test without using the concrete dependencies specified by requirements.txt,
    # using the dependencies declared in pyproject.toml and setup.cfg (install-requires) only:
    # Still use ONLY the wheels built and stored by the Sage distribution (no PyPI).
    #
    #   ./sage -sh -c '(cd build/pkgs/sagelib/src && tox -v -v -v -e python-sagewheels-nopypi-norequirements)'
    #
    python-sagewheels-nopypi-norequirements,
    #

Related or follow-up tickets:

References:

CC: @dimpase @tobiasdiez @jhpalmieri @videlec @kiwifb @malb

Component: build

Keywords: sd111

Author: Matthias Koeppe

Branch/Commit: 04da2c6

Reviewer: Dima Pasechnik

Issue created by migration from https://trac.sagemath.org/ticket/30913

@mkoeppe mkoeppe added this to the sage-9.3 milestone Nov 14, 2020
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Nov 15, 2020

Changed dependencies from #30578, #30912 to #30578, #30912, #30719

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Nov 15, 2020

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Nov 15, 2020

Author: Matthias Koeppe

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Nov 15, 2020

Commit: b0f5cd2

@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Nov 15, 2020

Last 10 new commits:

e61929dbuild/pkgs/sphinx/install-requires.txt: Update from gentoo
8fe0e35build/pkgs/python_openid: Unused, remove
ba1d913build/pkgs/itsdangerous: Unused, remove
bb6c4aebuild/pkgs/tox/install-requires.txt: New
d507501build/pkgs/networkx/install-requires.txt: Update from gentoo
c3a9352build/pkgs/pathpy/install-requires.txt: Package removed in #30611, remove
ebd4610build/pkgs/pynac/install-requires.txt: New
6ec00ddbuild/pkgs/{numpy,pillow}/install-requires.txt: New
6bff345Merge branch 't/30719/add_build_pkgs_spkg_install_requires_txt_for_all_python_packages' into t/30913/sagelib__add_setup_cfg__install_requires_
b0f5cd2bootstrap: Generate build/pkgs/sagelib/src/setup.cfg with m4

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 15, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

6094c68build/pkgs/cypari/install-requires.txt: cypari2, not cypari

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 15, 2020

Changed commit from b0f5cd2 to 6094c68

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 20, 2020

Changed commit from 6094c68 to 411cbfb

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 20, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

411cbfbbuild/bin/sage-get-system-packages: Add comment

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 20, 2020

Changed commit from 411cbfb to 3b02c3d

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 20, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

3b02c3dbootstrap: Run bootstrap scripts in build/pkgs/*/, create build/pkgs/sagelib/bootstrap

@kiwifb
Copy link
Member

kiwifb commented Nov 20, 2020

comment:10

Will this be able to deal with optional package declarations (in time)?

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Nov 20, 2020

comment:11

The plan for optional packages is that users would install a package such as sagemath-meataxe or sagemath-tdlib in addition to sagemath-standard.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 27, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

95b74e8Merge tag '9.3.beta2' into t/30913/sagelib__add_setup_cfg__install_requires_

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 27, 2020

Changed commit from 3b02c3d to 95b74e8

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Dec 6, 2020

Changed keywords from none to sd111

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Dec 6, 2020

Changed dependencies from #30578, #30912, #30719 to #30578, #30912

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 10, 2020

Changed commit from 95b74e8 to 8b8b9f9

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 10, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

99b56f5build/pkgs/sagelib/src/tox.ini: Add environment python-norequirements
8b8b9f9Merge tag '9.3.beta3' into t/30913/sagelib__add_setup_cfg__install_requires_

@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Dec 10, 2020

comment:16

Added instructions for testing to the ticket description.
In particular, this reveals the missing dependencies of upstream Python packages tracked in #30922.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 10, 2020

Changed commit from 8b8b9f9 to 3382a47

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 10, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

3382a47build/pkgs/pplpy/install-requires.txt: Switch to git+https link

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 12, 2020

Changed commit from 3382a47 to bf61db4

@dimpase
Copy link
Member

dimpase commented Mar 24, 2021

comment:140
Processing /home/scratch2/dimpase/sage/sage/local/var/lib/sage/wheels/nbformat-5.0.7-py3-none-any.whl
Processing /home/scratch2/dimpase/sage/sage/local/var/lib/sage/wheels/widgetsnbextension-3.5.1-py2.py3-none-any.whl
INFO: pip is looking at multiple versions of ipython to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of ipykernel to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of gmpy2 to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of fpylll to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of <Python from Requires-Python> to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of cython to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of cysignals to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of cypari2 to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of cvxopt to determine which version is compatible with other requirements. This could take a while.
ERROR: Could not find a version that satisfies the requirement jupyterlab-widgets>=1.0.0; python_version >= "3.6" (from ipywidgets)
ERROR: No matching distribution found for jupyterlab-widgets>=1.0.0; python_version >= "3.6"
ERROR: invocation failed (exit code 1)
ERROR: could not install deps [-rrequirements.txt]; v = InvocationError('/home/scratch2/dimpase/sage/sage/build/pkgs/sagelib/src/.tox/python-sagewheels-nopypi/bin/python -m pip install -rrequirements.txt', 1)
python-sagewheels-nopypi finish: getenv /home/scratch2/dimpase/sage/sage/build/pkgs/sagelib/src/.tox/python-sagewheels-nopypi after 1.87 seconds
______________________________________________________________ summary ______________________________________________________________
ERROR:   python-sagewheels-nopypi: could not install deps [-rrequirements.txt]; v = InvocationError('/home/scratch2/dimpase/sage/sage/build/pkgs/sagelib/src/.tox/python-sagewheels-nopypi/bin/python -m pip install -rrequirements.txt', 1)
cleanup /home/scratch2/dimpase/sage/sage/build/pkgs/sagelib/src/.tox/.tmp/package/1/sagemath-standard-9.3rc0.zip

no idea about that jupyterlab-widgets, we don't even seem to have such a package in Sage.

PS. ./sage --pip install jupyterlab-widgets didn't fix it.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 24, 2021

comment:141

We do have the SPKGjupyterlab_widgets. Running make jupyterlab_widgets will fix the problem.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 24, 2021

Changed commit from 6700223 to 04da2c6

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 24, 2021

Branch pushed to git repo; I updated commit sha1. New commits:

04da2c6build/pkgs/ipywidgets: Patch out declaring install-requires of nbformat and jupyterlab-widgets

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 24, 2021

comment:143

Or try with this fix (which makes no change to how we install things in the Sage distribution, but removes excessive dependencies from the wheels)

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 24, 2021

comment:144

(Newer versions of jupyterlab-widgets have more disciplined dependencies via use of jupyter_packaging; after an upgrade in the Sage 9.4 series we will be able to make jupyterlab-widgets a standard package and drop the patch to ipywidgets again.)

@dimpase
Copy link
Member

dimpase commented Mar 24, 2021

comment:145

ohh, nodejs getting installed as a sage package?!

@dimpase
Copy link
Member

dimpase commented Mar 24, 2021

comment:146

Replying to @mkoeppe:

We do have the SPKGjupyterlab_widgets. Running make jupyterlab_widgets will fix the problem.

it did not. trying the latest commit now

@dimpase
Copy link
Member

dimpase commented Mar 24, 2021

comment:147

the patch let it go further, but now this puzzling "no space left on device"

  copying sage/sets/finite_enumerated_set.py -> build/lib.linux-x86_64-3.7/sage/sets
  copying sage/sets/set.py -> build/lib.linux-x86_64-3.7/sage/sets
  error: could not write to 'build/lib.linux-x86_64-3.7/sage/sets/set.py': No space left on device
  Building wheel for sagemath-standard (PEP 517) ... error
  ERROR: Failed building wheel for sagemath-standard
Failed to build sagemath-standard
ERROR: Could not build wheels for sagemath-standard which use PEP 517 and cannot be installed directly
Exception information:
Traceback (most recent call last):
  File "/home/scratch2/dimpase/sage/sage/build/pkgs/sagelib/src/.tox/python-sagewheels-nopypi/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 189, in _main
    status = self.run(options, args)
  File "/home/scratch2/dimpase/sage/sage/build/pkgs/sagelib/src/.tox/python-sagewheels-nopypi/lib/python3.7/site-packages/pip/_internal/cli/req_command.py", line 178, in wrapper
    return func(self, options, args)
  File "/home/scratch2/dimpase/sage/sage/build/pkgs/sagelib/src/.tox/python-sagewheels-nopypi/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 361, in run
    ", ".join(pep517_build_failure_names)
pip._internal.exceptions.InstallationError: Could not build wheels for sagemath-standard which use PEP 517 and cannot be installed directly
Removed build tracker: '/tmp/pip-req-tracker-rj13d2c8'
ERROR: invocation failed (exit code 1)
python-sagewheels-nopypi finish: installpkg /home/scratch2/dimpase/sage/sage/build/pkgs/sagelib/src/.tox/.tmp/package/1/sagemath-standard-9.3rc0.zip after 308.24 seconds

I really don't get is, there is almost 300Gb left on /home/scratch2/
Maybe it tries to copy stuff via some silly place like /tmp or /var or ~/.sage/, and the error comes from this? No idea.


New commits:

04da2c6build/pkgs/ipywidgets: Patch out declaring install-requires of nbformat and jupyterlab-widgets

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 24, 2021

comment:148

pip likes to use temporary directories, probably in /tmp or /var/tmp

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 24, 2021

comment:149

Try setting TMPDIR to something elese

@dimpase
Copy link
Member

dimpase commented Mar 24, 2021

comment:150

is TMPDIR an env.var. I can export before running this job? Or is it something pythonic?

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 24, 2021

comment:151

Just the standard environment variable

@dimpase
Copy link
Member

dimpase commented Mar 25, 2021

comment:152

OK, this run finishes, with some doctest errors, mainly in sphinx/docs related:

$ ./sage -sh -c '(cd build/pkgs/sagelib/src && tox -v -v -v -e python-sagewheels-nopypi)'
...
sage -t --random-seed=0 /home/scratch2/dimpase/sage/sage/src/sage/all.py  # 1 doctest failed
sage -t --random-seed=0 /home/scratch2/dimpase/sage/sage/src/sage/misc/package.py  # 1 doctest failed
sage -t --random-seed=0 /home/scratch2/dimpase/sage/sage/src/sage/misc/sagedoc.py  # 4 doctests failed
sage -t --random-seed=0 /home/scratch2/dimpase/sage/sage/src/sage/docs/conf.py  # 1 doctest failed
sage -t --random-seed=0 /home/scratch2/dimpase/sage/sage/src/sage/interfaces/gap.py  # 1 doctest failed
sage -t --random-seed=0 /home/scratch2/dimpase/sage/sage/src/sage_setup/find.py  # 1 doctest failed
sage -t --random-seed=0 /home/scratch2/dimpase/sage/sage/src/sage_docbuild/__init__.py  # 35 doctests failed
sage -t --random-seed=0 /home/scratch2/dimpase/sage/sage/src/sage_docbuild/sphinxbuild.py  # 13 doctests failed
sage -t --random-seed=0 /home/scratch2/dimpase/sage/sage/src/sage_docbuild/utils.py  # 5 doctests failed

if this is expected, feel free to make it positive review.

@dimpase
Copy link
Member

dimpase commented Mar 25, 2021

Reviewer: Dima Pasechnik

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 25, 2021

comment:153

Thanks for testing! Yes, this looks as expected. The documentation is not built by this invocation. We should disable the corresponding doctests, for example using #30778 - but that's something for the 9.4 series.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 29, 2021

comment:154

Setting priority to blocker to bring this ticket to the attention of the release bot.

@vbraun
Copy link
Member

vbraun commented May 27, 2021

Changed branch from u/mkoeppe/sagelib__add_setup_cfg__install_requires_ to 04da2c6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants