Opened 7 years ago
Closed 7 years ago
#20706 closed enhancement (fixed)
fallback site.getsitepackages in virtualenv
Reported by: | chapoton | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-7.3 |
Component: | build | Keywords: | |
Cc: | jdemeyer, embray | 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: |
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
Branch: | → public/20706 |
---|---|
Commit: | → 3ca877f89ffd11d5c3e5ea8222be896e36ff3973 |
Status: | new → needs_review |
comment:2 Changed 7 years ago by
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
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
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.
comment:5 Changed 7 years ago by
I've never seen any particular problem with importing Cython modules when using virtualenv...?
comment:6 follow-up: 7 Changed 7 years ago by
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 Changed 7 years ago by
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
Component: | PLEASE CHANGE → build |
---|---|
Reviewers: | → Volker Braun |
Status: | needs_review → positive_review |
comment:9 Changed 7 years ago by
Branch: | public/20706 → 3ca877f89ffd11d5c3e5ea8222be896e36ff3973 |
---|---|
Resolution: | → fixed |
Status: | positive_review → closed |
New commits:
failback for site.getsitepackages in virtualenv
more precise except clause