Page MenuHomeSoftware Heritage

swh identify with type=snapshot shows dependency not installed error
Closed, MigratedEdits Locked

Description

Running swh-identify with snapshot as the type says "dulwich" module not installed. I tested other types(directory, content, origin, auto) and they work fine.

swh identify --type snapshot {name}.git/

Either the dependency is false or the dependencies do not get installed with swh.model .

Error-

Traceback (most recent call last):
  File "/home/hrishi/.local/bin/swh", line 8, in <module>
    sys.exit(main())
  File "/home/hrishi/.local/lib/python3.8/site-packages/swh/core/cli/__init__.py", line 185, in main
    return swh(auto_envvar_prefix="SWH")
  File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/hrishi/.local/lib/python3.8/site-packages/swh/model/cli.py", line 266, in identify
    for (obj, swhid) in results:
  File "/home/hrishi/.local/lib/python3.8/site-packages/swh/model/cli.py", line 164, in identify_object
    swhid = str(swhid_of_git_repo(obj))
  File "/home/hrishi/.local/lib/python3.8/site-packages/swh/model/cli.py", line 99, in swhid_of_git_repo
    import dulwich.repo
ModuleNotFoundError: No module named 'dulwich'

Event Timeline

vlorentz triaged this task as Normal priority.Apr 8 2021, 6:43 PM

You should install swh.model[cli] instead of swh.model. I added a better error message in D5466 so it's clearer.

And I'm also updating the documentation at https://docs.softwareheritage.org/devel/swh-model/persistent-identifiers.html#computing

(I assume this is the doc you followed to install swh-model)

Okay.

You should install swh.model[cli] instead of swh.model. I added a better error message in D5466 so it's clearer.

Yes, I followed the same doc.

And I'm also updating the documentation at https://docs.softwareheritage.org/devel/swh-model/persistent-identifiers.html#computing

(I assume this is the doc you followed to install swh-model)