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

Jsonschema >4.18.6 incompatibility #2840

Closed
alxsimon opened this issue Sep 21, 2023 · 1 comment · Fixed by #2844
Closed

Jsonschema >4.18.6 incompatibility #2840

alxsimon opened this issue Sep 21, 2023 · 1 comment · Fixed by #2844
Labels
bug Something isn't working
Milestone

Comments

@alxsimon
Copy link
Contributor

I've stumbled on what seems to be a version incompatibility with jsonschema.

Got this error trying to import pyslim in an environment but it seems the import issue is originally in tskit.
This issue seems to be from this change in jsonschema https://github.com/python-jsonschema/jsonschema/blob/main/CHANGELOG.rst#v4190, so reverting to v4.18.6 works.

>>> import pyslim
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/acpsimon/admixcov_sims/.snakemake/conda/046359eddbbe74905c024f6d72f2fc3c_/lib/python3.10/
site-packages/pyslim/__init__.py", line 4, in <module>
    from pyslim.slim_metadata import *       # NOQA
  File "/home/acpsimon/admixcov_sims/.snakemake/conda/046359eddbbe74905c024f6d72f2fc3c_/lib/python3.10/
site-packages/pyslim/slim_metadata.py", line 438, in <module>
    slim_metadata_schemas = {k: tskit.MetadataSchema(_raw_slim_metadata_schemas[k]) for k in _raw_slim_
metadata_schemas}
  File "/home/acpsimon/admixcov_sims/.snakemake/conda/046359eddbbe74905c024f6d72f2fc3c_/lib/python3.10/
site-packages/pyslim/slim_metadata.py", line 438, in <dictcomp>
    slim_metadata_schemas = {k: tskit.MetadataSchema(_raw_slim_metadata_schemas[k]) for k in _raw_slim_
metadata_schemas}
  File "/home/acpsimon/admixcov_sims/.snakemake/conda/046359eddbbe74905c024f6d72f2fc3c_/lib/python3.10/
site-packages/tskit/metadata.py", line 639, in __init__
    codec_instance = codec_cls(schema)
  File "/home/acpsimon/admixcov_sims/.snakemake/conda/046359eddbbe74905c024f6d72f2fc3c_/lib/python3.10/
site-packages/tskit/metadata.py", line 580, in __init__
    StructCodecSchemaValidator.check_schema(schema)
  File "/home/acpsimon/admixcov_sims/.snakemake/conda/046359eddbbe74905c024f6d72f2fc3c_/lib/python3.10/
site-packages/jsonschema/validators.py", line 301, in check_schema
    for error in validator.iter_errors(schema):
  File "/home/acpsimon/admixcov_sims/.snakemake/conda/046359eddbbe74905c024f6d72f2fc3c_/lib/python3.10/
site-packages/jsonschema/validators.py", line 368, in iter_errors
    for error in errors:
  File "/home/acpsimon/admixcov_sims/.snakemake/conda/046359eddbbe74905c024f6d72f2fc3c_/lib/python3.10/
site-packages/tskit/metadata.py", line 196, in binary_format_validator
    yield from jsonschema._validators.type(validator, types, instance, schema)
  File "/home/acpsimon/admixcov_sims/.snakemake/conda/046359eddbbe74905c024f6d72f2fc3c_/lib/python3.10/
site-packages/jsonschema/__init__.py", line 105, in __getattr__
    raise AttributeError(f"module {__name__} has no attribute {name}")
AttributeError: module jsonschema has no attribute _validators. Did you mean: 'validators'?
@benjeffery
Copy link
Member

tskit 0.5.6 is now released which is compatible with both jsonschema versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants