Describe the bug
Hello,
After successfully running notebooks in an instance running on GCP by following the instructions, I cannot get the ImageCleaner widget to work properly. First issue: the widget does not even appear in JupyterLab unless I install the ipywidgets JupyterLab extension; only the object is returned. Second, even after installing this extension, the "Next Batch" button does not work. The CSV is properly created and updated, but the next batch of images are not rendered. This leads me to believe that ImageCleaner.render() is broken.
Provide your installation details
=== Software ===
python : 3.7.1
fastai : 1.0.42
fastprogress : 0.1.18
torch : 1.0.0
nvidia driver : 410.72
torch cuda : 10.0.130 / is available
torch cudnn : 7401 / is enabled
=== Hardware ===
nvidia gpus : 1
torch devices : 1
- gpu0 : 7611MB | Tesla P4
=== Environment ===
platform : Linux-4.9.0-8-amd64-x86_64-with-debian-9.7
distro : #1 SMP Debian 4.9.130-2 (2018-10-27)
conda env : base
python : /opt/anaconda3/bin/python
sys.path : /home/jupyter/tutorials/fastai/course-v3/nbs/dl1
/opt/anaconda3/lib/python37.zip
/opt/anaconda3/lib/python3.7
/opt/anaconda3/lib/python3.7/lib-dynload
/opt/anaconda3/lib/python3.7/site-packages
/opt/anaconda3/lib/python3.7/site-packages/IPython/extensions
/home/jupyter/.ipython
To Reproduce
gcloud compute ssh --zone=$ZONE jupyter@$INSTANCE_NAME -- -L 8080:localhost:8080ImageCleaner(ds, idxs, path); note that the current version of lesson2-download.ipynt is missing the necessary path argumentjupyter labextension install @jupyter-widgets/jupyterlab-managerImageCleaner(ds, idxs, path) againcleaned.csv is createdExpected behavior
The next batch of images should appear.
Thanks.
Pining @fpingham on this.
Hi! Running the widget in Jupyter Lab is not currently supported. Can you run it on Jupyter Notebook (localhost:8080/tree)?
It turns out I can, yes!
When I first encountered this problem, one of the things I wanted to try was to simply use Jupyter Notebook instead, but I couldn't figure out, even after searching around, how to open the regular notebook window given that navigating to localhost:8080 automatically redirected me to localhost:8080/lab? every time...
Well, it works! Thanks for the workaround!
Closing then.
Hi I am trying to run ImageCleaner(ds, idxs, path) command in my notebook. I am using Colab platform to run this notebook. It just keeps running forever. I don't see any output. How do I make sure it is running in Jupyter Notebook and Jupyter Lab?
Widgets don't work in colab (it's not a jupyter notebook).
Thanks Sylvain. I realised that after reading some of the comments. So I
manually deleted some of the images that were causing my loss function to
blow up. That worked.
Thanks for your response. Appreciate it!
On Tue, May 7, 2019 at 8:55 PM Sylvain Gugger notifications@github.com
wrote:
Widgets don't work in colab (it's not a jupyter notebook).
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/fastai/fastai/issues/1539#issuecomment-490067238, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AL57A5QZAPAU26XILP4BW5TPUF33TANCNFSM4GTEXANA
.
I just tested lessons2_download in Colab (JupyterLab) and I have the same problem as 3centsv so it seems the problem is not solved.
No it's not. Google doesn't support ipywidgets, it supports its own set of widgets which are different. ImageCleaner will continue to not work in colab and probably never will since they made the choice to design a new tool instead of using the one everyone else uses.
The issue is closed because there is nothing we can do about it on the fastai side.
No it's not. Google doesn't support ipywidgets, it supports its own set of widgets which are different.
ImageCleanerwill continue to not work in colab and probably never will since they made the choice to design a new tool instead of using the one everyone else uses.The issue is closed because there is nothing we can do about it on the fastai side.
@sgugger could you look at this notebook? is this different than ipywidgets that fastai is using?
Oh, those are the normal widgets indeed. I was confused because in your first notebook I saw
from google.colab import widgets
so there clearly are some google colab-specific widgets.
In any case, if the ImageCleaner doesnt work in colab it's because they don't support all ipywidget widgets, there is no exterior magic in it (if you look at the source code, we only import from widgets and Layout). Maybe there is workaround but I have no time figuring it out. I suspect it's possible we have to import the widgets from google.colab instead of the one from ipywidget but
Sorry about recommenting this closed issue, but I still got this problem and 3 other people too.. not caused by colab or jupyter lab, see link: https://forums.fast.ai/t/imagecleaner-doesnt-render/37152
Is the problem not solved? I got the following output when i was running the lesson2_download.ipynb:
input:
from fastai.vision import *
from fastai.widgets import *
path = Path('data/bears')
db = (ImageList.from_folder(path)
.split_none()
.label_from_folder()
.transform(get_transforms(), size=224)
.databunch()
)
learn_cln = cnn_learner(db, models.resnet34, metrics=error_rate)
learn_cln.load('stage-2')
ds, idxs = DatasetFormatter().from_toplosses(learn_cln)
ImageCleaner(ds, idxs, path)
Output: (no render)
HBox(children=(VBox(children=(Image(value=b'\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x01\x00d\x00d\x00\x00\xff…
Button(button_style='primary', description='Next Batch', layout=Layout(width='auto'), style=ButtonStyle())
<fastai.widgets.image_cleaner.ImageCleaner at 0x28c1ce7a198>
The problem somehow lies in your installation of ipywidgets: fastai did create it properly from what you're telling me, but it's not showing for some reason. I'm no expert in ipywidgets, so apart from trying to reinstall it properly, I don't have any better advice :-/
The problem somehow lies in your installation of ipywidgets: fastai did create it properly from what you're telling me, but it's not showing for some reason. I'm no expert in ipywidgets, so apart from trying to reinstall it properly, I don't have any better advice :-/
Thanks very much! After hours of struggling(forgive me i'm a beginner :-p ), finally i solved this problem(If that happened on mac or windows) by running these codes in the terminal:
# for mac terminal, use the command below; for windows cmd, add '--user' to the end of each command.
### First, reinstall ipywidgets and widgetsnbextension
pip install --upgrade --force-reinstall ipywidgets
pip install --upgrade --force-reinstall widgetsnbextension
### Second, install jupyter-js-widgets/extension
jupyter nbextension install --py widgetsnbextension
### Third, enable widgetsnbextension
jupyter nbextension enable --py widgetsnbextension --sys-prefix
now, we can enjoy lesson2_download.ipynb again. Simply type jupyter notebook in the terminal and open it in the browser.
Glad you solved it and thanks for the detailed instructions! That'll help people :)
I'd suggest you copy them in the topic you mentioned on the forum for maximum visibility.
Glad you solved it and thanks for the detailed instructions! That'll help people :)
I'd suggest you copy them in the topic you mentioned on the forum for maximum visibility.
ok, no problem.
The problem somehow lies in your installation of ipywidgets: fastai did create it properly from what you're telling me, but it's not showing for some reason. I'm no expert in ipywidgets, so apart from trying to reinstall it properly, I don't have any better advice :-/
Thanks very much! After hours of struggling(forgive me i'm a beginner :-p ), finally i solved this problem(If that happened on mac or windows) by running these codes in the terminal:
# for mac terminal, use the command below; for windows cmd, add '--user' to the end of each command. ### First, reinstall ipywidgets and widgetsnbextension pip install --upgrade --force-reinstall ipywidgets pip install --upgrade --force-reinstall widgetsnbextension ### Second, install jupyter-js-widgets/extension jupyter nbextension install --py widgetsnbextension ### Third, enable widgetsnbextension jupyter nbextension enable --py widgetsnbextension --sys-prefixnow, we can enjoy lesson2_download.ipynb again. Simply type
jupyter notebookin the terminal and open it in the browser.
@Light : your solution works for jupyter notebook but NOT colab notebook, right? If it only works for jupyter notebook and (I assume that you use a local machine), where do you use GPU? Thanks!
The problem somehow lies in your installation of ipywidgets: fastai did create it properly from what you're telling me, but it's not showing for some reason. I'm no expert in ipywidgets, so apart from trying to reinstall it properly, I don't have any better advice :-/
Thanks very much! After hours of struggling(forgive me i'm a beginner :-p ), finally i solved this problem(If that happened on mac or windows) by running these codes in the terminal:
# for mac terminal, use the command below; for windows cmd, add '--user' to the end of each command. ### First, reinstall ipywidgets and widgetsnbextension pip install --upgrade --force-reinstall ipywidgets pip install --upgrade --force-reinstall widgetsnbextension ### Second, install jupyter-js-widgets/extension jupyter nbextension install --py widgetsnbextension ### Third, enable widgetsnbextension jupyter nbextension enable --py widgetsnbextension --sys-prefixnow, we can enjoy lesson2_download.ipynb again. Simply type
jupyter notebookin the terminal and open it in the browser.@light : your solution works for jupyter notebook but NOT colab notebook, right? If it only works for jupyter notebook and (I assume that you use a local machine), where do you use GPU? Thanks!
i assume colab would not have supported all widgets, please refer to what sgugger said. i use my local gpu by jupter notebook.
The problem somehow lies in your installation of ipywidgets: fastai did create it properly from what you're telling me, but it's not showing for some reason. I'm no expert in ipywidgets, so apart from trying to reinstall it properly, I don't have any better advice :-/
Thanks very much! After hours of struggling(forgive me i'm a beginner :-p ), finally i solved this problem(If that happened on mac or windows) by running these codes in the terminal:
# for mac terminal, use the command below; for windows cmd, add '--user' to the end of each command. ### First, reinstall ipywidgets and widgetsnbextension pip install --upgrade --force-reinstall ipywidgets pip install --upgrade --force-reinstall widgetsnbextension ### Second, install jupyter-js-widgets/extension jupyter nbextension install --py widgetsnbextension ### Third, enable widgetsnbextension jupyter nbextension enable --py widgetsnbextension --sys-prefixnow, we can enjoy lesson2_download.ipynb again. Simply type
jupyter notebookin the terminal and open it in the browser.
In order to get this block of code to work on my Mac I had to add --user after this command (even though it says to only append that if you're on Windows):
### Second, install jupyter-js-widgets/extension
jupyter nbextension install --py widgetsnbextension
Changing that line to: jupyter nbextension install --py widgetsnbextension --user fixed it for me.
The problem somehow lies in your installation of ipywidgets: fastai did create it properly from what you're telling me, but it's not showing for some reason. I'm no expert in ipywidgets, so apart from trying to reinstall it properly, I don't have any better advice :-/
Thanks very much! After hours of struggling(forgive me i'm a beginner :-p ), finally i solved this problem(If that happened on mac or windows) by running these codes in the terminal:
# for mac terminal, use the command below; for windows cmd, add '--user' to the end of each command. ### First, reinstall ipywidgets and widgetsnbextension pip install --upgrade --force-reinstall ipywidgets pip install --upgrade --force-reinstall widgetsnbextension ### Second, install jupyter-js-widgets/extension jupyter nbextension install --py widgetsnbextension ### Third, enable widgetsnbextension jupyter nbextension enable --py widgetsnbextension --sys-prefixnow, we can enjoy lesson2_download.ipynb again. Simply type
jupyter notebookin the terminal and open it in the browser.
This still isn't working for me, I have the same output as you have listed in your original post. I'm on not using colab or lab (just a regular jupyter notebook, and I' on windows (used --user, everything worked smoothly on the terminal end) but still no changes. Any recommendations?
Thanks!
this is what did it for me https://github.com/Calysto/matlab_kernel/issues/68#issuecomment-491128644
In any case, if the
ImageCleanerdoesnt work in colab it's because they don't support all ipywidget widgets, there is no exterior magic in it (if you look at the source code, we only import from widgets and Layout). Maybe there is workaround but I have no time figuring it out. I suspect it's possible we have to import the widgets from google.colab instead of the one from ipywidget but
The issue is closed because there is nothing we can do about it on the fastai side.
Hi, I've just started fast.ai and I'm on part 1 v3 lesson 2: https://github.com/fastai/course-v3/blob/master/nbs/dl1/lesson2-download.ipynb
I'm just encountering this information that Google Colab is incompatible with parts of fast.ai's course, such as ImageCleaner. If I had known this earlier I would not have spent time getting used to Colab, which already seems to deviate from default Jupyter's normal key commands and UI.
Perhaps you could remove it from the the list of suggested hosted platforms on fast.ai v3's intro page, or at least add a warning? It is listed as one of two free options. There is no mention of it being incompatible with parts of the course.
Is there another hosted service that runs Jupyter Notebook rather than Lab? I don't have a nice GPU so I need a hosted option. Thanks for any advice.
In any case, if the
ImageCleanerdoesnt work in colab it's because they don't support all ipywidget widgets, there is no exterior magic in it (if you look at the source code, we only import from widgets and Layout). Maybe there is workaround but I have no time figuring it out. I suspect it's possible we have to import the widgets from google.colab instead of the one from ipywidget but
The issue is closed because there is nothing we can do about it on the fastai side.Hi, I've just started fast.ai and I'm on part 1 v3 lesson 2: https://github.com/fastai/course-v3/blob/master/nbs/dl1/lesson2-download.ipynb
I'm just encountering this information that Google Colab is incompatible with parts of fast.ai's course, such as ImageCleaner. If I had known this earlier I would not have spent time getting used to Colab, which already seems to deviate from default Jupyter's normal key commands and UI.
Perhaps you could remove it from the the list of suggested hosted platforms on fast.ai v3's intro page, or at least add a warning? It is listed as one of two free options. There is no mention of it being incompatible with parts of the course.
Is there another hosted service that runs Jupyter Notebook rather than Lab? I don't have a nice GPU so I need a hosted option. Thanks for any advice.
I've just arrived to this part and i was working with colab too, so i'd need an alternative to google colab in case there is no way of cleaning datasets as well as further problems related to colab.
Thanks for any advice :)
Most helpful comment
Thanks very much! After hours of struggling(forgive me i'm a beginner :-p ), finally i solved this problem(If that happened on mac or windows) by running these codes in the terminal:
now, we can enjoy lesson2_download.ipynb again. Simply type
jupyter notebookin the terminal and open it in the browser.