Lightning-AI / pytorch-lightning

Pretrain, finetune ANY AI model of ANY size on multiple GPUs, TPUs with zero code changes.
https://lightning.ai
Apache License 2.0
28.51k stars 3.39k forks source link

Installing Lite also installs PyTorch Lightning #15490

Closed carmocca closed 2 years ago

carmocca commented 2 years ago

Proposed refactor

See title

Motivation

$ python -c "import pytorch_lightning"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'pytorch_lightning'

$ PACKAGE_NAME=lite pip install -e .
...
Successfully installed lightning-lite-1.8.0.post1

$ python -c "import pytorch_lightning"
$ echo $?
0

Pitch

PL should not be included.


If you enjoy Lightning, check out our other projects! ⚡

cc @carmocca @akihironitta @borda

carmocca commented 2 years ago

This is caused by using -e. When it's used, lightning/src is added to sys.path:

$ python -m site
sys.path = [
    ...,
    '/home/carmocca/git/lightning/src',
]

And since that directory contains the other packages, they become importable.

This is not only with Lite, also when any of them is installed with editable mode.