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

Trainers tutorial fails without refresh #765

Closed
adamjstewart opened this issue Sep 7, 2022 · 6 comments
Closed

Trainers tutorial fails without refresh #765

adamjstewart opened this issue Sep 7, 2022 · 6 comments
Labels
documentation Improvements or additions to documentation trainers PyTorch Lightning trainers

Comments

@adamjstewart
Copy link
Collaborator

Description

If you run the Trainers tutorial in Google Colab, it crashes with an import error. https://issuehint.com/issue/Lightning-AI/lightning-flash/1424#131142861 suggests that this is a pip installation issue.

Steps to reproduce

Run the tutorial in Google Colab. The imports cell fails with the following error message:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
[<ipython-input-2-51de89d93fc2>](https://localhost:8080/#) in <module>
     10 from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint
     11 from pytorch_lightning.loggers import CSVLogger
---> 12 from torchgeo.datamodules import CycloneDataModule
     13 from torchgeo.trainers import RegressionTask

7 frames
[/usr/local/lib/python3.7/dist-packages/PIL/ImageFont.py](https://localhost:8080/#) in <module>
     35 from . import Image
     36 from ._deprecate import deprecate
---> 37 from ._util import is_directory, is_path
     38 
     39 

ImportError: cannot import name 'is_directory' from 'PIL._util' (/usr/local/lib/python3.7/dist-packages/PIL/_util.py)

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------

Version

releases/v0.3

@adamjstewart adamjstewart added documentation Improvements or additions to documentation trainers PyTorch Lightning trainers labels Sep 7, 2022
@adamjstewart adamjstewart added this to the 0.3.1 milestone Sep 7, 2022
@calebrob6
Copy link
Member

This is solved by simply restarting the colab runtime. %pip install torchgeo[datasets] uninstalls whatever version of PIL is pre-installed and there is a clear notification that you must restart the runtime for the changes to take effect.

@adamjstewart
Copy link
Collaborator Author

Yeah, that's what I determined as well. Is there any way around this? I wish Colab didn't import things for me...

@adamjstewart
Copy link
Collaborator Author

I also wish pip would take into account packages that were already installed instead of updating everything and breaking the environment...

@calebrob6
Copy link
Member

I have no idea, but let's close as this isn't a torchgeo issue.

@adamjstewart
Copy link
Collaborator Author

Haven't given up on this just yet: Lightning-AI/pytorch-lightning#17136

@adamjstewart
Copy link
Collaborator Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation trainers PyTorch Lightning trainers
Projects
None yet
Development

No branches or pull requests

2 participants