Skip to content

Problems when running without SAGE_VENV #33625

@tornaria

Description

@tornaria

Example context:

  • sys.prefix = /usr (used for system python packages)
  • sagelib is in a different location

Say $SAGE_LIB contains the sage python library and $SAGE_BIN contains the scripts. I can run this sagelib by setting

$ export PATH=$SAGE_BIN:$PATH
$ export PYTHONPATH=$SAGE_LIB

which will pick this sagelib (overriding a system sagelib if installed, both in scripts and python packages).

However, there are a few issues with this, since:
a. sage-env uses sage-venv-config to SAGE_VENV to sys.prefix
b. there are a few places where it is assumed that the sage scripts live in SAGE_VENV/bin, thus breaking stuff.
c. in particular sage-env itself prepends SAGE_VENV/bin to PATH.

Problem 1: If I don't have any system sage installed in /usr/bin/sage. This causes a doctest failure (#33624, very easy fix).

Problem 2: If I have a system sage installed in /usr/bin/sage but it is a different version than the one I'm trying to run. This causes trouble because after sage-env prepends PATH with SAGE_VENV/bin the sage script in SAGE_BIN will be overrided (for example, doctesting src/sage/doctest/test.py causes trouble).

Other problems? Maybe (untested)
a. #33627 - sage.doctest.control uses SAGE_VENV/bin/sage-gdb-commands so it won't work
b. sage.features looks for binaries in SAGE_VENV/bin
c. sage.repl.ipython_kernel.install uses SAGE_VENV/bin/sage when configuring jupyter kernel so it seems it will end up running the system sage.

CC: @mkoeppe

Component: scripts

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions