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

./configure: Make --with-sage-venv=auto the default #32442

Closed
mkoeppe opened this issue Aug 31, 2021 · 79 comments
Closed

./configure: Make --with-sage-venv=auto the default #32442

mkoeppe opened this issue Aug 31, 2021 · 79 comments

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Aug 31, 2021

Since Sage 9.4, it is possible to use an installation tree for Python packages separate from SAGE_LOCAL:
https://wiki.sagemath.org/ReleaseTours/sage-9.4#For_developers:_..2Fconfigure_--prefix.3DSAGE_LOCAL_--with-sage-venv.3DSAGE_VENV

In this ticket we make a new setting --with-sage-venv=auto the default, which means:

  • if --prefix has not been used (so SAGE_LOCAL=local), then set SAGE_VENV to local/var/lib/sage/venv-PYTHONVERSION
    Users can also pass --with-sage-venv or --with-sage-venv=yes, which means to unconditionally set SAGE_VENV to SAGE_LOCAL/var/lib/sage/venv-PYTHONVERSION.

(We keep the layout as is in incremental builds.)

By keying the default name to the Python version, we ensure that if the system python version changes (either because of system updates or explicit reconfiguration), we create a fresh venv and automatically rebuild all Python packages, eliminating problems such as the one reported in https://groups.google.com/g/sage-devel/c/hZPHxqn_Cyk/m/fOAZCUWHAQAJ

Moreover, at config.status time, we create a symbolic link SAGE_ROOT/venv -> SAGE_VENV (overwriting an existing symbolic link)

The link is for easy access by users and is not used otherwise. Instead of local/lib/python3/site-packages/ or local/bin/sage, use venv/local/lib/python3/site-packages/ etc.

For symmetry, we also create a symbolic link SAGE_ROOT/prefix -> SAGE_LOCAL. (This generalizes what is already done by tox local.)

Users will still be able to restore the previous behavior by using --with-sage-venv=no, or use a specific path as in --with-sage-venv=/path/to/venv.

CC: @dimpase @jhpalmieri

Component: build: configure

Author: Matthias Koeppe

Reviewer: John Palmieri

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

@mkoeppe mkoeppe added this to the sage-9.5 milestone Aug 31, 2021
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 31, 2021

Changed dependencies from #32286, #32387 to #32386, #32387

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Sep 11, 2021

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Sep 11, 2021

New commits:

2f5be2dconfigure.ac, build/pkgs/python3/spkg-configure.m4: New default --with-sage-venv=auto
f700640configure.ac: In config.status, create convenience symlinks prefix, venv

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Sep 11, 2021

Commit: f700640

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Sep 11, 2021

Author: Matthias Koeppe

@mkoeppe mkoeppe changed the title ./configure: Make --with-sage-venv the default ./configure: Make --with-sage-venv=auto the default Sep 11, 2021
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 15, 2021

Changed commit from f700640 to 12cbbda

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 15, 2021

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

b4a3845m4/sage_spkg_collect.m4: If we install python3 spkg, install it in SAGE_VENV
12cbbdaconfigure.ac: Keep old behavior of SAGE_VENV in incremental builds

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 16, 2021

Changed commit from 12cbbda to 117fe3a

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 16, 2021

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

117fe3abuild/make/Makefile.in (...-clean): Do not fail trying to uninstall if SAGE_VENV has not been created yet

@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Sep 27, 2021

Changed dependencies from #32386, #32387 to none

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 27, 2021

Changed commit from 117fe3a to 8af6041

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 27, 2021

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

8af6041Merge tag '9.5.beta2' into t/32442/__configure__make___with_sage_venv_the_default

@jhpalmieri
Copy link
Member

comment:11

After running make distclean && ./configure:

% git status
On branch t/32442/__configure__make___with_sage_venv_the_default
Your branch is up to date with 'trac/u/mkoeppe/__configure__make___with_sage_venv_the_default'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	venv

nothing added to commit but untracked files present (use "git add" to track)

@jhpalmieri
Copy link
Member

comment:12

Oh, and venv is a symlink pointing to local.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 27, 2021

Changed commit from 8af6041 to b3f7d34

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 27, 2021

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

b3f7d34.gitignore: Add /venv

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Sep 27, 2021

comment:14

Thanks for catching this!

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Sep 27, 2021

comment:15

Replying to @jhpalmieri:

Oh, and venv is a symlink pointing to local.

Yes, in an incremental build, nothing should change (except that this symlink is created).

After a make distclean, the new behavior will show

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Sep 27, 2021

comment:16

Oh, now I see that you said you did make distclean...

@jhpalmieri
Copy link
Member

comment:17

Maybe this has been going on with venv builds for a while, but the symlinks look messed up to me: my local directory looks like

% ls -l local
total 0
drwxr-xr-x  148 jpalmier  staff  4736 Sep 27 16:21 bin
drwxr-xr-x    2 jpalmier  staff    64 Sep 27 16:09 etc
drwxr-xr-x   47 jpalmier  staff  1504 Sep 27 16:21 include
drwxr-xr-x   73 jpalmier  staff  2336 Sep 27 16:44 lib
lrwxr-xr-x    1 jpalmier  staff     3 Sep 27 16:09 lib64 -> lib
drwxr-xr-x    4 jpalmier  staff   128 Sep 27 16:21 libexec
lrwxr-xr-x    1 jpalmier  staff     5 Sep 27 16:09 local -> local
drwxr-xr-x   34 jpalmier  staff  1088 Sep 27 16:21 share
drwxr-xr-x    5 jpalmier  staff   160 Sep 27 16:13 var
lrwxr-xr-x    1 jpalmier  staff    33 Sep 27 16:09 venv-python3.9 -> local/var/lib/sage/venv-python3.9

