'ModuleNotFoundError: No module named 'jsonschema.compat'

I have been working with the Bybit API for the last week when I encountered the title problem yesterday. I have started a new env and installed only the bybit wrapper again and the issue still arises. From what I can see I have jsonschema installed and in my env PATH. It was working a few days ago, so I do believe this to be separate from whatever API I am trying to use. Included is a picture of the response when run in an interpreter. Any help would be greatly appreciated.

ModuleNotFoundError: No module named 'jsonschema.compat' is the error that comes up.

enter image description here



Solution 1:[1]

That module was removed in jsonschema 4.0. Your packages haven't been pinned to only use jsonschema 3.x, so that might happen.

For now, you can downgrade to version 3.x of the jsonschema package with

pip install -U 'jsonschema<4.0'

and things should work.

Solution 2:[2]

I have exactly the same problem! It was working before the release of 1.3, with the version 1.21 months a go. I found this problem to day after updateing my venv to the newest versions. Search a little more, it is a problem with the version of the jsonschema-4.0.1, go back to version 3.1.1 of jsonschema and all is running like befor, incl. the version 1.3 of bybit. Regards,

Solution 3:[3]

I was having the same issue too, but in my case the library which has the requirement of jsonschema was bitmex. I downgraded the package on my requirement.txt constraining the version:

jsonschema<4.0

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 AKX
Solution 2
Solution 3 José Fernando González Montero