
!pip install ml-matrics
from ml_matrics.parity import density_hexbins
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
[<ipython-input-1-48d4b62e713f>](https://localhost:8080/#) in <module>()
----> 1 from ml_matrics.parity import density_hexbins
1 frames
[/usr/local/lib/python3.7/dist-packages/ml_matrics/__init__.py](https://localhost:8080/#) in <module>()
1 from .correlation import marchenko_pastur, marchenko_pastur_pdf
2 from .cumulative import add_dropdown, cum_err, cum_res
----> 3 from .elements import (
4 count_elements,
5 hist_elemental_prevalence,
[/usr/local/lib/python3.7/dist-packages/ml_matrics/elements.py](https://localhost:8080/#) in <module>()
1 from __future__ import annotations
2
----> 3 from typing import TYPE_CHECKING, Any, Literal, Sequence
4
5 import matplotlib.pyplot as plt
ImportError: cannot import name 'Literal' from 'typing' (/usr/lib/python3.7/typing.py)
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------
Not much pain i.t.o. workload. Should just take a few minutes. The pain is more psychological. 😄 I’m annoyed with Google for building Colab which is a great product but then completely abandoning it. My usual policy is not to put effort into supporting unmaintained platforms. But heck what are a few minutes…
Glad if it can be useful. 😄
If it’s just a warning, I think it’s safe to ignore. But I’m still surprised. Pylance should know better.
backports the pipe operator for unions and other modern type-hint syntax all the way to py37.
@sgbaird That’s cool. Thanks for reporting this trick. I added a link to your comment to the readme in 65105e9.
A workaround for this might be to perform a local installation via cloning and modifying the self-documenting f-strings:
Clone
Modify f-strings
This seemed to work OK for another use-case (CDVAE on Colab). Will probably try it out next time I’m surfacing an example of some package on Colab and want to use pymatviz.
Yes, big fan here. 😄
There should be a version of
ml_matricsfrom a while back that runs fine on Google Colab. Though unfortunately since I messed up thepython_requireswhich you just fixed in #18,pipdoesn’t know which version that is and tries to install the latest.There are 2 long-standing issues on upgrading the OS on which Colab runs which would also update the Python version it offers:
Unfortunately, that endeavor seems to have stalled quite badly. Not sure why it’s so difficult. You may want to subscribe there for updates.