singularity-compose
singularity-compose copied to clipboard
ModuleNotFoundError: No module named 'jsonschema'
I installed singularity-compose using pip install --user -U singularity-compose.
When running singularity-compose check, I get:
$ singularity-compose check
Traceback (most recent call last):
File "/home/guest/sischr001/.local/bin/singularity-compose", line 8, in <module>
sys.exit(start())
File "/home/guest/sischr001/.local/lib/python3.8/site-packages/scompose/client/__init__.py", line 252, in start
from scompose.client.check import main
File "/home/guest/sischr001/.local/lib/python3.8/site-packages/scompose/client/check.py", line 13, in <module>
from scompose.config.schema import validate_config
File "/home/guest/sischr001/.local/lib/python3.8/site-packages/scompose/config/schema.py", line 14, in <module>
from jsonschema.exceptions import ValidationError
ModuleNotFoundError: No module named 'jsonschema'
After pip install --user -U jsonschema, it works:
$ singularity-compose check
singularity-compose.yml is valid.
It seems that jsonschema should be included in INSTALL_REQUIRES (/scompose/version.py).
@moi90 this was intended to be an optional command you install with:
pip install singularity-compose[check]
We have a few options here:
- Add this better to the documentation
- Make jsonschema globally required
Are you suggesting the latter as the best approach? The only command that needs to import this file is the one you ran so I'm hesitant to do the latter but definitely we can chat about it.
Here are my proposed fixes:
- Add install instructions to main page https://github.com/singularityhub/singularity-compose/blob/813ac6d8791c5e8cfce51bbbd35b97ecc0fb3971/docs/README.md#install
- Ensure checks command docs includes note! https://github.com/singularityhub/singularity-compose/blob/813ac6d8791c5e8cfce51bbbd35b97ecc0fb3971/docs/commands.md#check
Hmm, if you don't want to make it a global requirement (Why not? It isn't large, I assume), I would catch the ModuleNotFoundError and instruct the user to install it manually. But I still find it weird to provide a command that can not be executed without additional steps...
That’s exactly what would have happened if there wasn’t a stray input put before that.