Skip to content
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

plotly incompatible with pyyaml==0.6.0 via use of dask.distributed #3433

Open
sgbaird opened this issue Oct 22, 2021 · 4 comments
Open

plotly incompatible with pyyaml==0.6.0 via use of dask.distributed #3433

sgbaird opened this issue Oct 22, 2021 · 4 comments

Comments

@sgbaird
Copy link

sgbaird commented Oct 22, 2021

See plotly-dask-deprecation Google Colab notebook for a minimal reproducer. See also stack exchange. The issue arises when a package other than plotly updates pyyaml to v6.0 (and it's run on Google Colab). dask addressed this. See also dask/dask#4597

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-1-86e89bd44552> in <module>()
----> 1 import plotly.express as px

9 frames
/usr/local/lib/python3.7/site-packages/plotly/express/__init__.py in <module>()
     13     )
     14 
---> 15 from ._imshow import imshow
     16 from ._chart_types import (  # noqa: F401
     17     scatter,

/usr/local/lib/python3.7/site-packages/plotly/express/_imshow.py in <module>()
      9 
     10 try:
---> 11     import xarray
     12 
     13     xarray_imported = True

/usr/local/lib/python3.7/dist-packages/xarray/__init__.py in <module>()
      1 import pkg_resources
      2 
----> 3 from . import testing, tutorial, ufuncs
      4 from .backends.api import (
      5     load_dataarray,

/usr/local/lib/python3.7/dist-packages/xarray/tutorial.py in <module>()
     11 import numpy as np
     12 
---> 13 from .backends.api import open_dataset as _open_dataset
     14 from .backends.rasterio_ import open_rasterio as _open_rasterio
     15 from .core.dataarray import DataArray

/usr/local/lib/python3.7/dist-packages/xarray/backends/__init__.py in <module>()
      4 formats. They should not be used directly, but rather through Dataset objects.
      5 """
----> 6 from .cfgrib_ import CfGribDataStore
      7 from .common import AbstractDataStore, BackendArray, BackendEntrypoint
      8 from .file_manager import CachingFileManager, DummyFileManager, FileManager

/usr/local/lib/python3.7/dist-packages/xarray/backends/cfgrib_.py in <module>()
     14     _normalize_path,
     15 )
---> 16 from .locks import SerializableLock, ensure_lock
     17 from .store import StoreBackendEntrypoint
     18 

/usr/local/lib/python3.7/dist-packages/xarray/backends/locks.py in <module>()
     11 
     12 try:
---> 13     from dask.distributed import Lock as DistributedLock
     14 except ImportError:
     15     DistributedLock = None

/usr/local/lib/python3.7/dist-packages/dask/distributed.py in <module>()
      1 # flake8: noqa
      2 try:
----> 3     from distributed import *
      4 except ImportError:
      5     msg = (

/usr/local/lib/python3.7/dist-packages/distributed/__init__.py in <module>()
      1 from __future__ import print_function, division, absolute_import
      2 
----> 3 from . import config
      4 from dask.config import config
      5 from .actor import Actor, ActorFuture

/usr/local/lib/python3.7/dist-packages/distributed/config.py in <module>()
     18 
     19 with open(fn) as f:
---> 20     defaults = yaml.load(f)
     21 
     22 dask.config.update_defaults(defaults)

TypeError: load() missing 1 required positional argument: 'Loader'
@nicolaskruchten
Copy link
Member

Hmmm I'm confused about this. plotly doesn't depend on pyyaml .. ?

@sgbaird
Copy link
Author

sgbaird commented Oct 22, 2021

I agree, this is confusing. plotly doesn't error out if nothing has installed pyyaml, but if some other package installs pyyaml==6.0, then dask.distributed errors out. A hidden dependency?? I'm not sure if this is specific to Google Colab or not.

@sgbaird
Copy link
Author

sgbaird commented Oct 22, 2021

I did a quick verification, and it seems to be an issue related to Google Colab specifically. Even with pyyaml==6.0 installed, it ran fine on my local machine.

@JeremyWhittaker
Copy link

JeremyWhittaker commented Feb 28, 2022

I'm getting this same error on Colab. I was wondering if anyone could offer a suggestion to fix? I've been running plotly express for a long time and it just started today.

import plotly.express as px

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-8-6d41d77e76ca>](https://localhost:8080/#) in <module>()
     21 import plotly.graph_objects as go
     22 get_ipython().system('yaml.full_load()')
---> 23 import plotly.express as px
     24 import logging
     25 import sys

9 frames
[/usr/local/lib/python3.7/dist-packages/plotly/express/__init__.py](https://localhost:8080/#) in <module>()
     13     )
     14 
---> 15 from ._imshow import imshow
     16 from ._chart_types import (  # noqa: F401
     17     scatter,

[/usr/local/lib/python3.7/dist-packages/plotly/express/_imshow.py](https://localhost:8080/#) in <module>()
      9 
     10 try:
---> 11     import xarray
     12 
     13     xarray_imported = True

[/usr/local/lib/python3.7/dist-packages/xarray/__init__.py](https://localhost:8080/#) in <module>()
      1 import pkg_resources
      2 
----> 3 from . import testing, tutorial, ufuncs
      4 from .backends.api import (
      5     load_dataarray,

[/usr/local/lib/python3.7/dist-packages/xarray/tutorial.py](https://localhost:8080/#) in <module>()
     11 import numpy as np
     12 
---> 13 from .backends.api import open_dataset as _open_dataset
     14 from .backends.rasterio_ import open_rasterio as _open_rasterio
     15 from .core.dataarray import DataArray

[/usr/local/lib/python3.7/dist-packages/xarray/backends/__init__.py](https://localhost:8080/#) in <module>()
      4 formats. They should not be used directly, but rather through Dataset objects.
      5 """
----> 6 from .cfgrib_ import CfGribDataStore
      7 from .common import AbstractDataStore, BackendArray, BackendEntrypoint
      8 from .file_manager import CachingFileManager, DummyFileManager, FileManager

[/usr/local/lib/python3.7/dist-packages/xarray/backends/cfgrib_.py](https://localhost:8080/#) in <module>()
     14     _normalize_path,
     15 )
---> 16 from .locks import SerializableLock, ensure_lock
     17 from .store import StoreBackendEntrypoint
     18 

[/usr/local/lib/python3.7/dist-packages/xarray/backends/locks.py](https://localhost:8080/#) in <module>()
     11 
     12 try:
---> 13     from dask.distributed import Lock as DistributedLock
     14 except ImportError:
     15     DistributedLock = None

[/usr/local/lib/python3.7/dist-packages/dask/distributed.py](https://localhost:8080/#) in <module>()
      1 # flake8: noqa
      2 try:
----> 3     from distributed import *
      4 except ImportError:
      5     msg = (

[/usr/local/lib/python3.7/dist-packages/distributed/__init__.py](https://localhost:8080/#) in <module>()
      1 from __future__ import print_function, division, absolute_import
      2 
----> 3 from . import config
      4 from dask.config import config
      5 from .actor import Actor, ActorFuture

[/usr/local/lib/python3.7/dist-packages/distributed/config.py](https://localhost:8080/#) in <module>()
     18 
     19 with open(fn) as f:
---> 20     defaults = yaml.load(f)
     21 
     22 dask.config.update_defaults(defaults)

TypeError: load() missing 1 required positional argument: 'Loader'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants