singularity-compose icon indicating copy to clipboard operation
singularity-compose copied to clipboard

ModuleNotFoundError: No module named 'jsonschema'

Open moi90 opened this issue 3 years ago • 4 comments

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 avatar Dec 09 '22 11:12 moi90

@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.

vsoch avatar Dec 09 '22 13:12 vsoch

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

vsoch avatar Dec 09 '22 13:12 vsoch

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...

moi90 avatar Dec 12 '22 11:12 moi90

That’s exactly what would have happened if there wasn’t a stray input put before that.

vsoch avatar Dec 12 '22 12:12 vsoch