Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#10097 closed defect (fixed)

Sage won't start after moving or renaming the 4.6.alpha3 root directory

Reported by: mpatel Owned by: jason, was
Priority: blocker Milestone: sage-4.6
Component: notebook Keywords:
Cc: jason, kcrisman, timdumol Merged in: sage-4.6.alpha3
Authors: Jason Grout, Mitesh Patel Reviewers: Jason Grout
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

This is a follow-up to #9920. The package extraction patch at that ticket makes an absolute link

ln -sf "$SAGE_ROOT/devel/sagenb-main" "$SAGE_ROOT/devel/sagenb" 

that should be relative. Also, it seems we need to rerun python setup.py develop in SAGE_LOCAL/bin/sage-location.

Attachments (1)

trac_10097-sagenb_relocatability.patch (986 bytes) - added by mpatel 11 years ago.
Use relative paths. sagenb repository.

Download all attachments as: .zip

Change History (21)

comment:1 Changed 11 years ago by mpatel

Can we fix this within a day? I'd really like to release 4.6.alpha3 with this fixed. The current trial 4.6.alpha3, which is otherwise ready to go, is at

http://sage.math.washington.edu/home/release/sage-4.6.alpha3

comment:2 Changed 11 years ago by jason

Both good points. sage-location is seriously broken right now anyway. #9210 goes a long ways towards fixing sage-location, but is mired in some reports of it not working (and some reports of it working).

Shouldn't the setup.py develop create relative references to the sagenb repository, rather than absolute references? That would take care of the second point.

comment:3 Changed 11 years ago by jason

Okay, it looks like the absolute reference in setup.py develop is in $SAGE_ROOT/local/lib/python2.6/site-packages/easy-install.pth: /Users/grout/sage-4.6/devel/sagenb-main -- that should be a relative reference like the rest of the paths in the .pth file are.

The other absolute reference is the $SAGE_ROOT/local/lib/python2.6/site-packages/sagenb.egg-link file: /Users/grout/sage-4.6/devel/sagenb-main, which should also be a relative reference.

It looks like we can set this path when we do setup.py develop:

sage -python setup.py develop --egg-path ../../../../devel/sagenb-main

comment:4 Changed 11 years ago by mpatel

Replying to jason:

Shouldn't the setup.py develop create relative references to the sagenb repository, rather than absolute references? That would take care of the second point.

For the "topmost" link, we could use

cd "$SAGE_ROOT/devel"
ln -snf sagenb-main sagenb

in SageNB's spkg-install.

For example, sage-build does

if [ "$1" != "" ]; then
    # make devel/sage point to devel/$1
    cd "$SAGE_ROOT/devel/"
    if [ ! -d "sage-$1" ]; then
        # this will happen a lot because of people (=me) making typos.
        echo "No such branch '$SAGE_ROOT/devel/sage-$1'"
        echo "Use 'sage -clone' to create a new branch."
        exit 1
    fi
    ln -snf "sage-$1" sage
fi

comment:5 Changed 11 years ago by jason

So we have solutions for everything except the easy-install.pth file. I can't figure out how to get setuptools to change that path to a relative path. I suppose we could just search/replace that one path after doing setup.py develop.

comment:6 Changed 11 years ago by jason

Sorry, to set the .egg-link file to have a relative path, we need to:

cd $SAGE_ROOT/devel/sagenb
sage -python setup.py develop --egg-path ../../../../devel/sagenb

comment:7 Changed 11 years ago by jason

I've posted a question to stackoverflow: http://stackoverflow.com/questions/3886667/how-to-get-setuptools-to-use-a-relative-path-in-easy-install-pth-when-doing-setu

Also, the solution might be in using the virtualenv feature of setuptools. There is a --relocatable option that might make things in Sage easier.

comment:8 Changed 11 years ago by jason

See http://pypi.python.org/pypi/virtualenv for the virtualenv (search for "Making Environments Relocatable")

comment:9 follow-up: Changed 11 years ago by mpatel

What if we do

cd SAGE_ROOT/local/lib/python/site-packages
echo ../../../../devel/sagenb > sagenb.pth

