Closed binste closed 1 year ago
Nice, I actually just encountered this in the wild and started writing a ticket over it. For reference, I'll just paste the ticket I was going to file.
I was playing around with how to minimize the size of Docker images by uninstalling some of the Python tools that shouldn't be needed at runtime:
RUN pip uninstall --yes pip setuptools wheel
...and it works fine with (a) Vega-Altair 5.0.1 + Pandas 1.5.3, (b) my experimental Vega-Altair 5.1.0 + Pandas 2.0 w/PyArrow backend branch; but not in (c) my experimental Altair 5.1.0 + Polars branch (fuller stack trace at bottom):
File "/covid-19-puerto-rico/venv/lib/python3.11/site-packages/altair/utils/data.py", line 352, in import_pyarrow_interchange
import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'
Searching for more info on this module I find this page with a deprecation note:
Attention
Use of
pkg_resources
is deprecated in favor of importlib.resources, importlib.metadata and their backports (importlib_resources, importlib_metadata). Some useful APIs are also provided by packaging (e.g. requirements and version parsing). Users should refrain from new usage of pkg_resources and should work to port to importlib-based solutions.
Good point, thanks for the write up! We didn't have pkg_resourced as an explicit dependency of Altair which was an unknown issue apart from the deprecation. Bug fix will be part of the next Altair release :)
It's used in
import_pyarrow_interchange
indata.py
. Currently generates this deprecation warning in our CIWe can replace
pkg_resources
with thepackaging
package and which I introduce in #3118 anyway andimportlib.metadata
. This is also the recommended way to do it in https://setuptools.pypa.io/en/latest/pkg_resources.html. I can look at this.