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

Upgrade kaleido 0.2.1 -> 0.4.1 is causing errors in CI #226

Open
bmosley opened this issue Nov 15, 2024 · 10 comments · Fixed by #224
Open

Upgrade kaleido 0.2.1 -> 0.4.1 is causing errors in CI #226

bmosley opened this issue Nov 15, 2024 · 10 comments · Fixed by #224
Assignees
Labels
active bug something broken P2 needed for current cycle TNG related to next-generation architecture

Comments

@bmosley
Copy link

bmosley commented Nov 15, 2024

Hi, first of all, thank you for this project. Really appreciate the work! After as of the 0.4.1 release several of our unit tests started failing here. In the meantime I've pinned our version to 0.2.1 and all is well but not sure if there's something deprecated that I didn't see before as our code hasn't changed in ages. Let me know if there's more information you need. Thank you.

         self._plotlyfier = os.path.join(
         os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
         'vendor',
         'kaleido_scopes.js'
         )
         path = os.environ.get("BROWSER_PATH", which_browser())
         if tmp_path:
         temp_args = dict(dir=self.tmp_path)
         >       elif "snap" in path:
         E       TypeError: argument of type 'NoneType' is not iterable
         
         /usr/local/bin/python-3.12.0-1/lib/python3.12/site-packages/kaleido/scopes/plotly.py:64: TypeError

and also seeing this traceback as well with the only change being Kaleido 0.4.1

        # force a single process to manage the trace rendering
>       pio.kaleido.scope.chromium_args += (
            "--single-process",
            "--disable-gpu",
        )
E       AttributeError: 'PlotlyScope' object has no attribute 'chromium_args'
@bmosley bmosley changed the title Upgrade kaleido 0.2.1 > 0.4.1 is causing errors in CI Upgrade kaleido 0.2.1 -> 0.4.1 is causing errors in CI Nov 15, 2024
@bmosley
Copy link
Author

bmosley commented Nov 15, 2024

This might be the same as #223 but im not entirely sure

@tpvasconcelos
Copy link

tpvasconcelos commented Nov 15, 2024

I have also just bit bitten by this issue.

A possible solution is to change the following line

elif "snap" in path:

to:

-elif "snap" in path:
+elif path is not None and "snap" in path:

@tpvasconcelos
Copy link

tpvasconcelos commented Nov 15, 2024

Opened a PR just in case you think this is a viable solution: #227

@jacobthompson101
Copy link

Had the same issue today and 0.2.1 saved me in jupyterlabs, you beat me by an hour or so :) I can now write images again, I was confused as it worked fine two days ago and figured it was something to with how I original installed things the first time.

@skrawcz
Copy link

skrawcz commented Nov 17, 2024

+1 to fixing this issue.

skrawcz added a commit to DAGWorks-Inc/hamilton that referenced this issue Nov 17, 2024
plotly/Kaleido#226
is the issue. We just need to wait.
skrawcz added a commit to DAGWorks-Inc/hamilton that referenced this issue Nov 17, 2024
plotly/Kaleido#226
is the issue. We just need to wait.
skrawcz added a commit to DAGWorks-Inc/hamilton that referenced this issue Nov 18, 2024
* Fix for vaex - numpy breaking it. Not sure when vaex will fix it.

* Fix for pandera dask 

dask-expr library is now needed.

Note: python3.8 doesn't have dask-expr. So we skip pandera dask
now in python 3.8. Not worth worrying about.

* Temporary fix for failing plotly tests

plotly/Kaleido#226
is the issue. We just need to wait.
@gvwilson gvwilson added bug something broken P2 needed for current cycle TNG related to next-generation architecture labels Nov 18, 2024
@haleyglm-8451
Copy link

+1 to fixing this issue - downgrading to 0.2.1 did NOT work within Azure Databricks
Attempted on

  • DBR: 12.2 LTS, 13.3LTS, 14.3LTS, 15.4LTS

After several hours of trying different DBR configs/Plotly versions/Kaleido versions, I've finally gotten it to work on
DBR: 15.4LTS
Plotly 5.1.0
Kaleido 0.1.0

tpvasconcelos added a commit to tpvasconcelos/ridgeplot that referenced this issue Nov 18, 2024
@ayjayt ayjayt added the active label Nov 18, 2024
@ayjayt ayjayt linked a pull request Nov 18, 2024 that will close this issue
@janosh
Copy link

janosh commented Nov 20, 2024

just to help discoverability of this thread, another error you hit when you manually fix the elif "snap" in path: issue and then try to write a figure in binary format (PDF, PNG, ...)

-> 1035 view = memoryview(data)
   1036 with self.open(mode='wb') as f:
   1037     return f.write(view)

TypeError: memoryview: a bytes-like object is required, not 'NoneType'

@ayjayt
Copy link
Collaborator

ayjayt commented Nov 20, 2024

Hi @janosh,

My suggestion is to pin the old version of kaleido <0.4.0 or use the new version of kaleido >=0.4.2 (v1.0.0rc) (you need to pin these as well or set --pre). This is very likely stems from a) using the new version of kaleido w/o downloading the dependency.

Plotly decided to yank the new version release so as not to force-update every given the dependency change:

One must now have chrome or chromium (or edge- wait) installed to use kaleido >=v0.4.x. We packaged it internally before but now it is too big for pypi's rules- we're looking at other methods.

You can set BROWSER_PATH= env var before running kaleido if you want to point to edge- an update will also do that automatically in the future.

@s-banach
Copy link

A bug like "snap" in None could never happen if you were developing with a type checker...

@tpvasconcelos
Copy link

A bug like "snap" in None could never happen if you were developing with a type checker...

While type annotation do make codebases more resistant to these sorts of bugs, in this specific instance since choreographer isn't annotated itself mypy would not catch this bug.

@s-banach I'm sure the maintainers would welcome a PR from you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
active bug something broken P2 needed for current cycle TNG related to next-generation architecture
Projects
None yet
9 participants