Skip to content

Commit

Permalink
sagemathgh-36411: Fix conda install instructions after setuptools u…
Browse files Browse the repository at this point in the history
…pdate

    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->
- Updates install instructions for use with modern `setuptools`
versions.
- Restore `bootstrap` step in instructions, lost in sagemath#36367
- Unpin `setuptools`.
<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [x] The title is concise, informative, and self-explanatory.
- [ ] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#36411
Reported by: Matthias Köppe
Reviewer(s): Dima Pasechnik, Matthias Köppe, Tobias Diez
  • Loading branch information
Release Manager committed Oct 15, 2023
2 parents b53e1e0 + d0cae80 commit 9f0bda0
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
run: |
# Use --no-deps and pip check below to verify that all necessary dependencies are installed via conda.
pip install --no-build-isolation --no-deps -v -v -e ./pkgs/sage-conf ./pkgs/sage-setup
pip install --no-build-isolation --no-deps -v -v -e ./src
pip install --no-build-isolation --no-deps --config-settings editable_mode=compat -v -v -e ./src
env:
SAGE_NUM_THREADS: 2

Expand Down
5 changes: 1 addition & 4 deletions build/pkgs/setuptools/distros/conda.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
# Set this bound until https://github.com/sagemath/sage/issues/34209 adds support for PEP660 editable builds
# By setting this version bound, we avoid having to include the following in our installation instructions.
# export SETUPTOOLS_ENABLE_FEATURES=legacy-editable
"setuptools<64"
setuptools
1 change: 1 addition & 0 deletions build/pkgs/setuptools_wheel/distros
1 change: 0 additions & 1 deletion build/pkgs/setuptools_wheel/distros/repology.txt

This file was deleted.

33 changes: 15 additions & 18 deletions pkgs/sage-conf_conda/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,21 @@ def run(self):
raise SetupError('No conda environment is active. '
'See https://doc.sagemath.org/html/en/installation/conda.html on how to get started.')

if os.path.exists(os.path.join(SAGE_ROOT, 'config.status')):
print(f'Reusing configured SAGE_ROOT={SAGE_ROOT}')
else:
cmd = f"cd {SAGE_ROOT} && ./configure --enable-build-as-root --with-system-python3=force --disable-notebook --disable-sagelib --disable-sage_conf --disable-doc"
cmd += ' --with-python=$CONDA_PREFIX/bin/python --prefix="$CONDA_PREFIX"'
cmd += ' $(for pkg in $(PATH="build/bin:$PATH" build/bin/sage-package list :standard: --exclude rpy2 --has-file spkg-configure.m4 --has-file distros/conda.txt); do echo --with-system-$pkg=force; done)'
print(f"Running {cmd}")
sys.stdout.flush()
if os.system(cmd) != 0:
if os.path.exists(os.path.join(SAGE_ROOT, 'config.status')):
print("Warning: A configuration has been written, but the configure script has exited with an error. "
"Carefully check any messages above before continuing.")
else:
print(f"Error: The configure script has failed; this may be caused by missing build prerequisites.")
sys.stdout.flush()
PREREQ_SPKG = "_prereq bzip2 xz libffi" # includes python3 SPKG_DEPCHECK packages
os.system(f'cd {SAGE_ROOT} && export PACKAGES="$(build/bin/sage-get-system-packages conda {PREREQ_SPKG})" && [ -n "$PACKAGES" ] && echo "You can install the required build prerequisites using the following shell command" && echo "" && build/bin/sage-print-system-package-command conda --verbose --sudo install $PACKAGES && echo ""')
raise SetupError("configure failed")
cmd = f"cd {SAGE_ROOT} && ./configure --enable-build-as-root --with-system-python3=force --disable-notebook --disable-sagelib --disable-sage_conf --disable-doc"
cmd += ' --with-python=$CONDA_PREFIX/bin/python --prefix="$CONDA_PREFIX"'
cmd += ' $(for pkg in $(PATH="build/bin:$PATH" build/bin/sage-package list :standard: --exclude rpy2 --has-file spkg-configure.m4 --has-file distros/conda.txt); do echo --with-system-$pkg=force; done)'
print(f"Running {cmd}")
sys.stdout.flush()
if os.system(cmd) != 0:
if os.path.exists(os.path.join(SAGE_ROOT, 'config.status')):
print("Warning: A configuration has been written, but the configure script has exited with an error. "
"Carefully check any messages above before continuing.")
else:
print(f"Error: The configure script has failed; this may be caused by missing build prerequisites.")
sys.stdout.flush()
PREREQ_SPKG = "_prereq bzip2 xz libffi" # includes python3 SPKG_DEPCHECK packages
os.system(f'cd {SAGE_ROOT} && export PACKAGES="$(build/bin/sage-get-system-packages conda {PREREQ_SPKG})" && [ -n "$PACKAGES" ] && echo "You can install the required build prerequisites using the following shell command" && echo "" && build/bin/sage-print-system-package-command conda --verbose --sudo install $PACKAGES && echo ""')
raise SetupError("configure failed")

# In this mode, we never run "make".

Expand Down
5 changes: 3 additions & 2 deletions src/doc/en/installation/conda.rst
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ Here we assume that you are using a git checkout.
A different Python version can be selected by replacing ``3.11`` by ``3.9``
or ``3.10`` in these commands.

- Install the build prerequisites and the Sage library::
- Bootstrap the source tree and install the build prerequisites and the Sage library::

$ ./bootstrap
$ pip install --no-build-isolation -v -v --editable ./pkgs/sage-conf_conda ./pkgs/sage-setup
$ pip install --no-build-isolation --config-settings editable_mode=compat -v -v --editable ./src

Expand All @@ -160,7 +161,7 @@ suffices to restart Sage.

After editing any Cython files, rebuild the Sage library using::

$ pip install --no-build-isolation -v -v --editable src
$ pip install --no-build-isolation --config-settings editable_mode=compat -v -v --editable src

In order to update the conda environment later, you can run::

Expand Down

0 comments on commit 9f0bda0

Please sign in to comment.