zoukankan      html  css  js  c++  java
  • ImportError: FloatProgress not found. Please update jupyter and ipywidgets.问题

    一、问题描述:

    在进行深度学习导包时,运行代码:

    import torch
    import torchvision
    import torchvision.transforms as transforms
    import matplotlib.pyplot as plt
    import sys
    sys.path.append("..")
    import d2lzh_pytorch as d2l
    

    出现了“ImportError: FloatProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html” 错误。错误代码如下:

    Downloading http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/train-images-idx3-ubyte.gz to C:Users木子/Datasets/FashionMNISTFashionMNIST
    aw	rain-images-idx3-ubyte.gz
    ---------------------------------------------------------------------------
    NameError                                 Traceback (most recent call last)
    D:InstallSoftwareAnacondaenvsspyder_py3.5libsite-packages	qdm
    otebook.py in status_printer(_, total, desc, ncols)
         97             else:  # No total? Show info style bar with no progress tqdm status
    ---> 98                 pbar = IProgress(min=0, max=1)
         99                 pbar.value = 1
    
    NameError: name 'IProgress' is not defined
    
    During handling of the above exception, another exception occurred:
    
    ImportError                               Traceback (most recent call last)
    <ipython-input-1-e1dda4d0e124> in <module>
          5 import sys
          6 sys.path.append("..")
    ----> 7 import d2lzh_pytorch as d2l
    
    D:InstallSoftwareAnacondaenvsspyder_py3.5d2lzh_pytorch\__init__.py in <module>
    ----> 1 from .utils import *
          2 
    
    D:InstallSoftwareAnacondaenvsspyder_py3.5d2lzh_pytorchutils.py in <module>
          6 import d2lzh_pytorch as d2l
          7 
    ----> 8 minst_train = torchvision.datasets.FashionMNIST(root = '~/Datasets/FashionMNIST',train=True,download=True,transform=transforms.ToTensor())
          9 minst_test = torchvision.datasets.FashionMNIST(root = '~/Datasets/FashionMNIST',train=False,download=True,transform=transforms.ToTensor())
         10 print(type(mnist_train))
    
    D:InstallSoftwareAnacondaenvsspyder_py3.5libsite-packages	orchvisiondatasetsmnist.py in __init__(self, root, train, transform, target_transform, download)
         68 
         69         if download:
    ---> 70             self.download()
         71 
         72         if not self._check_exists():
    
    D:InstallSoftwareAnacondaenvsspyder_py3.5libsite-packages	orchvisiondatasetsmnist.py in download(self)
        135         for url, md5 in self.resources:
        136             filename = url.rpartition('/')[2]
    --> 137             download_and_extract_archive(url, download_root=self.raw_folder, filename=filename, md5=md5)
        138 
        139         # process and save as torch files
    
    D:InstallSoftwareAnacondaenvsspyder_py3.5libsite-packages	orchvisiondatasetsutils.py in download_and_extract_archive(url, download_root, extract_root, filename, md5, remove_finished)
        262         filename = os.path.basename(url)
        263 
    --> 264     download_url(url, download_root, filename, md5)
        265 
        266     archive = os.path.join(download_root, filename)
    
    D:InstallSoftwareAnacondaenvsspyder_py3.5libsite-packages	orchvisiondatasetsutils.py in download_url(url, root, filename, md5)
         83             urllib.request.urlretrieve(
         84                 url, fpath,
    ---> 85                 reporthook=gen_bar_updater()
         86             )
         87         except (urllib.error.URLError, IOError) as e:
    
    D:InstallSoftwareAnacondaenvsspyder_py3.5libsite-packages	orchvisiondatasetsutils.py in gen_bar_updater()
         13 
         14 def gen_bar_updater():
    ---> 15     pbar = tqdm(total=None)
         16 
         17     def bar_update(count, block_size, total_size):
    
    D:InstallSoftwareAnacondaenvsspyder_py3.5libsite-packages	qdm
    otebook.py in __init__(self, *args, **kwargs)
        207         total = self.total * unit_scale if self.total else self.total
        208         self.container = self.status_printer(
    --> 209             self.fp, total, self.desc, self.ncols)
        210         self.sp = self.display
        211 
    
    D:InstallSoftwareAnacondaenvsspyder_py3.5libsite-packages	qdm
    otebook.py in status_printer(_, total, desc, ncols)
        102             # #187 #451 #558
        103             raise ImportError(
    --> 104                 "FloatProgress not found. Please update jupyter and ipywidgets."
        105                 " See https://ipywidgets.readthedocs.io/en/stable"
        106                 "/user_install.html")
    
    ImportError: FloatProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
    

    二、问题分析:

    阅读上面即可知,大多是因为ipywidgets原因:版本或者根本没有安装ipywidgets插件。

    三、问题解决:

    安装ipywidgets插件官方文档(这个解释的全面)

    1. pip安装命令

    建议使用pip命令安装,使用conda安装我出现了一系列奇奇怪怪的问题,同时个人建议安装5.0.0版本pip install ipywidgets==5.0.0,避免在jupyter notebook中出现找不到ipywidgets插件的问题。

    pip install ipywidgets
    jupyter nbextension enable --py widgetsnbextension
    

    2. conda 安装命令

    在多个环境中安装
    有时Jupyter Notebook和IPython内核安装在不同的环境(virtualenv或conda环境)中。当使用环境提供不同的IPython内核时会发生这种情况。在这种情况下,安装需要两个步骤。

    首先,您需要widgetsnbextension在包含Jupyter Notebook服务器的环境中安装软件包。接下来,您需要ipywidgets在将使用ipywidgets的每个内核环境中进行安装 。

    如果使用conda环境,并且笔记本计算机安装在 base环境中,内核安装在环境中py36,则命令为:

    conda install -n base -c conda-forge widgetsnbextension
    conda install -n py36 -c conda-forge ipywidgets
    

    如果你使用conda 安装出现了“关于ipywidgets插件,错误'Widget Javascript not detected. It may not be installed or enabled properly.'”这个问题参考博客:关于ipywidgets插件,错误'Widget Javascript not detected. It may not be installed or enabled properly.

  • 相关阅读:
    POJ2503——Babelfish
    深入理解Spring AOP之二代理对象生成
    怎样让索引仅仅能被一个SQL使用
    Linux下改动Oracle数据库字符集命令
    LeetCode15:3Sum
    【C语言】编写函数实现库函数atoi,把字符串转换成整形
    Scala入门到精通——第二十二节 高级类型 (一)
    J2SE核心开发实战(一)——认识J2SE
    A glance on VDBI
    zookeeper 配置文件说明(zoo.cfg)
  • 原文地址:https://www.cnblogs.com/somedayLi/p/12355256.html
Copyright © 2011-2022 走看看