ofnote/lightex

AttributeError: module 'site' has no attribute 'getsitepackages'

Opened this issue · 2 comments

% lx init
Initializing LightEx in current directory.
Traceback (most recent call last):
File "/disk/venv/p3/bin/lx", line 46, in
main(args)
File "/disk/venv/p3/bin/lx", line 28, in main
task_init()
File "/disk/venv/p3/bin/lx", line 12, in task_init
asset_dir = Path(site.getsitepackages()[0]) / 'lightex' / 'assets'
AttributeError: module 'site' has no attribute 'getsitepackages

Looks like this is a known issue in virtualenv with no fix:
pypa/virtualenv#737

Alas, most ML development is in a virtualenv...

Thanks for pointing this out.
Does this work for you in virtualenv?

python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"

A tmp fix is to copy files from lightex/assets directory into current directory. That's what lx init does.

Will look for a permanent fix to this.

Thanks for looking into this. Yes, get_python_lib() is working correctly. As a temp fix, I locally modified bin/lx to hardcode the site-packages directory.