Opened 7 years ago

Closed 6 years ago

#20706 closed enhancement (fixed)

fallback site.getsitepackages in virtualenv

Reported by: Frédéric Chapoton Owned by:
Priority: major Milestone: sage-7.3
Component: build Keywords:
Cc: Jeroen Demeyer, Erik Bray Merged in:
Authors: Frédéric Chapoton Reviewers: Volker Braun
Report Upstream: N/A Work issues:
Branch: 3ca877f (Commits, GitHub, GitLab) Commit: 3ca877f89ffd11d5c3e5ea8222be896e36ff3973
Dependencies: Stopgaps:

Status badges

Description

when run inside a virtualenv,

site has not attribute getsitepackages

This is a quick and dirty fallback in that case.

Change History (9)

comment:1 Changed 7 years ago by Frédéric Chapoton

Branch: public/20706
Commit: 3ca877f89ffd11d5c3e5ea8222be896e36ff3973
Status: newneeds_review

New commits:

8219d86failback for site.getsitepackages in virtualenv
3ca877fmore precise except clause

comment:2 Changed 7 years ago by Erik Bray

That's annoying about virtualenv. I never ran into it before, I guess because using site.getsitepackages isn't very common. But it ought to work. I'm surprised it hasn't been fixed by now.

Unfortunately I think this workaround is incomplete, because if you're using a virtualenv with --system-site-packages this will still be incorrect. Maybe for Sage's purposes it doesn't matter though. I'd have to look at how SITE_PACKAGES is being used.

comment:3 Changed 7 years ago by François Bissey

Mostly SAGE_LIB is used except in src/sage/doctest/sources.py for no real good reason

sp = os.path.join(SAGE_LOCAL, 'lib', 'python', 'site-packages')

I replaced it by SAGE_LIB in sage-on-gentoo but never pushed it because it is bundled with a bunch of other stuff.

comment:4 Changed 7 years ago by Frédéric Chapoton

I am trying to do from sage.all import * in an ipython3 session in a python3 virtualenv. This is the first failing point.

Then come problems with importing cython modules, but this is maybe another story.

Last edited 7 years ago by Frédéric Chapoton (previous) (diff)

comment:5 Changed 7 years ago by Erik Bray

I've never seen any particular problem with importing Cython modules when using virtualenv...?

comment:6 Changed 7 years ago by Frédéric Chapoton

I am probably doing something stupid. If you know the correct way to try importing sage in an ipython3 session, please tell me.

comment:7 in reply to:  6 Changed 7 years ago by Erik Bray

Replying to chapoton:

I am probably doing something stupid. If you know the correct way to try importing sage in an ipython3 session, please tell me.

I don't know that it's you necessarily. The key words might be "importing sage". I haven't even tried using sage in a virtualenv, much less on Python 3. Normally there'd be nothing special to it.

comment:8 Changed 7 years ago by Volker Braun

Component: PLEASE CHANGEbuild
Reviewers: Volker Braun
Status: needs_reviewpositive_review

comment:9 Changed 6 years ago by Volker Braun

Branch: public/207063ca877f89ffd11d5c3e5ea8222be896e36ff3973
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.