The following basic code throws the error in vscode.
import pandas as pd
import altair as alt
alt.renderers.enable("altair_viewer")
food_cost_df = pd.read_csv("data_annotation/data_analyses/data/2DEY_kitchen_costs.csv")
print(food_cost_df)
chart = alt.Chart(food_cost_df, height= 500, width=500).mark_bar().encode(
alt.X("ITEM"),
alt.Y("COST"))
chart.show()
The conda env, named 'data_ann_env', was built and maintained locally in the vscode project folder and is activated in both the terminal and via the vscode Selected Interpreter. Python version 3.11.7, conda version 23.10.0, altair family (obtained from the conda list):
What conflict am I running into here or ...?
import urllib.request, json
with urllib.request.urlopen("https://pypi.org/pypi/altair_viewer/json") as url:
print(json.loads(url.read().decode())['info']['version'])
with urllib.request.urlopen("https://pypi.org/pypi/altair/json") as url:
print(json.loads(url.read().decode())['info']['version'])
which pointed out I could update to altair 5.4.0. which I did and still the error persists.
I tested a few things:
altair_viewer is only compatible with altair 4. If you are using it for offline charts, this functionality is in vl-convert. If you are using it to show charts from a terminal, you can follow this issue https://github.com/altair-viz/altair/issues/2866. If there is another use case, let us know by opening a new issue