question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sample_data try/except import wrapper fails

See original GitHub issue

ALL software version info

hvplot: 0.7.3

Description of expected behavior and the observed behavior

The following import fails, despite the all-catching except in the code?? (Honestly stumped)

from hvplot.sample_data import us_crime, airline_flights
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/tmp/ipykernel_3185062/1788543639.py in <module>
----> 1 from hvplot.sample_data import us_crime, airline_flights

~/miniconda3/envs/py39/lib/python3.9/site-packages/hvplot/sample_data.py in <module>
     23 # Add catalogue entries to namespace
     24 for _c in catalogue:
---> 25     globals()[_c] = catalogue[_c]

~/miniconda3/envs/py39/lib/python3.9/site-packages/intake/catalog/base.py in __getitem__(self, key)
    398             if e.container == 'catalog':
    399                 return e(name=key)
--> 400             return e()
    401         if isinstance(key, str) and '.' in key:
    402             key = key.split('.')

~/miniconda3/envs/py39/lib/python3.9/site-packages/intake/catalog/entry.py in __call__(self, persist, **kwargs)
     75             raise ValueError('Persist value (%s) not understood' % persist)
     76         persist = persist or self._pmode
---> 77         s = self.get(**kwargs)
     78         if persist != 'never' and isinstance(s, PersistMixin) and s.has_been_persisted:
     79             from ..container.persist import store

~/miniconda3/envs/py39/lib/python3.9/site-packages/intake/catalog/local.py in get(self, **user_parameters)
    287             return self._default_source
    288 
--> 289         plugin, open_args = self._create_open_args(user_parameters)
    290         data_source = plugin(**open_args)
    291         data_source.catalog_object = self._catalog

~/miniconda3/envs/py39/lib/python3.9/site-packages/intake/catalog/local.py in _create_open_args(self, user_parameters)
    261 
    262         if len(self._plugin) == 0:
--> 263             raise ValueError('No plugins loaded for this entry: %s\n'
    264                              'A listing of installable plugins can be found '
    265                              'at https://intake.readthedocs.io/en/latest/plugin'

ValueError: No plugins loaded for this entry: parquet
A listing of installable plugins can be found at https://intake.readthedocs.io/en/latest/plugin-directory.html .

For reference, this is the code in 0.7.3:

import os

try:
    from intake import open_catalog
except:
    raise ImportError('Loading hvPlot sample data requires intake '
                      'and intake-parquet. Install it using conda or '
                      'pip before loading data.')

How can intake throw a ValueError??

Complete, minimal, self-contained example code that reproduces the issue

  • Have only the package intake installed, no other intake-subpackages.
  • Execute : from hvplot.sample_data import us_crime, airline_flights
# code goes here between backticks
from hvplot.sample_data import us_crime, airline_flights

Stack traceback and/or browser JavaScript console output

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/tmp/ipykernel_3185062/1788543639.py in <module>
----> 1 from hvplot.sample_data import us_crime, airline_flights

~/miniconda3/envs/py39/lib/python3.9/site-packages/hvplot/sample_data.py in <module>
     23 # Add catalogue entries to namespace
     24 for _c in catalogue:
---> 25     globals()[_c] = catalogue[_c]

~/miniconda3/envs/py39/lib/python3.9/site-packages/intake/catalog/base.py in __getitem__(self, key)
    398             if e.container == 'catalog':
    399                 return e(name=key)
--> 400             return e()
    401         if isinstance(key, str) and '.' in key:
    402             key = key.split('.')

~/miniconda3/envs/py39/lib/python3.9/site-packages/intake/catalog/entry.py in __call__(self, persist, **kwargs)
     75             raise ValueError('Persist value (%s) not understood' % persist)
     76         persist = persist or self._pmode
---> 77         s = self.get(**kwargs)
     78         if persist != 'never' and isinstance(s, PersistMixin) and s.has_been_persisted:
     79             from ..container.persist import store

~/miniconda3/envs/py39/lib/python3.9/site-packages/intake/catalog/local.py in get(self, **user_parameters)
    287             return self._default_source
    288 
--> 289         plugin, open_args = self._create_open_args(user_parameters)
    290         data_source = plugin(**open_args)
    291         data_source.catalog_object = self._catalog

~/miniconda3/envs/py39/lib/python3.9/site-packages/intake/catalog/local.py in _create_open_args(self, user_parameters)
    261 
    262         if len(self._plugin) == 0:
--> 263             raise ValueError('No plugins loaded for this entry: %s\n'
    264                              'A listing of installable plugins can be found '
    265                              'at https://intake.readthedocs.io/en/latest/plugin'

ValueError: No plugins loaded for this entry: parquet
A listing of installable plugins can be found at https://intake.readthedocs.io/en/latest/plugin-directory.html .

Additional info

The list of required package is now this:

  • intake-parquet
  • intake-xarray
  • s3fs

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:26 (25 by maintainers)

github_iconTop GitHub Comments

2reactions
Hoxbrocommented, Feb 21, 2022

I uninstalled iprogress because it was explicitly installed when creating the environment. iprogress is no longer supported and from what I can see it has been replaced by something similar in ipywidgets. I can only get the download to work with ipywidgets and not with iprogress. I don’t understand why yours work with iprogress and mine doesn’t.

I will file some bug reports later, so hopefully, new users (and me…) will be able to run the example without all these problems.

Thank you for helping me with finding the root of the problem, I really appreciate it!

2reactions
Hoxbrocommented, Jan 11, 2022

I just think it is a lot to ask for new users to download 4 packages just to get access to a 8 KB file (us-crime) and a 15 MB (airline_flights) file. I just tried to see if I could run the Plotting page from a clean environment:

Created the environment with mamba create -n hvplot_example python=3.8 hvplot jupyterlab

First cell needed to install dask.

Second cell needed to install intake intake-parquet intake-xarray s3fs.

Third cell needed to install IProgress, afterwards it raises a FileNotFoundError? Then I tried to change cell to:

import dask.dataframe as dd
flights = dd.read_parquet("s3://assets.holoviews.org/data/airline_flights.parq").persist()
print(type(flights))
flights.head()

But this gives a NoCredentialsError: Unable to locate credentials. Got this to work by changing s3 to http.

To run the bivariate plot I needed to install scipy.

For the section Large Data to run I needed datashader.

Other things I noticed when trying to get the notebook to work:

  1. The links in hvplot namespace do not work as they should be lowercase.
  2. I don’t think you explicit need to run .compute on dask dataframe anymore to use hvplot (but I could be wrong).
  3. The import error for datashader references the name datashading instead of datashader.

I will properly make a PR for 1 and 3 today.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Import not working inside wrapper function [duplicate]
Within the function body, you can't use time as both as a global variable: start_time = time.perf_counter() # line 1 of the function....
Read more >
Step 1 - A simple example - Learn to Code
Step 1 - A simple example. In python, we handle exceptions using a block called a try-except which wraps around our code.
Read more >
How to Handle JWTs in Python - Auth0
The first thing you'll need to do is to import the jwt object. This comes from the PyJWT package: import jwt. Before we...
Read more >
Python Tutorial
Return -1 on failure. >> s.find('b') ... One option for handling this problem is to wrap the problematic code in a try-except as...
Read more >
Django Tips: Recovering Gracefully From ORM Errors
models.py """ from django.db import models class Workshop(models. ... catch the exception with try/except for gracefully handling the error.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found