#10176: ImportError: No module named sagenb on openSUSE
------------------------------+---------------------------------------------
Reporter: mpatel | Owner: jason, was
Type: defect | Status: needs_review
Priority: blocker | Milestone: sage-4.6
Component: notebook | Keywords:
Author: Leif Leonhardy | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
------------------------------+---------------------------------------------
Comment(by leif):
Replying to [comment:24 hivert]:
> I'll be happy to tray any other idea. As usual the script still report
{{{
Removing sagenb 0.8.7-patched from easy-install.pth file
Adding sagenb 0.8.7-patched to easy-install.pth file
}}}
> but nothing is happening. So someone have any idea of which script (I
guess something in setuptools) writes those two lines on my screen ?
Otherwise I'll probably spend tomorrow morning playing with grep :-|
You don't have to grep, take a look at
{{{setuptools-0.6c9.p0/src/setuptools/command/easy_install.py}}}:
* Starting on line 944:
{{{
#!python
def update_pth(self,dist):
if self.pth_file is None:
return
for d in self.pth_file[dist.key]: # drop old entries
if self.multi_version or d.location != dist.location:
log.info("Removing %s from easy-install.pth file", d)
self.pth_file.remove(d)
if d.location in self.shadow_path:
self.shadow_path.remove(d.location)
if not self.multi_version:
if dist.location in self.pth_file.paths:
log.info(
"%s is already the active version in easy-
install.pth",
dist
)
else:
log.info("Adding %s to easy-install.pth file", dist)
self.pth_file.add(dist) # add new entry
if dist.location not in self.shadow_path:
self.shadow_path.append(dist.location)
if not self.dry_run:
self.pth_file.save()
if dist.key=='setuptools':
# Ensure that setuptools itself never becomes unavailable!
# XXX should this check for latest version?
filename = os.path.join(self.install_dir,'setuptools.pth')
if os.path.islink(filename): os.unlink(filename)
f = open(filename, 'wt')
f.write(self.pth_file.make_relative(dist.location)+'\n')
f.close()
}}}
* Starting on line 1313:
{{{
#!python
class PthDistributions(Environment):
"""A .pth file with Distribution paths in it"""
...
def save(self):
"""Write changed .pth file back to disk"""
if not self.dirty:
return
data = '\n'.join(map(self.make_relative,self.paths))
if data:
log.debug("Saving %s", self.filename)
data = (
"import sys; sys.__plen = len(sys.path)\n"
"%s\n"
"import sys; new=sys.path[sys.__plen:];"
" del sys.path[sys.__plen:];"
" p=getattr(sys,'__egginsert',0); sys.path[p:p]=new;"
" sys.__egginsert = p+len(new)\n"
) % data
if os.path.islink(self.filename):
os.unlink(self.filename)
f = open(self.filename,'wb')
f.write(data); f.close()
elif os.path.exists(self.filename):
log.debug("Deleting empty %s", self.filename)
os.unlink(self.filename)
self.dirty = False
def add(self,dist):
"""Add `dist` to the distribution map"""
if dist.location not in self.paths and dist.location not in
self.sitedirs:
self.paths.append(dist.location); self.dirty = True
Environment.add(self,dist)
...
}}}
Unfortunately {{{export DISTUTILS_DEBUG=yes}}} seems to have no effect on
setuptools, but perhaps we could call
{{{distutils.log.set_threshold(distutils.log.DEBUG)}}} in SageNB's
{{{setup.py}}} (haven't tried that yet).
Or we could hack some debugging statements into the setuptools spkg by
ourselves, since there anyway aren't many calls of {{{log.debug()}}}, at
least in the parts we're interested in.
Our setuptools are fairly old by the way; the latest seem to be 0.6c11,
released a year ago, though some changelog ends with "0.6 (final)",
lacking entries for "recent" 0.6c''N''s.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10176#comment:27>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.