Stream: xarray

Topic: ✔ conflict between xarray and numba


view this post on Zulip Maurício Rebouças Rocha (Oct 11 2024 at 13:22):

Hello. After installing the Python module pycwt in my conda environment, I can no longer import xarray. It seems like xarray was updated, which probably caused a conflict with numba. I don't have permission to update numba. Does anyone have any idea how I should proceed? I have attached a picture of the error. Thanks in advance.
error.png

view this post on Zulip Michael Levy (Oct 11 2024 at 14:20):

How did you install pycwt? I'm guessing you used pip, and maybe that caused problems by installing updated versions of some dependencies? It looks like PyCWT only depends on numpy, scipy, matplotlib, and tqdm so my hypothesis is that pip installed a newer version of one (or more) of those packages that is conflicting with what conda can load, though maybe it updated numba as well? Here's what I see from the vanilla npl-2022b environment, where I have verified I can import xarray:

$ conda activate npl-2022b
(npl-2022b) $ for package in xarray numpy scipy matplotlib tqdm numba; do conda list | grep ^${package}; pip list | grep ^${package}; done
xarray                    2022.6.0           pyhd8ed1ab_1    conda-forge
xarray                        2022.6.0
numpy                     1.23.1           py38h3a7f9d9_0    conda-forge
numpy                         1.23.1
scipy                     1.9.0            py38hea3f02b_0    conda-forge
scipy                         1.9.0
matplotlib                3.5.2            py38h578d9bd_1    conda-forge
matplotlib-base           3.5.2            py38h826bfd8_1    conda-forge
matplotlib-inline         0.1.3              pyhd8ed1ab_0    conda-forge
matplotlib                    3.5.2
matplotlib-inline             0.1.3
tqdm                      4.64.0             pyhd8ed1ab_0    conda-forge
tqdm                          4.64.0
numba                     0.53.1           py38h8b71fd7_1    conda-forge
numba                         0.53.1

What happens when you run that bash command? Do you see differences in the version numbers, either compared to mine or where the first line [conda version] differs from the second line [pip version]?

As far as solutions go, I think you need to uninstall pycwt and whatever dependencies it install that are causing problems with xarray, verify that xarray can be loaded again, and then maybe installing an older version of pycwt (e.g. https://github.com/regeirk/pycwt/commit/d53dbe43deaf0c9d3aa54ae34f198386ef62e903 is from spring 2023) will play nicely with the conda-installed versions of the above packages?

view this post on Zulip Maurício Rebouças Rocha (Oct 11 2024 at 14:50):

Hi Mike, thanks for replying. Yes, I had installed pycwt using pip, but I've uninstalled it now. After the bash command, I got the following:
Screenshot1.png The error persists even after uninstalling pycwt.

view this post on Zulip Michael Levy (Oct 11 2024 at 14:57):

It looks like all four packages got updated -- can you run pip uninstall numpy scipy matplotlib tqdm? I think that's the right syntax...

view this post on Zulip Michael Levy (Oct 11 2024 at 14:57):

then check to see if xarray can be imported again

view this post on Zulip Michael Levy (Oct 11 2024 at 15:02):

Also, when you try to reinstall pywct, you might be able to use

$ pip install --use-feature=2020-resolver -e .

To force it to either use the installed versions from conda or give you an error about why it needs to update one (or more) of them, though my understanding is that the default should not have tried to update anything unless the dependency list demanded it

view this post on Zulip Maurício Rebouças Rocha (Oct 11 2024 at 15:08):

Got it, it worked. Thank you. I'll try installing pycwt again following your suggestion.

view this post on Zulip Notification Bot (Oct 11 2024 at 15:15):

Maurício Rebouças Rocha has marked this topic as resolved.


Last updated: May 16 2025 at 17:14 UTC