? Does this effectively override the path in easy-install.pth?

comment:10 in reply to: ↑ 9 Changed 11 years ago by jason

Replying to mpatel:

What if we do

cd SAGE_ROOT/local/lib/python/site-packages
echo ../../../../devel/sagenb > sagenb.pth

? Does this effectively override the path in easy-install.pth?

No. There is one easy-install.pth file, and that's it. I think we need to change the absolute pathname in it to be a relative path name (which should be a simple search/replace or sed command)

Changed 11 years ago by mpatel

Use relative paths. sagenb repository.

comment:11 follow-up: Changed 11 years ago by mpatel

  • Authors set to Jason Grout, Mitesh Patel
  • Status changed from new to needs_review

I've attached a patch, which is part of

http://sage.math.washington.edu/home/mpatel/trac/10097/sagenb-0.8.7.spkg

(I haven't used sed's -i option, because it does not work on Solaris.)

comment:12 Changed 11 years ago by mpatel

  • Cc kcrisman added

comment:13 in reply to: ↑ 11 Changed 11 years ago by jason

  • Status changed from needs_review to positive_review

Replying to mpatel:

I've attached a patch, which is part of

http://sage.math.washington.edu/home/mpatel/trac/10097/sagenb-0.8.7.spkg

(I haven't used sed's -i option, because it does not work on Solaris.)

The effect looks good and spkg looks good. Positive review.

comment:14 Changed 11 years ago by mpatel

  • Reviewers set to Jason Grout

comment:15 Changed 11 years ago by mpatel

  • Merged in set to sage-4.6.alpha3
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:16 follow-ups: Changed 10 years ago by mpatel

Florent Hivert has reported on sage-release a problem starting Sage 4.6.rc0 built from scratch on openSUSE 11.3. Apparently, "sagenb" does not appear in easy-install.pth during the build, so the patch above does not insert the relative path we want.

comment:17 in reply to: ↑ 16 Changed 10 years ago by mpatel

Replying to mpatel:

Florent Hivert has reported on sage-release a problem starting Sage 4.6.rc0 built from scratch on openSUSE 11.3. Apparently, "sagenb" does not appear in easy-install.pth during the build, so the patch above does not insert the relative path we want.

See Leif Leonhardy's replies for some suggestions.

comment:18 in reply to: ↑ 16 ; follow-ups: Changed 10 years ago by mpatel

Replying to mpatel:

Florent Hivert has reported on sage-release a problem starting Sage 4.6.rc0 built from scratch on openSUSE 11.3. Apparently, "sagenb" does not appear in easy-install.pth during the build, so the patch above does not insert the relative path we want.

I've opened #10176 for this problem.

comment:19 in reply to: ↑ 18 Changed 10 years ago by leif

Replying to mpatel:

Replying to mpatel:

Florent Hivert has reported on sage-release a problem starting Sage 4.6.rc0 built from scratch on openSUSE 11.3. Apparently, "sagenb" does not appear in easy-install.pth during the build, so the patch above does not insert the relative path we want.

I've opened #10176 for this problem.

I've uploaded a follow-up spkg patch (currently just for testing / debugging) at #10176, no idea if that fixes the problem. (Others can of course test it on other platforms to make sure it doesn't break anything. Works for me on Ubuntu 10.04.)

Florent reported he had the same failure on OpenSuSE 11.1, too, so it might be specific to his installations, since Sage 4.6.rc0 was said to work on Skynet's menas (which runs OpenSuSE 11.1, too), but perhaps just by good luck...

comment:20 in reply to: ↑ 18 Changed 10 years ago by leif

Replying to mpatel:

Replying to mpatel:

Florent Hivert has reported on sage-release a problem starting Sage 4.6.rc0 built from scratch on openSUSE 11.3. Apparently, "sagenb" does not appear in easy-install.pth during the build, so the patch above does not insert the relative path we want.

I've opened #10176 for this problem.

#10192 (currently needing review) also solves this, but in a different way (by patching sage-spkg to get rid of "." in PYTHONPATH before installing an spkg).

Note: See TracTickets for help on using tickets.