On Mon, Sep 27, 2021 at 12:46 PM Nils Bruin <nbr...@sfu.ca> wrote: > > > Presently, > > $ sage -pip install --user ..... > > fails (at least for me, with a vanilla sage install on FC33) with > > ERROR: Can not perform a '--user' install. User site-packages are not visible > in this virtualenv. > > Perhaps it's worth having this? > > Also, I noticed: > > $ sage --python3 -c "import sys; print(sys.path)" ['', > '/usr/lib64/python39.zip', '/usr/lib64/python3.9', > '/usr/lib64/python3.9/lib-dynload', > '/usr/local/sage/sage-git/local/lib64/python3.9/site-packages', > '/usr/local/sage/sage-git/local/lib/python3.9/site-packages'] > > note that the first enstries in this list actually refer to the system > python, not the sage python! I think that means that any patched package > installs that sage uses will be shadowed by the system installations. That's > probably not what is meant.
On CoCalc I think we explicitly patch the Sage we provide to include ~/.local: ~$ sage --python3 -c "import sys; print(sys.path)" ['', '/ext/sage/sage-9.3/local/lib/python39.zip', '/ext/sage/sage-9.3/local/lib/python3.9', '/ext/sage/sage-9.3/local/lib/python3.9/lib-dynload', '/home/user/.local/lib/python3.9/site-packages', '/ext/sage/sage-9.3/local/lib/python3.9/site-packages', '/ext/sage/sage-9.3/local/lib/python3.9/site-packages/awalipy-0.4-py3.9-linux-x86_64.egg'] Also note that all the other path entries are our sage install (not the system python, which is crazy, as you point out). For us, it's very very important that "pip install --user" just works. Also, for us, usually people are working in a very clean well defined environment (a cocalc project), which they are using for a very specific "project" (e.g., teaching or taking a specific class, or writing a paper), so using ~/.local is very reasonable. I see at [1] that our page about installing packages "into sage is not supported", and it should be updated to say that "sage --pip install" does work. We also make pip default to --user so actually "pip install" does just work. I just found a "random" package on pypi: ~$ sage --pip install pytype Defaulting to user installation because normal site-packages is not writeable Collecting pytype ... ~$ sage ┌────────────────────────────────────────────────────────────────────┐ │ SageMath version 9.3, Release Date: 2021-05-09 │ │ Using Python 3.9.2. Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ sage: import pytype sage: # yeah IMHO, this is pretty good user experience. Sometimes people do break their sage installs via installing stuff into ~/.local, but it's also easy to fix by just deleting ~/.local and starting over, and it's usually very clear this is the problem based on the traceback. -- William -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/CACLE5GD2n47_2QHpPNa82NqypuEqC6iV2Djg_0PTsy_%2BdqLwpA%40mail.gmail.com.