Skip to content

Fix main build and windows build #1122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 5, 2023

Conversation

tomwhite
Copy link
Collaborator

@tomwhite tomwhite commented Sep 4, 2023

@tomwhite
Copy link
Collaborator Author

tomwhite commented Sep 4, 2023

Unpinning xarray (which was pinned in #934) fixes the immediate problem of failing tests: https://github.com/pystatgen/sgkit/actions/runs/6071972311/job/16471074834?pr=1122.

However, this breaks the Sphinx build (maybe due to #934, or something else?), and the Windows build is still failing (see #1111 too). These both need more work.

@tomwhite
Copy link
Collaborator Author

tomwhite commented Sep 4, 2023

Running the doc build locally I get:

/Users/tom/workspace/sgkit/docs/examples/gwas_tutorial.ipynb: WARNING: Executing notebook failed: CellTimeoutError [mystnb.exec]

Which suggests that #934 is still a problem.

Also,

/Users/tom/workspace/sgkit/docs/examples/gwas_tutorial.ipynb: WARNING: Executing notebook failed: CellTimeoutError [mystnb.exec]
/Users/tom/workspace/sgkit/docs/examples/gwas_tutorial.ipynb: WARNING: Notebook exception traceback saved in: /Users/tom/workspace/sgkit/docs/_build/html/reports/examples/gwas_tutorial.err.log [mystnb.exec]
WARNING: 
>>>-------------------------------------------------------------------------
Exception in /Users/tom/workspace/sgkit/docs/how_do_i.rst at block ending on line 139
Specify :okexcept: as an option in the ipython:: block to suppress this message
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[18], line 1
----> 1 ds2.sel(variants=(ds2.variant_hwe_p_value > 1e-2))

File ~/miniconda3/envs/sgkit-dev-3.10/lib/python3.10/site-packages/xarray/core/dataset.py:3034, in Dataset.sel(self, indexers, method, tolerance, drop, **indexers_kwargs)
   3031                 query_results.drop_coords.append(k)
   3032     query_results.variables = no_scalar_variables
-> 3034 result = self.isel(indexers=query_results.dim_indexers, drop=drop)
   3035 return result._overwrite_indexes(*query_results.as_tuple()[1:])

File ~/miniconda3/envs/sgkit-dev-3.10/lib/python3.10/site-packages/xarray/core/dataset.py:2874, in Dataset.isel(self, indexers, drop, missing_dims, **indexers_kwargs)
   2872 indexers = either_dict_or_kwargs(indexers, indexers_kwargs, "isel")
   2873 if any(is_fancy_indexer(idx) for idx in indexers.values()):
-> 2874     return self._isel_fancy(indexers, drop=drop, missing_dims=missing_dims)
   2876 # Much faster algorithm for when all indexers are ints, slices, one-dimensional
   2877 # lists, or zero or one-dimensional np.ndarray's
   2878 indexers = drop_dims_from_indexers(indexers, self.dims, missing_dims)

File ~/miniconda3/envs/sgkit-dev-3.10/lib/python3.10/site-packages/xarray/core/dataset.py:2930, in Dataset._isel_fancy(self, indexers, drop, missing_dims)
   2926 var_indexers = {
   2927     k: v for k, v in valid_indexers.items() if k in var.dims
   2928 }
   2929 if var_indexers:
-> 2930     new_var = var.isel(indexers=var_indexers)
   2931     # drop scalar coordinates
   2932     # https://github.com/pydata/xarray/issues/6554
   2933     if name in self.coords and drop and new_var.ndim == 0:

File ~/miniconda3/envs/sgkit-dev-3.10/lib/python3.10/site-packages/xarray/core/variable.py:1368, in Variable.isel(self, indexers, missing_dims, **indexers_kwargs)
   1365 indexers = drop_dims_from_indexers(indexers, self.dims, missing_dims)
   1367 key = tuple(indexers.get(dim, slice(None)) for dim in self.dims)
-> 1368 return self[key]

File ~/miniconda3/envs/sgkit-dev-3.10/lib/python3.10/site-packages/xarray/core/variable.py:891, in Variable.__getitem__(self, key)
    878 def __getitem__(self: T_Variable, key) -> T_Variable:
    879     """Return a new Variable object whose contents are consistent with
    880     getting the provided key from the underlying data.
    881 
   (...)
    889     array `x.values` directly.
    890     """
--> 891     dims, indexer, new_order = self._broadcast_indexes(key)
    892     data = as_indexable(self._data)[indexer]
    893     if new_order:

File ~/miniconda3/envs/sgkit-dev-3.10/lib/python3.10/site-packages/xarray/core/variable.py:724, in Variable._broadcast_indexes(self, key)
    721 if all(isinstance(k, BASIC_INDEXING_TYPES) for k in key):
    722     return self._broadcast_indexes_basic(key)
--> 724 self._validate_indexers(key)
    725 # Detect it can be mapped as an outer indexer
    726 # If all key is unlabeled, or
    727 # key can be mapped as an OuterIndexer.
    728 if all(not isinstance(k, Variable) for k in key):

File ~/miniconda3/envs/sgkit-dev-3.10/lib/python3.10/site-packages/xarray/core/variable.py:776, in Variable._validate_indexers(self, key)
    771     raise IndexError(
    772         "{}-dimensional boolean indexing is "
    773         "not supported. ".format(k.ndim)
    774     )
    775 if is_duck_dask_array(k.data):
--> 776     raise KeyError(
    777         "Indexing with a boolean dask array is not allowed. "
    778         "This will result in a dask array of unknown shape. "
    779         "Such arrays are unsupported by Xarray."
    780         "Please compute the indexer first using .compute()"
    781     )
    782 if getattr(k, "dims", (dim,)) != (dim,):
    783     raise IndexError(
    784         "Boolean indexer should be unlabeled or on the "
    785         "same dimension to the indexed array. Indexer is "
   (...)
    788         )
    789     )

KeyError: 'Indexing with a boolean dask array is not allowed. This will result in a dask array of unknown shape. Such arrays are unsupported by Xarray.Please compute the indexer first using .compute()'

@codecov-commenter
Copy link

codecov-commenter commented Sep 4, 2023

Codecov Report

Merging #1122 (8c8ad28) into main (cc04858) will not change coverage.
The diff coverage is n/a.

❗ Current head 8c8ad28 differs from pull request most recent head 73151df. Consider uploading reports for the commit 73151df to get more accurate results

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the GitHub App Integration for your organization. Read more.

@@            Coverage Diff            @@
##              main     #1122   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           50        50           
  Lines         5054      5054           
=========================================
  Hits          5054      5054           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@tomwhite tomwhite force-pushed the fix-main-build-for-pandas-2.1.0 branch from 0abb5b0 to 16726de Compare September 5, 2023 11:41
@tomwhite tomwhite marked this pull request as ready for review September 5, 2023 12:03
@tomwhite
Copy link
Collaborator Author

tomwhite commented Sep 5, 2023

This fixes the various build issues we've been having: #1121 and #1109. This is ready for review and will unblock the other PRs that are waiting.

Note that I have commented out the calls to produce scatterplots in the GWAS tutorial notebook as these can be fixed later (#934).

@tomwhite tomwhite changed the title Unpin xarray Fix main build and windows build Sep 5, 2023
Copy link
Collaborator

@jeromekelleher jeromekelleher left a comment

Choose a reason for hiding this comment

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

LGTM

@tomwhite tomwhite added the auto-merge Auto merge label for mergify test flight label Sep 5, 2023
@tomwhite tomwhite merged commit 2b08b31 into sgkit-dev:main Sep 5, 2023
@tomwhite tomwhite deleted the fix-main-build-for-pandas-2.1.0 branch September 5, 2023 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge Auto merge label for mergify test flight
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Main build is failing with Pandas 2.1.0 Windows build is failing
4 participants