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
schemaerror alt.HConcatChart(...) #2767
Comments
Please include a reproducible example which includes sample data so that someone can try it out on their machine. |
|
i did now. anyway, the problem is not about data. in another machine i can run it. i do not know why. the versions of python and pandas and altair are the same. |
I cannot reproduce the error with your example and the versions Python 3.8.10, altair 4.2, jsonschema 4.16. What version of Pandas are you using? Could you try reinstalling the packages or recreating the virtual environment in case you are using one? |
both pandas 1.5.1, 1.5.2. |
Thanks @ghasempouri1984! Could you please run the following code blocks in order and post all outputs? This one should still produce the error: import altair as alt
import pandas as pd
import jsonschema
from pprint import pprint
data2 = pd.read_csv("WHR_2016.csv")
healthPlot = alt.Chart(data2).mark_circle().encode(
x = "Health (Life Expectancy)",
y = "Happiness Score",
color = alt.Color("Region", scale = alt.Scale(scheme="spectral")),
tooltip = ("Country", "Happiness Score")
)
generosityPlot = alt.Chart(data2).mark_circle().encode(
x = "Generosity",
y = "Happiness Score",
color = alt.Color("Region", scale = alt.Scale(scheme="spectral")),
tooltip = ("Country", "Happiness Score")
)
final_chart = (generosityPlot | healthPlot)
final_chart And now the following lines individually: final_chart._rootschema final_chart._schema alt.__version__ jsonschema.__version__ pprint(final_chart.to_dict(validate=False)) |
Thanks for your reply @binste SchemaError: '#/definitions/TopLevelNormalizedHConcatSpec' is not a 'uri-reference' Failed validating 'format' in metaschema['properties']['$ref']: On schema['$ref']:
|
Thank you! This is very likely the same issue as #2705. You should be able to resolve it by downgrading jsonschema to before 4.17, e.g. |
I tested before with 4.16 and also 4.3.3. The same error. |
Just want to be fully sure that this is the case and there is nothing else going on. After downgrading, what is the output of |
@binste thanks for your quick reply. |
Hello,
When I try to plot side-by-side graphs with alt.concat I get schemaerror message. Would you please help me to resolve the issue?
Python 3.8.10
altair 4.2
jsonschema 4.16
SchemaError Traceback (most recent call last)
File path to venv\lib\site-packages\altair\vegalite\v4\api.py:384, in TopLevelMixin.to_dict(self, *args, **kwargs)
381 kwargs["context"] = context
383 try:
--> 384 dct = super(TopLevelMixin, copy).to_dict(*args, **kwargs)
385 except jsonschema.ValidationError:
386 dct = None
File pathto venv\lib\site-packages\altair\utils\schemapi.py:338, in SchemaBase.to_dict(self, validate, ignore, context)
336 if validate:
337 try:
--> 338 self.validate(result)
339 except jsonschema.ValidationError as err:
340 raise SchemaValidationError(self, err)
File path to venv\lib\site-packages\altair\utils\schemapi.py:443, in SchemaBase.validate(cls, instance, schema)
441 schema = cls._schema
442 resolver = jsonschema.RefResolver.from_schema(cls._rootschema or cls._schema)
--> 443 return jsonschema.validate(
444 instance, schema, cls=cls._validator, resolver=resolver
445 )
File path to venv\lib\site-packages\jsonschema\validators.py:1117, in validate(instance, schema, cls, *args, **kwargs)
1114 if cls is None:
1115 cls = validator_for(schema)
-> 1117 cls.check_schema(schema)
1118 validator = cls(schema, *args, **kwargs)
1119 error = exceptions.best_match(validator.iter_errors(instance))
File path to venv\lib\site-packages\jsonschema\validators.py:231, in create..Validator.check_schema(cls, schema, format_checker)
226 validator = Validator(
227 schema=cls.META_SCHEMA,
228 format_checker=format_checker,
229 )
230 for error in validator.iter_errors(schema):
--> 231 raise exceptions.SchemaError.create_from(error)
SchemaError: '#/definitions/TopLevelNormalizedHConcatSpec' is not a 'uri-reference'
Failed validating 'format' in metaschema['properties']['$ref']:
{'format': 'uri-reference', 'type': 'string'}
On schema['$ref']:
'#/definitions/TopLevelNormalizedHConcatSpec'
The text was updated successfully, but these errors were encountered: