CosmiQ / solaris

CosmiQ Works Geospatial Machine Learning Analysis Toolkit
https://solaris.readthedocs.io
Apache License 2.0
413 stars 112 forks source link

[BUG]: IProgress not found. Please update jupyter & ipywidgets #392

Open skyprince999 opened 4 years ago

skyprince999 commented 4 years ago

359 Summary of the bug

I am running the tutorials found here - Mapping vehicles & Tiling tutorial

And the code is breaking whenever the tqdm module is called (to show the status bar)!

Steps to reproduce the bug

I am running the mapping cars tutorial & the Tiling tutorial. (Links given above) For the car mapping tutorial the code breaks here -

The error occurs on the following line: trainer = sol.nets.train.Trainer(config)

For the Tiling tutorial the code breaks here -

raster_bounds_crs = raster_tiler.tile('/path/to/raster/file/3band/PS-RGB_mosaic_013022223133.tif')

Buggy behavior and/or error message

The error log had the following: Exception ignored in: <function tqdm.__del__ at 0x7fe617c33290> Traceback (most recent call last): File "/opt/conda/envs/solaris/lib/python3.7/site-packages/tqdm/std.py", line 1087, in __del__ self.close() File "/opt/conda/envs/solaris/lib/python3.7/site-packages/tqdm/notebook.py", line 247, in close self.sp(bar_style='success') AttributeError: 'tqdm_notebook' object has no attribute 'sp'

followed by -

ImportError: IProgress not found. Please update jupyter and ipywidgets.......

Expected behavior

Model should be downloaded, without any issues.

Environment information

Additional context

Hardware: N1 4vCPUs, 15GB RAM (GCP) NVidia Tesla T4

I get the above error while running the following notebook https://github.com/jshermeyer/solaris_cowc/blob/master/map_vehicles_cowc.ipynb

I first got the error while downloading the VGG16 pre-trained weights. So I downloaded the model and then copied it to the required directory. And then again ran the training code. However then I got the error while it was downloading the SpaceNet model weights.

While downloading the weights the error occurs for the status bar. from the get_model >> download_model module.

The same error re-occurred when I was running the Tiling tutorial

Again while running the tqdm module.

I have tried the steps as given in the following SF answer

DavidJohn197749 commented 3 years ago

i meet same the error on my juptyer notebook (using docker). i resolve it by changing the notebook dir. if you run jupyter notebook using root dir, using the --notebook-dir to change the dir may help you.

koegl commented 3 years ago

Thanks, that worked!

gaopinghai commented 3 years ago

i meet same the error on my juptyer notebook (using docker). i resolve it by changing the notebook dir. if you run jupyter notebook using root dir, using the --notebook-dir to change the dir may help you.

Sir, my dir is the Desktop. But I meet the same error.

I solved this by chaging

from tqdm.notebook import tqdm as tqdm

to

from tqdm import tqdm

solved this

ViniMM2 commented 3 years ago

i meet same the error on my juptyer notebook (using docker). i resolve it by changing the notebook dir. if you run jupyter notebook using root dir, using the --notebook-dir to change the dir may help you.

Sir, my dir is the Desktop. But I meet the same error.

I solved this by chaging

from tqdm.notebook import tqdm as tqdm

to

from tqdm import tqdm

solved this

Thanks, PingHGao. Really worked!

Aleksandar1932 commented 3 years ago

If you are using jupyter-lab, try this: jupyter nbextension enable --py widgetsnbextension. Was able to reproduce and fixed issues.

AcylSilane commented 3 years ago

If you are using jupyter-lab, try this: jupyter nbextension enable --py widgetsnbextension. Was able to reproduce and fixed issues.

Also needed to pip install ipywidgets for this.

ZSoumia commented 3 years ago

Reinstalling tqdm solved the issue for me conda install -c conda-forge tqdm

mickeykawai commented 2 years ago

i meet same the error on my juptyer notebook (using docker). i resolve it by changing the notebook dir. if you run jupyter notebook using root dir, using the --notebook-dir to change the dir may help you.

Sir, my dir is the Desktop. But I meet the same error. I solved this by chaging

from tqdm.notebook import tqdm as tqdm

to

from tqdm import tqdm

solved this

Thanks, PingHGao. Really worked!

i meet same the error on my juptyer notebook (using docker). i resolve it by changing the notebook dir. if you run jupyter notebook using root dir, using the --notebook-dir to change the dir may help you.

Sir, my dir is the Desktop. But I meet the same error.

I solved this by chaging

