Opened 6 years ago

Closed 5 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:

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 6 years ago by chapoton

  • Branch set to public/20706
  • Commit set to 3ca877f89ffd11d5c3e5ea8222be896e36ff3973
  • Status changed from new to needs_review

New commits:

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

comment:2 Changed 6 years ago by embray

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 6 years ago by fbissey

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 6 years ago by 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 6 years ago by chapoton (previous) (diff)

comment:5 Changed 6 years ago by embray

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

comment:6 follow-up: Changed 6 years ago by 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 6 years ago by embray

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 5 years ago by vbraun

  • Component changed from PLEASE CHANGE to build
  • Reviewers set to Volker Braun
  • Status changed from needs_review to positive_review

comment:9 Changed 5 years ago by vbraun

  • Branch changed from public/20706 to 3ca877f89ffd11d5c3e5ea8222be896e36ff3973
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.