Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot import name 'LightningLoggerBase' from 'pytorch_lightning.loggers' #962

Closed
sh3rlock14 opened this issue Jan 19, 2023 · 16 comments · Fixed by #965
Closed

Cannot import name 'LightningLoggerBase' from 'pytorch_lightning.loggers' #962

sh3rlock14 opened this issue Jan 19, 2023 · 16 comments · Fixed by #965
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@sh3rlock14
Copy link

sh3rlock14 commented Jan 19, 2023

🐛 Bug

When trying to import anything from pl_bolts, I get the error: cannot import name 'LightningLoggerBase' from 'pytorch_lightning.loggers'.

To Reproduce

I'm currently using Keggle's pytorch_lightning version 1.9.0, and I saw that from version 1.7.0 it has been deprecated in favour of pytorch_lightning.loggers.logger.Logger but I don't want to downgrade my pl version: is pl_bolts being being updated to reach the more recent versions of pl?

Thanks in advance for your help! 🙏🏻

Having a pl version >=1.7.0

!pip install lightning-bolts
from pl_bolts.datasets import DummyDataset

raises: cannot import name 'LightningLoggerBase' from 'pytorch_lightning.loggers'

@sh3rlock14 sh3rlock14 added the help wanted Extra attention is needed label Jan 19, 2023
@Borda Borda added fix fixing issues... good first issue Good for newcomers labels Jan 19, 2023
@Borda
Copy link
Member

Borda commented Jan 19, 2023

it seems to be deprecated/removed from PL, would you be interested in sending fix 🐰

@senarvi
Copy link
Contributor

senarvi commented Jan 19, 2023

I think it was renamed to Logger in Lightning 1.9.

@senarvi
Copy link
Contributor

senarvi commented Jan 20, 2023

Looks like there's also another breaking change: pytorch_lightning.utilities.apply_func is now found from lightning_utilities.core.apply_func.

How to keep this backward compatible? We could do this:

try:
    from pytorch_lightning.loggers import Logger
except ImportError:
    from pytorch_lightning.loggers import LightningLoggerBase
    Logger = LightningLoggerBase

try:
    from lightning_utilities.core.apply_func import apply_to_collection
except ImportError:
    from pytorch_lightning.utilities.apply_func import apply_to_collection

@lebrice
Copy link
Contributor

lebrice commented Jan 21, 2023

Hello there @Borda, I have a few questions if you don't mind:

  • Do you know which specific release combination of pytorch-lightning / lightning_bolts is causing this issue?
  • Could there be a way to avoid these kind of incompatibilities between the two libraries from happening in the future? For example, do you have an idea of how torch / torchvision / torchaudio / etc do it? (in my experience, those seem to be pretty well synchronized, and I've never had any issue of this kind with them)

@satyajit-ink
Copy link

lightning-bolts==0.6.0.post1
lightning-utilities==0.5.0
pytorch-lightning==1.9.0

@SabaDD
Copy link

SabaDD commented Feb 3, 2023

Is this problem fixed? I tried it today and still get the same error. My versions are:
lightning-bolts==0.6.0.post1
lightning-utilities==0.6.0.post0
pytorch-lightning==1.9.0

@richtertill
Copy link

I had the same issue, I could circumvent it by using the following versions:
lightning-bolts==0.6.0.post1
lightning-lite==1.8.0
lightning-utilities==0.3.0
pytorch-lightning==1.8.0

@wilderrodrigues
Copy link

I need PL >=1.9.0 and can't get it work with LB 0.6.0.post1. Is anyone looking into this?

@wilderrodrigues
Copy link

I'm working on this one. PR will follow soon.

@esraashabrani
Copy link

any update on this?

@wilderrodrigues
Copy link

any update on this?

I found a PR that addresses the import only, but won't fix other imports.

I'm pushing my PR now. Just writing down the description and making sure the motivation is clear. I updated 4 dependencies to reflect latest releases.

@wangxinghangcnn
Copy link

Thanks!

@RylanSchaeffer
Copy link

RylanSchaeffer commented May 23, 2023

I'm getting this error today. @Borda , what version do I need to be on for the error to go away? I upgraded to 2.0.2 but the error remains.

@mugendi
Copy link

mugendi commented May 25, 2023

Also getting this error today:
pytorch-lightning==2.0.2
lightning-bolts==0.6.0.post1

@Borda
Copy link
Member

Borda commented May 25, 2023

lightning-bolts==0.6.0.post1

Could you please try install from source, it shall be fixed there and we release it soon

@Wheest
Copy link

Wheest commented May 30, 2023

lightning-bolts==0.6.0.post1

Could you please try install from source, it shall be fixed there and we release it soon

Thanks, with:

pytorch-lightning==2.0.2
lightning-bolts==0.6.0.post1

I was able to run my code using bleeding edge with: pip install git+https://github.com/PytorchLightning/lightning-bolts.git@master --upgrade

@Borda Borda added bug Something isn't working and removed fix fixing issues... labels Jun 20, 2023
adarshxs added a commit to adarshxs/flash-attention that referenced this issue Dec 8, 2023
LightningLoggerBase -> Logger

LightningLoggerBase was deprecated
Lightning-Universe/lightning-bolts#962
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet