pythonpyvista

PyVista download of examples raises error


I recently discovered PyVista (which looks awesome) and wanted to go through some of the examples. However, I get an error when running examples.download_ functions. For example, the lines

import pyvista as pv
from pyvista import examples

vol = examples.download_brain()

gives the following error

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_24180/817299612.py in <module>
      2 from pyvista import examples
      3 
----> 4 vol = examples.download_brain()

C:\ProgramData\Anaconda3\lib\site-packages\pyvista\examples\downloads.py in download_brain(load)
   1912 
   1913     """
-> 1914     return _download_and_read('brain.vtk', load=load)
   1915 
   1916 

C:\ProgramData\Anaconda3\lib\site-packages\pyvista\examples\downloads.py in _download_and_read(filename, texture, file_format, load, progress_bar)
    262         raise ValueError('Cannot download and read an archive file')
    263 
--> 264     saved_file = download_file(filename, progress_bar=progress_bar)
    265     if not load:
    266         return saved_file

C:\ProgramData\Anaconda3\lib\site-packages\pyvista\examples\downloads.py in download_file(filename, progress_bar)
    171     """
    172     try:  # should the file already exist within fetcher's registry
--> 173         return _download_file(filename, progress_bar)
    174     except ValueError:  # otherwise simply add the file to the registry
    175         FETCHER.registry[filename] = None

C:\ProgramData\Anaconda3\lib\site-packages\pyvista\examples\downloads.py in _download_file(filename, progress_bar)
    183         processor=Unzip() if filename.endswith('.zip') else None,
    184         downloader=_file_copier if _FILE_CACHE else None,
--> 185         progressbar=progress_bar,
    186     )
    187 

TypeError: fetch() got an unexpected keyword argument 'progressbar'

Other example downloads give similar errors. I run python 3.7.15 and PyVista 0.37.0.

EDIT: Output from pv.Report():

--------------------------------------------------------------------------------
  Date: Mon Dec 05 08:52:47 2022 W. Europe Standard Time

                OS : Windows
            CPU(s) : 8
           Machine : AMD64
      Architecture : 64bit
               RAM : 15.7 GiB
       Environment : IPython
        GPU Vendor : Intel
      GPU Renderer : Intel(R) UHD Graphics 620
       GPU Version : 4.5.0 - Build 26.20.100.6999

  Python 3.7.15 (default, Nov 24 2022, 18:44:54) [MSC v.1916 64 bit (AMD64)]

           pyvista : 0.37.0
               vtk : 9.0.3
             numpy : 1.19.2
           imageio : 2.19.3
            scooby : 0.7.0
             pooch : v1.4.0
        matplotlib : 3.5.2
             PyQt5 : 5.9.2
           IPython : 7.31.1
          colorcet : 3.0.1
             scipy : 1.5.2
              tqdm : 4.64.1
        jupyterlab : 3.5.0

  Intel(R) oneAPI Math Kernel Library Version 2021.4-Product Build 20210904
  for Intel(R) 64 architecture applications
--------------------------------------------------------------------------------

Solution

  • The progressbar kwarg that PyVista passes on to fetch() was implemented in this pooch pull request, released in version 1.6.0 at the end of January 2022. Updating your pooch version will fix this issue.

    In the meantime I'll raise the issue of changing this on the PyVista side to be more forgiving. Progress bars are a fairly niche convenience function, so it would be better to let the feature drop out for older versions of pooch (assuming the rest of PyVista's use of pooch will work).