Lightning-AI / pytorch-lightning

Pretrain, finetune and deploy AI models on multiple GPUs, TPUs with zero code changes.

Home Page:https://lightning.ai

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pinning the `lightning` package doesn't pin the `pytorch_lightning` package

silasbrack opened this issue · comments

Bug description

For reasons, I have to use torch<2.0; I can see that in lightning 2.3.0 the torch dependency was constrained to be >2.0, so I decided to pin it, but (after much debugging) I realised that lightning was installing a different version of pytorch-lightning, which was the actual package causing the issues.

What version are you seeing the problem on?

v2.2, master

How to reproduce the bug

pip install lightning==2.2.5

This will install `pytorch-lightning==2.3.0`.
I thought the name change was mostly for branding purposes, so I suppose that it would be nicer to pin the package here?

Error messages and logs

# Error messages and logs here please

Environment

Current environment
#- Lightning Component (e.g. Trainer, LightningModule, LightningApp, LightningWork, LightningFlow):
#- PyTorch Lightning Version (e.g., 1.5.0):
#- Lightning App Version (e.g., 0.5.2):
#- PyTorch Version (e.g., 2.0):
#- Python version (e.g., 3.9):
#- OS (e.g., Linux):
#- CUDA/cuDNN version:
#- GPU models and configuration:
#- How you installed Lightning(`conda`, `pip`, source):
#- Running environment of LightningApp (e.g. local, cloud):

More info

No response

Unfortunately, the decision was made that when the package was renamed, the new lightning package would ship pytorch-lightning as a dependency so that users could still use both ways of importing the package. But that also means if you pin lightning, this won't automatically pin the other one, and that's simply not possible to achieve. In general terms, if you have a package x that depends on y, then it wouldn't make sense to pin y to the same version than x.

If you have project dependencies and want to fix the lightning version, please specify the version pins for both packages.

For example:

lightning<2.3
pytorch-lightning<2.3

I think the possibility of not including pytorch-lightning anymore is an option for the future, as more users have transitioned to the new import and package name.