PMXBOT Log file Viewer

Help | Karma | Search:

#pypa logs for Saturday the 22nd of December, 2018

(Back to #pypa overview) (Back to channel listing) (Animate logs)
[13:37:27] <Zaab1t> hi there kind people
[13:38:00] <Zaab1t> I want to get my users site-packages directory
[13:38:22] <Zaab1t> I thought this was the cannonical way: import site; site.getusersitepackages()
[13:39:05] <Zaab1t> However, that doesn't work in virtualenvs, because it still returns the /global/ site-packages
[13:39:20] <Zaab1t> presumably because the venv doesn't have its own site.py
[13:39:27] <Zaab1t> is this intended?
[13:41:01] <tdsmith> Zaab1t: works for me; what python distribution are you using?
[13:43:43] <Zaab1t> tdsmith: not quite sure what you're asking. Cpython 3.6
[13:44:00] <tdsmith> how'd you install it?
[13:45:43] <Zaab1t> tdsmith: I think from ubuntu repos, but maybe from source
[14:02:54] <Zaab1t> tdsmith: so is site.getusersitepackages() the canonical way? if its just broken on this box, I don't mind
[14:08:22] <tdsmith> Zaab1t: hold on, when you say global, do you still mean per-user?
[14:09:04] <Zaab1t> tdsmith: yes, im an idiot. I don't even think of my system as multi user
[14:10:05] <tdsmith> aha! yes okay that's consistent with what i'm seeing and i think it makes sense; there's no concept of virtualenv-specific user site-packages
[14:10:14] <tdsmith> entertainingly, virtualenv-brand virtualenvs just don't define a `site.getusersitepackages` function at all and you'll get an AttributeError if you try to touch it
[14:10:21] <tdsmith> but venvs do
[14:24:05] <Zaab1t> tdsmith: in my venvs I have lib/python3.x/site-packages
[14:45:36] <tdsmith> Right; that's the virtualenv's site-packages
[15:08:16] <Zaab1t> tdsmith: so know any way to get the current environments site-packages?
[15:52:46] <moldy> Zaab1t: i use a combination os.getenv('VIRTUAL_ENV') and sys.version_info
[15:53:48] <moldy> Zaab1t: https://dpaste.de/p4Hj
[15:54:04] <moldy> let me know if you find a better solution :)