Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 676
Bjorgum Avatar asked Oct 03 '21 16:10

Bjorgum


People also ask

Why am I getting JSONSchema module not found error?

ModuleNotFoundError: No module named 'jsonschema.compat' is the error that comes up. 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 and things should work. I have exactly the same problem!

What is in included and modulenotfounderror?

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. That module was removed in jsonschema 4.0. Your packages haven't been pinned to only use jsonschema 3.x, so that might happen.

How do I install JSONSchema in Python?

You can install using pip: If you have tox installed (perhaps via pip install tox or your package manager), running tox in the directory of your source checkout will run jsonschema ’s test suite on all of the versions of Python jsonschema supports.

Why am I getting a module name error when importing it?

The first reason of this error is the name of the module is incorrect, so you have to check out the module name that you had imported. For example, let's try to import os module with double s and see what will happen:


2 Answers

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.

like image 115
AKX Avatar answered Oct 31 '22 14:10

AKX


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,

like image 25
Georges Grey Avatar answered Oct 31 '22 13:10

Georges Grey