sagemath/sage

Fix removal of old versions in setuptools

Closed this issue · 21 comments

The setuptools patch build/pkgs/setuptools/patches/easy_install_lock.patch from #13201 breaks the removal of old versions of packages.

This has the following effect in Sage:
the wrong version of sagenb is used. Even after an explicit ./sage -f sagenb installing sagenb-0.11.0, Sage still thinks I want to use an older version.

Looking at local/lib/python2.7/site-packages/easy-install.pth shows

[...]
./Flask_OpenID-1.2.4-py2.7.egg
./sagenb-0.10.7.2-py2.7.egg
./zope.interface-4.0.5-py2.7-linux-x86_64.egg
./sagenb-0.10.8.2-py2.7.egg
./sagenb-0.11.0-py2.7.egg
./itsdangerous-0.23-py2.7.egg
[...]

This leads to the following doctest failure:

$ ./sage -tp --long --sagenb
too many failed tests, not using stored timings
Running doctests with ID 2014-10-31-14-01-49-cac56b83.
Doctesting the Sage notebook.
Sorting sources by runtime so that slower doctests are run first....
Doctesting 51 files using 4 threads.
sage -t --long local/lib/python2.7/site-packages/sagenb-0.10.7.2-py2.7.egg/sagenb/misc/sphinxify.py
**********************************************************************
File "local/lib/python2.7/site-packages/sagenb-0.10.7.2-py2.7.egg/sagenb/misc/sphinxify.py", line 69, in sagenb.misc.sphinxify.sphinxify
Failed example:
    sphinxify('A test')
Expected:
    '\n<div class="docstring">\n    \n  <p>A test</p>\n\n\n</div>'
Got:
    '<div class="docstring">\n    \n  <p>A test</p>\n\n\n</div>'
**********************************************************************
File "local/lib/python2.7/site-packages/sagenb-0.10.7.2-py2.7.egg/sagenb/misc/sphinxify.py", line 71, in sagenb.misc.sphinxify.sphinxify
Failed example:
    sphinxify('**Testing**\n`monospace`')
Expected:
    '\n<div class="docstring"...<strong>Testing</strong>\n<span class="math"...</p>\n\n\n</div>'
Got:
    '<div class="docstring">\n    \n  <p><strong>Testing</strong>\n<span class="math">monospace</span></p>\n\n\n</div>'
**********************************************************************
File "local/lib/python2.7/site-packages/sagenb-0.10.7.2-py2.7.egg/sagenb/misc/sphinxify.py", line 73, in sagenb.misc.sphinxify.sphinxify
Failed example:
    sphinxify('`x=y`')
Expected:
    '\n<div class="docstring">\n    \n  <p><span class="math">x=y</span></p>\n\n\n</div>'
Got:
    '<div class="docstring">\n    \n  <p><span class="math">x=y</span></p>\n\n\n</div>'
**********************************************************************

Component: build

Keywords: setuptools, sagenb

Author: Jeroen Demeyer

Branch: db9fe89

Reviewer: Volker Braun

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

Description changed:

--- 
+++ 
@@ -1,4 +1,6 @@
-With sage-6.4.rc0:
+With sage-6.4.rc0, the wrong version of sagenb is used. Even after an explicit `./sage -f sagenb` installing `sagenb-0.11.0`, Sage still thinks I want to use an older version.
+
+This leads to the following doctest failure:
 
 ```
 $ ./sage -tp --long --sagenb

Description changed:

--- 
+++ 
@@ -1,4 +1,17 @@
 With sage-6.4.rc0, the wrong version of sagenb is used. Even after an explicit `./sage -f sagenb` installing `sagenb-0.11.0`, Sage still thinks I want to use an older version.
+
+Looking at `local/lib/python2.7/site-packages/easy-install.pth` shows
+
+```
+[...]
+./Flask_OpenID-1.2.4-py2.7.egg
+./sagenb-0.10.7.2-py2.7.egg
+./zope.interface-4.0.5-py2.7-linux-x86_64.egg
+./sagenb-0.10.8.2-py2.7.egg
+./sagenb-0.11.0-py2.7.egg
+./itsdangerous-0.23-py2.7.egg
+[...]
+```
 
 This leads to the following doctest failure:
 

Changed keywords from none to setuptools, sagenb

Description changed:

--- 
+++ 
@@ -1,4 +1,7 @@
-With sage-6.4.rc0, the wrong version of sagenb is used. Even after an explicit `./sage -f sagenb` installing `sagenb-0.11.0`, Sage still thinks I want to use an older version.
+The setuptools patch `build/pkgs/setuptools/patches/easy_install_lock.patch` from #13201 breaks the removal of old versions of packages.
+
+This has the following effect in Sage:
+the wrong version of sagenb is used. Even after an explicit `./sage -f sagenb` installing `sagenb-0.11.0`, Sage still thinks I want to use an older version.
 
 Looking at `local/lib/python2.7/site-packages/easy-install.pth` shows
 
comment:4

maybe the best solution is to switch everything to pip and get rid of easy_install ...

comment:5

I have a simple patch ready which simply locks easy_install.pth all the time.

Author: Jeroen Demeyer

New commits:

fc331e7Fix removal of old versions in setuptools

Commit: fc331e7

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

db9fe89Manually remove "Only in" line

Changed commit from fc331e7 to db9fe89

comment:9

Replying to @vbraun:

maybe the best solution is to switch everything to pip and get rid of easy_install ...

Does pip not have such a race condition?

comment:10

Afaik if you are doing it right (not using editable mode)...

Reviewer: Volker Braun

Changed branch from u/jdemeyer/ticket/17268 to db9fe89

comment:12

Hmm… I'm seeing the same error messages from sphinxify, even without the --sagenb flag, and even after manually removing ./sagenb-0.10.8.2-py2.7.egg from my easy-install.pth. Is this some kind of legacy from this bug here, or is this a separate bug in its own right?

Changed commit from db9fe89 to none

comment:13

Obvious question: did you run make?

comment:14

...or are you working on an old branch which doesn't have this patch?

comment:15

TL;DR: Found my mistake.

OK, I am on 6.5.beta2 which contains this since it got merged for 6.4.rc1. I guess my main problem was the following: I encountered the problem on a feature branch, then checked whether I could reproduce on develop. To do that, I copied the command line as printed by the test suite runner, The one to execute the test from one single file:

sage -t --warn-long 22.0 local/lib/python2.7/site-packages/sagenb-0.10.8.2-py2.7.egg/sagenb/misc/sphinxify.py

I copied that line without really reading it, so I didn't realize that it was referring to the file in the version-specific sagenb directory. Then I started searching for it, found this one here, removed the old sagenb from my pth file, but the executed that same command line.

I guess I had somehow assumed that the error message was due to a bug in the code, and that bug in the code had been fixed by now. The fact that the doctest itself might have been updated didn't occur to me.

Sorry for the noise.