In particular, local/local points to itself, and so venv-python3.9 doesn't point anywhere. venv-python3.9 should probably point to ../local/..... I don't know what the local symlink is supposed to do.

Everything still builds, so this is obviously not crucial, but it doesn't look right.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Sep 28, 2021

comment:18

Yes, that doesn't look right. Could you post config.log please?

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Oct 13, 2021

comment:51

They are in the Docker container.
At the end of the build, tox will tell you name and/or sha256 hash of the image built.
You can to docker run -it IMAGE bash to enter the container and then it's all in /sage/logs

@jhpalmieri
Copy link
Member

comment:52

Okay, before this latest change I see the Python problem, as well as:

* package:         python3-3.9.7
  last build time: Oct 13 17:49
  log file:        /sage/logs/pkgs/python3-3.9.7.log

* package:         fplll-5.4.1
  last build time: Oct 13 18:01
  log file:        /sage/logs/pkgs/fplll-5.4.1.log
  build directory: /sage/local/var/tmp/sage/build/fplll-5.4.1

* package:         cmake-3.21.0
  last build time: Oct 13 18:04
  log file:        /sage/logs/pkgs/cmake-3.21.0.log
  build directory: /sage/local/var/tmp/sage/build/cmake-3.21.0

* package:         gfortran-10.3.0
  last build time: Oct 13 18:14
  log file:        /sage/logs/pkgs/gfortran-10.3.0.log
  build directory: /sage/local/var/tmp/sage/build/gfortran-10.3.0

The other failures appear to be unrelated to this ticket: I get them with the develop branch.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Oct 13, 2021

comment:53

Replying to @jhpalmieri:

The other failures appear to be related to this ticket: I get them with the develop branch.

Did you mean to write "unrelated to this ticket"?

@jhpalmieri
Copy link
Member

comment:54

Yes, sorry, unrelated. I've edited to make it clearer in case anyone looks at this later. With the most recent branch here, Python builds correctly. I think that's good enough for another positive review.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Oct 13, 2021

comment:55

Thank you!

By the way, I cannot reproduce the failures with the other packages, and they also built correctly on GH Actions https://github.com/sagemath/sage/runs/3863930628?check_suite_focus=true

@jhpalmieri
Copy link
Member

comment:56

Maybe the issue was that my Docker was out of date, or maybe it was a memory issue. I upgraded Docker and allocated more RAM to it, and now those packages build.

@jhpalmieri
Copy link
Member

comment:57

I do get another failure, though; don't know if it's related to this ticket. With tox -e docker-debian-stretch-minimal, I get:

gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1) 
****************************************************
Package 'setuptools' is currently not installed
No legacy uninstaller found for 'setuptools'; nothing to do
python3: error while loading shared libraries: libpython3.9.so.1.0: cannot open shared object file: No such file or directory
********************************************************************************
Error building / installing setuptools for Python
********************************************************************************

real	0m0.021s
user	0m0.011s
sys	0m0.010s
************************************************************************
Error installing package setuptools-58.0.2
************************************************************************
Please email sage-devel (http://groups.google.com/group/sage-devel)
explaining the problem and including the log files
  /sage/logs/pkgs/setuptools-58.0.2.log
and
  /sage/config.log
Describe your computer, operating system, etc.
If you want to try to fix the problem yourself, *don't* just cd to
/sage/local/var/lib/sage/venv-python3.9.7/var/tmp/sage/build/setuptools-58.0.2 and type 'make' or whatever is appropriate.
Instead, the following commands setup all environment variables
correctly and load a subshell for you to debug the error:
  (cd '/sage/local/var/lib/sage/venv-python3.9.7/var/tmp/sage/build/setuptools-58.0.2' && '/sage/sage' --buildsh)
When you are done debugging, you can type "exit" to leave the subshell.

@jhpalmieri
Copy link
Member

comment:58

There is a file SAGE_ROOT/venv/local/lib/libpython3.9.so.1.0. If I run ./sage --python then I get the same error.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Oct 14, 2021

comment:59

Yes, I see this error now too.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Oct 14, 2021

comment:61

Looks like on Linux I need to set the linker flags differently.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 14, 2021

Changed commit from 2101b8c to 3bbc5d8

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 14, 2021

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

3bbc5d8build/pkgs/python3/spkg-build.in: Set rpath

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Oct 14, 2021

comment:64

This fixes it for me; this time I ran a complete build

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Oct 14, 2021

comment:65

This ticket (at 2101b8c) is already on Volker's branch.
I've opened #32698 for the fix.

@jhpalmieri
Copy link
Member

comment:66

This works for me with a few different builds (standard build on my machine and a few tox builds via Docker).

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Oct 19, 2021

Changed commit from 3bbc5d8 to none

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Oct 19, 2021

comment:67

This was merged along with #32698

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Oct 19, 2021

Changed branch from u/mkoeppe/__configure__make___with_sage_venv_the_default to none

@mkoeppe mkoeppe closed this as completed Oct 19, 2021
mkoeppe added a commit to mkoeppe/sage that referenced this issue Feb 17, 2023
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

3 participants