from tqdm.notebook import tqdm as tqdm

to

from tqdm import tqdm

solved this

Thank you, PingHGao! It helped and saved my time very much!

python3 --version
Python 3.9.10
# installed at non-standard directory. 

import sys
print("python:", sys.version)
python: 3.9.10 (main, Jan 31 2022, 06:20:15) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]

pip3 list | grep -E 'jupyter|ipywidgets|tqdm'
ipywidgets           7.6.5
jupyter              1.0.0
jupyter-client       7.1.2
jupyter-console      6.4.0
jupyter-core         4.9.1
jupyterlab-pygments  0.1.2
jupyterlab-widgets   1.0.2
tqdm                 4.62.3
scign commented 1 year ago

i meet same the error on my juptyer notebook (using docker). i resolve it by changing the notebook dir. if you run jupyter notebook using root dir, using the --notebook-dir to change the dir may help you.

Sir, my dir is the Desktop. But I meet the same error.

I solved this by chaging

from tqdm.notebook import tqdm as tqdm

to

from tqdm import tqdm

solved this

A more flexible way could be:

try:
    import IProgress
    from tqdm.notebook import tqdm
except ImportError:
    from tqdm import tqdm

This will import the widget version of tqdm if widgets are supported, and the console version if not.

ZhuoHan1998 commented 11 months ago

I tried to install ipywigdets by 'pip install ipywidgets', and it works for me. No such errors since then.

MewmewWho commented 11 months ago

I'm building my own Docker image from Jupyter's minimal-notebook image. With a 'mamba install ipywidgets', I casafely import tqdm classes from tqdm.notebook.

fti-sfuke commented 9 months ago

I encountered the same issue: image

with the following packages:

python3 jupyter.py --version
IPython          : 8.18.1
ipykernel        : 6.27.1
ipywidgets       : not installed
jupyter_client   : 8.6.0
jupyter_core     : 5.5.0
jupyter_server   : 2.12.1
jupyterlab       : 4.0.9
nbclient         : 0.9.0
nbconvert        : 7.12.0
nbformat         : 5.9.2
notebook         : not installed
qtconsole        : not installed
traitlets        : 5.14.0

The following packages are not installed directly with pip3 install jupyterlab

ipywidgets       : not installed
notebook         : not installed
qtconsole        : not installed

However, after installing these packages, the issue is resolved: image

pip3 install notebook ipywidgets qtconsole

And here are the installed versions:

IPython          : 8.18.1
ipykernel        : 6.27.1
ipywidgets       : 8.1.1
jupyter_client   : 8.6.0
jupyter_core     : 5.5.1
jupyter_server   : 2.12.1
jupyterlab       : 4.0.9
nbclient         : 0.9.0
nbconvert        : 7.13.0
nbformat         : 5.9.2
notebook         : 7.0.6
qtconsole        : 5.5.1
traitlets        : 5.14.0
GigleGig commented 5 months ago

I encountered the same issue: image

with the following packages:

python3 jupyter.py --version
IPython          : 8.18.1
ipykernel        : 6.27.1
ipywidgets       : not installed
jupyter_client   : 8.6.0
jupyter_core     : 5.5.0
jupyter_server   : 2.12.1
jupyterlab       : 4.0.9
nbclient         : 0.9.0
nbconvert        : 7.12.0
nbformat         : 5.9.2
notebook         : not installed
qtconsole        : not installed
traitlets        : 5.14.0

The following packages are not installed directly with pip3 install jupyterlab

ipywidgets       : not installed
notebook         : not installed
qtconsole        : not installed

However, after installing these packages, the issue is resolved: image

pip3 install notebook ipywidgets qtconsole

And here are the installed versions:

IPython          : 8.18.1
ipykernel        : 6.27.1
ipywidgets       : 8.1.1
jupyter_client   : 8.6.0
jupyter_core     : 5.5.1
jupyter_server   : 2.12.1
jupyterlab       : 4.0.9
nbclient         : 0.9.0
nbconvert        : 7.13.0
nbformat         : 5.9.2
notebook         : 7.0.6
qtconsole        : 5.5.1
traitlets        : 5.14.0

thanks bro, problem solved.

Irratzo commented 1 month ago

@gaopinghai 's solution (don't bother with tqdm.notebook and just always use from tqdm import tqdm) resolved the original issue in notebooks for me as well. But the output is not as nice anymore. If you want to see the nicely rendered tqdm progress bar in notebooks instead, go with the pip install ipywidgets solution instead, as others have pointed out, and keep your original import. That worked for me.