-
-
Notifications
You must be signed in to change notification settings - Fork 613
Update conda instructions #39515
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
base: develop
Are you sure you want to change the base?
Update conda instructions #39515
Conversation
mamba is great, and it's sometimes a bit faster than conda still. But conda has finally upgraded their solver so the conda solver works perfectly fine for our purposes.
it's figured out correctly automatically on Linux on macOS (tested at SD128.)
most people reading this probably have no idea what channels are.
@@ -156,5 +131,5 @@ To build the documentation, use:: | |||
|
|||
You can update the conda lock files by running | |||
``.github/workflows/conda-lock-update.py`` or by running | |||
``conda-lock --platform linux-64 --filename environment-3.11-linux.yml --lockfile environment-3.11-linux.lock`` | |||
``conda-lock --platform linux-64 --filename environment-3.12-linux.yml --lockfile environment-3.12-linux.lock`` |
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.
I updated some strings in this file. Not that it really matters but maybe it is going to keep the commands valid literally for a little bit longer.
This comment was marked as resolved.
This comment was marked as resolved.
@mantepse, the instructions here seem to work on macOS/Linux. |
src/doc/en/installation/conda.rst
Outdated
|
||
$ conda env update --file environment-3.12-linux.yml | ||
|
||
If you want to use Jupyter notebooks, you need to install JupyterLab and the SageMath kernel:: |
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.
I'm not sure if it's possible to do this, but if it is could you also explain how to create a Jupyter kernel for use in an existing/system Jupyter installation? This is something I've had trouble doing in conda so if there's a way to do it it would be nice to document.
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.
That's more complicated. You need to wrap things into an activation script and it's going to end up being more brittle. I am not sure whether I would want to advertise this here. (And I also don't want to test whether these instructions really work on Linux/macOS or even WSL.)
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.
Fair enough.
Looks good, just waiting for the CI-generated documentation preview to finish so I can verify there are no formatting issues before marking as positive review. |
Doc build failure seems relevant. The logs say something about an issue with the code/literal blocks in the file you're modifying here, so I'd start with checking those. |
|
||
where ``X`` is version of Python, e.g. ``3.9``. | ||
$ conda create -n sage sage |
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.
If you only keep one, I recommend using mamba. It's drop-in replacement and much faster.
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.
I personally use mamba but conda works just fine and it is available on the setups that we are covering here (see the top) i.e., also on miniconda and anaconda.
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.
I agree with maintaining conda instructions as I think it's a bit more widely available in various distro repositories. No opinion on keeping both or having just conda.
@@ -73,51 +57,36 @@ environment for Sage development. | |||
|
|||
Here we assume that you are using a git checkout. | |||
|
|||
- Optionally, set the build parallelism for the Sage library. Use |
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.
think about it, why does this section even exist? isn't https://doc-release--sagemath.netlify.app/html/en/installation/meson enough?
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.
Yes, eventually this section should be removed. But I understood that the meson setup isn't sufficiently stable and some people are using the setup described here.
@tobiasdiez @dimpase do you think that the meson setup should be recommended for everybody that uses conda dependencies and we should just remove this page altogether?
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.
It's been a few months since I tried using the meson setup but I remember having issues with it.
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.
Yes, in my opinion the meson build is stable enough to be the default for conda-based setups. So I would welcome if we would merge the meson instructions with the conda ones, but would of course understand if you don't want to do this as part of this PR.
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.
@vincentmacri would you have the time to try if the meson setup works for you now? I just tried it and it worked fine for me. I'd prefer to delete a page from the documentation if possible.
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.
Meson is still giving me issues. It's possible the problem is on my end, but I'm following the steps in the documentation so if something is wrong on my end I think the meson documentation needs to be updated to be more clear.
On Fedora 41, from the root of the develop branch of my sage fork which has no changes from the develop branch in the sagemath repo:
conda env create --file environment-3.11-linux.yml --name sage-meson
conda activate sage-meson
pip install --no-build-isolation --editable .
./sage
gives the error:
Error in sys.excepthook:
Traceback (most recent call last):
File "/home/vince/.conda/envs/sage-dev/lib/python3.11/pathlib.py", line 1250, in is_dir
return S_ISDIR(self.stat().st_mode)
^^^^^^^^^
AttributeError: 'str' object has no attribute 'stat'
Original exception was:
Traceback (most recent call last):
File "/home/vince/Documents/git/sage/src/bin/sage-ipython", line 15, in <module>
app.initialize()
File "/home/vince/.conda/envs/sage-dev/lib/python3.11/site-packages/traitlets/config/application.py", line 118, in inner
return method(app, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vince/.conda/envs/sage-dev/lib/python3.11/site-packages/IPython/terminal/ipapp.py", line 278, in initialize
self.init_shell()
File "/home/vince/Documents/git/sage/src/sage/repl/interpreter.py", line 854, in init_shell
self.shell.extension_manager.load_extension(SAGE_EXTENSION)
File "/home/vince/.conda/envs/sage-dev/lib/python3.11/site-packages/IPython/core/extensions.py", line 62, in load_extension
return self._load_extension(module_str)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vince/.conda/envs/sage-dev/lib/python3.11/site-packages/IPython/core/extensions.py", line 79, in _load_extension
if self._call_load_ipython_extension(mod):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/vince/.conda/envs/sage-dev/lib/python3.11/site-packages/IPython/core/extensions.py", line 129, in _call_load_ipython_extension
mod.load_ipython_extension(self.shell)
File "/home/vince/Documents/git/sage/src/sage/repl/__init__.py", line 6, in load_ipython_extension
sage.repl.ipython_extension.load_ipython_extension(*args)
File "/home/vince/Documents/git/sage/src/sage/misc/misc.py", line 1029, in wrapper
result = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/home/vince/Documents/git/sage/src/sage/repl/ipython_extension.py", line 744, in load_ipython_extension
SageCustomizations(shell=ip)
File "/home/vince/Documents/git/sage/src/sage/repl/ipython_extension.py", line 591, in __init__
import sage.all # noqa: F401
^^^^^^^^^^^^^^^
File "/home/vince/Documents/git/sage/src/sage/all.py", line 97, in <module>
from sage.graphs.all import *
File "/home/vince/Documents/git/sage/src/sage/graphs/all.py", line 9, in <module>
from sage.graphs.graph import Graph
File "/home/vince/Documents/git/sage/src/sage/graphs/graph.py", line 436, in <module>
class Graph(GenericGraph):
File "/home/vince/Documents/git/sage/src/sage/graphs/graph.py", line 9273, in Graph
from sage.graphs.connectivity import minimal_separators
ImportError: cannot import name 'minimal_separators' from 'sage.graphs.connectivity' (/home/vince/Documents/git/sage/src/sage/graphs/connectivity.cpython-311-x86_64-linux-gnu.so)
111
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.
/home/vince/Documents/git/sage/src/sage/repl/ipython_extension.py
Implies your sage git repository root is /home/vince/Documents/git/sage/
.
ImportError: cannot import name 'minimal_separators' from 'sage.graphs.connectivity' (/home/vince/Documents/git/sage/src/sage/graphs/connectivity.cpython-311-x86_64-linux-gnu.so)
implies the .so
file is found right next to the .pyx
file.
This should not normally happen, normally meson builds out of source.
Maybe you need to do the following
If you have previously build Sage in-place, you first have to delete the already compiled files, e.g. with shopt -s globstar followed by rm src/**/*.so or for f in src/**/*.so ; do mv "$f" "$f.old"; done. Moreover, remove the old generated files with find src/sage/ext/interpreters -type f ! -name 'meson.build' -delete. Also uninstall the ‘old’ sage packages with pip uninstall sage-conf sage-setup sagemath-standard.
That said, I find git clean -fxd
easier (though it might be more brutal because it may remove some user-generated files that is already gitignored)
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.
I had tried what the doc mentioned to remove old generated files before I posted that error. After doing git clean -fxd
though everything worked. I guess the meson conda build works for me now. Thanks!
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.
That's weird (maybe your shell doesn't support globstar? Are you using something that is not bash?)
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.
That's weird (maybe your shell doesn't support globstar? Are you using something that is not bash?)
Nope, I'm using bash.
Documentation preview for this PR (built with commit 6b742c6; changes) is ready! 🎉 |
There's a formatting issue, some of the text is appearing in code blocks: https://doc-pr-39515--sagemath.netlify.app/html/en/installation/conda |
Sorry for making such silly mistakes in this PR. I'll try to review it myself quickly when the docbuild is ready. |
while that statement might be technically true somehow, I think for most people this just "builds" Sage. That it is "installed" somehow is maybe misleading.
Why do you think mamba is unnecessary? Even though conda now uses the same solver, mamba is still faster (as it's written in c++) in my experience |
I don't think it's unnecessary, I prefer it myself after all. I just think that I don't want to complicate things here. conda is fast enough for running this one command. When people get into doing more with conda packages, they will eventually find out about mamba and make their own choice. I just found that time and again the conda/conda-forge/mamba is a lot of vocabulary to learn (and then mostly forget again) that confuses people who don't care about packaging. We are also explaining things for anaconda and miniconda here. They don't have mamba (unless something has changed) so it adds to the confusion for those people.
Afaik, a good part of it is still Python but it's certainly more C(++) than the vanilla conda. |
Okay, I agree with this motivation. What do you think about removing the recommendation to install mamba (as you already did), but keeping the two tabs for conda and mamba in the commands (with conda being the default)? Then it shouldn't be too confusing for newcomers, but also people that use mamba can just copy past the correct command? |
Feel free to make any such change if you think it's worth it. Since this page is going away soonish anyway, I don't want to put many more iterations into it myself to be honest. I'll happily approve of any changes you make in that direction though :) |
Since the meson build seems to work for everybody, it's probably best to just remove these non-meson instructions altogether. The installation page is confusing enough already. |
The part about installing sage from conda (without building it locally) should be kept, either as a standalone-page or being integrated in some other installation page. The general instructions about setting up a conda environment for development should be moved to the meson page. The rest can be removed in my opinion. |
sagemathgh-39771: Remove conda-ci <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> The old setuptools-sagelib on top of conda installation is now surpassed by meson, so there is no point in having tests for this way of installation. The documentation still needs to be revised, either as part of or as follow-up to sagemath#39515. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [ ] The title is concise and informative. - [ ] 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 and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39771 Reported by: Tobias Diez Reviewer(s): Dima Pasechnik
sagemathgh-39771: Remove conda-ci <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> The old setuptools-sagelib on top of conda installation is now surpassed by meson, so there is no point in having tests for this way of installation. The documentation still needs to be revised, either as part of or as follow-up to sagemath#39515. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [ ] The title is concise and informative. - [ ] 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 and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39771 Reported by: Tobias Diez Reviewer(s): Dima Pasechnik
sagemathgh-39771: Remove conda-ci <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> The old setuptools-sagelib on top of conda installation is now surpassed by meson, so there is no point in having tests for this way of installation. The documentation still needs to be revised, either as part of or as follow-up to sagemath#39515. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [ ] The title is concise and informative. - [ ] 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 and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39771 Reported by: Tobias Diez Reviewer(s): Dima Pasechnik
sagemathgh-39771: Remove conda-ci <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> The old setuptools-sagelib on top of conda installation is now surpassed by meson, so there is no point in having tests for this way of installation. The documentation still needs to be revised, either as part of or as follow-up to sagemath#39515. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [ ] The title is concise and informative. - [ ] 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 and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39771 Reported by: Tobias Diez Reviewer(s): Dima Pasechnik
sagemathgh-39771: Remove conda-ci <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> The old setuptools-sagelib on top of conda installation is now surpassed by meson, so there is no point in having tests for this way of installation. The documentation still needs to be revised, either as part of or as follow-up to sagemath#39515. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [ ] The title is concise and informative. - [ ] 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 and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39771 Reported by: Tobias Diez Reviewer(s): Dima Pasechnik
sagemathgh-39771: Remove conda-ci <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> The old setuptools-sagelib on top of conda installation is now surpassed by meson, so there is no point in having tests for this way of installation. The documentation still needs to be revised, either as part of or as follow-up to sagemath#39515. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [ ] The title is concise and informative. - [ ] 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 and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39771 Reported by: Tobias Diez Reviewer(s): Dima Pasechnik
sagemathgh-39771: Remove conda-ci <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> The old setuptools-sagelib on top of conda installation is now surpassed by meson, so there is no point in having tests for this way of installation. The documentation still needs to be revised, either as part of or as follow-up to sagemath#39515. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [ ] The title is concise and informative. - [ ] 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 and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39771 Reported by: Tobias Diez Reviewer(s): Dima Pasechnik
sagemathgh-40124: Update Meson and Conda install instructions <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> Make the Meson build instructions independent from the Conda and sage- the-distro instructions (previously it was linking to the relevant section for the basic setup). Also includes now how to use `uv` to setup a python env. The conda instructions have been also updated, based on the work in sagemath#39515. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [ ] The title is concise and informative. - [ ] 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 and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#40124 Reported by: Tobias Diez Reviewer(s):
The conda instructions are a bit more complicated than they have to be. They also mention some things that are deprecated (Mambaforge) or uncessary (mamba).
Here, we try to simplify the instructions with the experience we had by running installations on SageDays 128.
📝 Checklist