Skip to content

Suggest installing dask when not discovered by ChunkManager - #7963

Closed
TomNicholas wants to merge 2 commits into
pydata:mainfrom
TomNicholas:improve_error_no_dask
Closed

Suggest installing dask when not discovered by ChunkManager#7963
TomNicholas wants to merge 2 commits into
pydata:mainfrom
TomNicholas:improve_error_no_dask

Conversation

@TomNicholas

@TomNicholasTomNicholas commented Jul 5, 2023

Copy link
Copy Markdown
Member
  • ClosesBetter chunk manager error #7962
  • Tests added
  • User visible changes (including notable bug fixes) are documented in whats-new.rst
  • New functions/methods are listed in api.rst

@TomNicholasTomNicholas added the topic-chunked-arrays Managing different chunked backends, e.g. dask label Jul 5, 2023
@TomNicholasTomNicholas changed the title add package name to error messageSuggest installing dask when not discovered by ChunkManagerJul 5, 2023
@TomNicholasTomNicholas mentioned this pull request Jul 5, 2023
possible_missing_package_name = type(chunked_arr).__module__.split(".")[0]
raise TypeError(
f"Could not find a Chunk Manager which recognises type {type(chunked_arr)}"
f"Could not find a Chunk Manager which recognises type {type(chunked_arr)}. Try installing the {possible_missing_package_name} package."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
f"Could not find a Chunk Manager which recognises type {type(chunked_arr)}. Try installing the{possible_missing_package_name} package."
f"Could not find a Chunk Manager which recognises type {type(chunked_arr)}. Try searching for and installing a{possible_missing_package_name}_xarray package."

? Since you could have cubed installed but not cubed-xarray

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point, but then would that be more confusing if the problem is that the user doesn't have Dask installed? Because then it would point them towards a non-existent dask_xarray package...

@TomNicholas

Copy link
Copy Markdown
MemberAuthor

This came up again in #8301.

To be honest, given there are only 2 known chunkmanagers at the moment, maybe we should just special case the error message to tell the user exactly which package to install?

@dcherian

Copy link
Copy Markdown
Contributor

Works for me!

]
if not selected:
possible_missing_package_name = type(chunked_arr).__module__.split(".")[0]
raise TypeError(

@andersy005andersy005Oct 16, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

considering that the error is actually caused by a missing package, could we consider

  • using a more general exception, such as ModuleNotFoundError, instead of the current TypeError?
  • or implementing a custom exception specifically for this purpose?

@TomNicholas

Copy link
Copy Markdown
MemberAuthor

Closing in favour of #9676

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic-chunked-arraysManaging different chunked backends, e.g. dasktopic-error reporting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Better chunk manager error

3 participants

@TomNicholas@dcherian@andersy005