aries-cloudagent-python
aries-cloudagent-python copied to clipboard
Regression: Error if anoncreds extra is not installed
I happened to discover that not installing the anoncreds extra causes a failure on startup of ACA-Py:
holder_1 | Traceback (most recent call last):
holder_1 | File "/usr/src/app/.venv/bin/aca-py", line 8, in <module>
holder_1 | sys.exit(script_main())
holder_1 | File "/usr/src/app/.venv/lib/python3.10/site-packages/aries_cloudagent/__main__.py", line 69, in script_main
holder_1 | main(sys.argv)
holder_1 | File "/usr/src/app/.venv/lib/python3.10/site-packages/aries_cloudagent/__main__.py", line 75, in main
holder_1 | run(args)
holder_1 | File "/usr/src/app/.venv/lib/python3.10/site-packages/aries_cloudagent/__main__.py", line 64, in run
holder_1 | run_command(command, args)
holder_1 | File "/usr/src/app/.venv/lib/python3.10/site-packages/aries_cloudagent/commands/__init__.py", line 37, in run_command
holder_1 | module = load_command(command) or load_command("help")
holder_1 | File "/usr/src/app/.venv/lib/python3.10/site-packages/aries_cloudagent/commands/__init__.py", line 32, in load_command
holder_1 | return import_module(module_path)
holder_1 | File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
holder_1 | return _bootstrap._gcd_import(name[level:], package, level)
holder_1 | File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
holder_1 | File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
holder_1 | File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
holder_1 | File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
holder_1 | File "<frozen importlib._bootstrap_external>", line 883, in exec_module
holder_1 | File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
holder_1 | File "/usr/src/app/.venv/lib/python3.10/site-packages/aries_cloudagent/commands/start.py", line 16, in <module>
holder_1 | from ..core.conductor import Conductor
holder_1 | File "/usr/src/app/.venv/lib/python3.10/site-packages/aries_cloudagent/core/conductor.py", line 20, in <module>
holder_1 | from ..admin.server import AdminResponder, AdminServer
holder_1 | File "/usr/src/app/.venv/lib/python3.10/site-packages/aries_cloudagent/admin/server.py", line 39, in <module>
holder_1 | from ..wallet.anoncreds_upgrade import check_upgrade_completion_loop
holder_1 | File "/usr/src/app/.venv/lib/python3.10/site-packages/aries_cloudagent/wallet/anoncreds_upgrade.py", line 8, in <module>
holder_1 | from anoncreds import (
holder_1 | ModuleNotFoundError: No module named 'anoncreds'
@jamshale This looks related to the upgrade endpoints -- I think we need to have a conditional import to ensure we can use ACA-Py without the anoncreds extra installed
Ok. Hopefully a simple fix. I was a bit unsure what we were doing with extras in general. But it makes sense it wouldn't be required.
So, I agree that maybe we shouldn't require anoncreds to be installed. But, I don't think this is an issue with the anoncreds upgrade endpoint in particular. I've checked out tag 0.12.0 and several other commits from the beginning of the anoncreds implementation and the agent will still fail without anoncreds installed.
So i think this is more a feature than a regression. Or, it was a regression a long time ago. Currently anoncreds needs to be installed from 0.12.0. However, anoncreds modules are more ingrained now then it was in the past. Hence, where the error is happening now.
So should we move the library from being an extra to being a strict dependency? Or maybe I misunderstood what you mean
So should we move the library from being an extra to being a strict dependency? Or maybe I misunderstood what you mean
I think that's a good idea.
I don't really think it's going to make sense to check if it's installed in many different places. With more places getting added as we transition towards anoncreds being the preferred method. I added a few places that would need to be checked and I think there would likely be others I don't know about.
I'm not certain what to do about this. anoncreds was always installed if the askar extra was installed. See https://github.com/hyperledger/aries-cloudagent-python/blob/main/pyproject.toml#L84
It will fail if you install extras without specifying askar or anoncreds. Is there a case where you wouldn't install the askar extra? Is it supposed to work in this case?
Closing. If this comes up again we can re-open.
/.local/lib/python3.10/site-packages/aries_cloudagent/anoncreds/models/anoncreds_cred_def.py", line 5, in <module>
from anoncreds import CredentialDefinition
ModuleNotFoundError: No module named 'anoncreds'
Facing this error when trying to check aca-py -v after pip install aries-cloudagent
Just install anoncreds. It's a required extra. It should be included in the lastest version by default.
Just install anoncreds. It's a required extra. It should be included in the lastest version by default.
Just a heads up, apart from anoncreds, I also had to install other packages. So the missing packages were,
anoncredsaries_askarindy_credxindy_vdr
PS: for anyone wondering/facing this issue simply install the above mentioned packages individually by,
pip install package-name