sovrin-foundation / steward-tools

tools for Sovrin steward
Apache License 2.0
9 stars 22 forks source link

ModuleNotFoundError: No module named 'indy_common' #42

Closed edbkei closed 2 years ago

edbkei commented 2 years ago

I´ve tried to run: ubuntu@eduardoito-bionic:~/steward-tools/create_genesis$ ./genesis_from_files.py -h Traceback (most recent call last): File "./genesis_from_files.py", line 6, in from indy_common.txn_util import getTxnOrderedFields ModuleNotFoundError: No module named 'indy_common'

but, and I´ve tried to install indy_common using pip3: ubuntu@eduardoito-bionic:~/steward-tools/create_genesis$ pip3 install indy_common Collecting indy_common Could not find a version that satisfies the requirement indy_common (from versions: ) No matching distribution found for indy_common

How can I have indy_common? by googling, I´ve not found nothing.

WadeBarnes commented 2 years ago

indy_common.txn_util is part of indy-plenum

WadeBarnes commented 2 years ago

von-network provides a wrapper around this script that makes it easier to use; https://github.com/bcgov/von-network/blob/main/docs/Indy-CLI.md#generate-genesis-files

edbkei commented 2 years ago

thanks, by the way: pip3 install indy-plenum results unsuccessfully. ........ Collecting portalocker==0.5.7 (from indy-plenum) Downloading https://files.pythonhosted.org/packages/95/a7/45436b037b7c98ef7757c50d2b170c8cb0f978e6d2e4fc44bf64ca888a24/portalocker-0.5.7.tar.gz Complete output from command python setup.py egg_info: /home/ubuntu/.local/lib/python3.6/site-packages/setuptools/dist.py:726: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead % (opt, underscore_opt) error in portalocker setup command: use_2to3 is invalid.

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-8qhf2wws/portalocker/

but, I don´t know what is that.

WadeBarnes commented 2 years ago

What OS and version are you using, and what version of pip are you using?

edbkei commented 2 years ago

I´ve got ubuntu18 just for purpose of genesis file, but I´ve also ubuntu20.

ubuntu@eduardoito-bionic:~/von-network$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.6 LTS Release: 18.04 Codename: bionic ubuntu@eduardoito-bionic:~/von-network$ docker --version Docker version 20.10.7, build 20.10.7-0ubuntu5~18.04.3 ubuntu@eduardoito-bionic:~/von-network$ pip3 --version pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6) ubuntu@eduardoito-bionic:~/von-network$

Trying to generate genesis file, strange behaviour happens: root@eduardoito-bionic:/home/ubuntu/von-network# ./manage generategenesisfiles "./tmp/Trustees.csv" "./tmp/Stewards.csv"

Using: docker-compose --log-level ERROR

Downloading the latest version of genesis_from_files.py from https://raw.githubusercontent.com/sovrin-foundation/steward-tools/master/create_genesi s/genesis_from_files.py ... ./scripts/manage: line 154: cli-scripts/genesis_from_files.py: Permission denied

even root, permission denied appears.

WadeBarnes commented 2 years ago

I may need to adjust the scripts.

Two things to check: 1) Ensure the downloaded copy of genesis_from_files.py has Lf line endings. 2) Try setting genesis_from_files.py as executable to see if that makes a difference.

edbkei commented 2 years ago
  1. Ensure the downloaded copy of genesis_from_files.py has Lf line endings. ~/von-network/cli-scripts$ tail -c 1 genesis_from_files.py | od -x 0000000 000a 0000001

  2. Try setting genesis_from_files.py as executable to see if that makes a difference. ubuntu@eduardoito-bionic:~/von-network/cli-scripts$ chmod 777 genesis_from_files.py ubuntu@eduardoito-bionic:~/von-network/cli-scripts$ ls -la total 104 drwxrwxr-x 2 ubuntu ubuntu 4096 Apr 24 19:03 . drwxrwxr-x 13 ubuntu ubuntu 4096 Apr 24 23:20 .. -rw-rw-r-- 1 ubuntu ubuntu 286 Apr 21 13:28 README.md -rw-rw-r-- 1 ubuntu ubuntu 2193 Apr 24 19:03 Stewards.csv -rw-rw-r-- 1 ubuntu ubuntu 632 Apr 24 19:03 Trustees.csv -rw-rw-r-- 1 ubuntu ubuntu 852 Apr 21 13:28 attach-wallet -rw-rw-r-- 1 ubuntu ubuntu 12007 Apr 21 13:28 create-signed-cred-def -rw-rw-r-- 1 ubuntu ubuntu 4523 Apr 21 13:28 create-signed-schema -rw-rw-r-- 1 ubuntu ubuntu 1933 Apr 21 13:28 create-wallet -rw-rw-r-- 1 ubuntu ubuntu 11919 Apr 21 13:28 cred_def.py -rw-rw-r-- 1 ubuntu ubuntu 445 Apr 21 13:28 detach-wallet -rw-rw-r-- 1 ubuntu ubuntu 1692 Apr 21 13:28 did-list -rw-rw-r-- 1 ubuntu ubuntu 3365 Apr 21 13:28 endorse-transaction -rw-rw-r-- 1 ubuntu ubuntu 2034 Apr 21 13:28 export-wallet -rw-rw-r-- 1 ubuntu ubuntu 1139 Apr 21 13:28 generate_did.py -rwxrwxrwx 1 ubuntu ubuntu 4438 Apr 24 23:06 genesis_from_files.py -rw-rw-r-- 1 ubuntu ubuntu 2053 Apr 21 13:28 import-wallet -rw-rw-r-- 1 ubuntu ubuntu 2410 Apr 21 13:28 set_did_metadata.py -rw-rw-r-- 1 ubuntu ubuntu 2084 Apr 21 13:28 start-session -rw-rw-r-- 1 ubuntu ubuntu 1673 Apr 21 13:28 write-transaction ubuntu@eduardoito-bionic:~/von-network/cli-scripts$ ./genesis_from_files.py Trustees.csv Stewards.csv Traceback (most recent call last): File "./genesis_from_files.py", line 6, in from indy_common.txn_util import getTxnOrderedFields ModuleNotFoundError: No module named 'indy_common' ubuntu@eduardoito-bionic:~/von-network/cli-scripts$

CONCLUSION: It drops in the same issue of installation of indy-plenum. https://github.com/hyperledger/indy-sdk/issues/2476

WadeBarnes commented 2 years ago

Now try running it again through von-network.

edbkei commented 2 years ago

PermissionError: [Errno 13] Permission denied: '/tmp/pool_transactions_genesis', with and without root. FYI, Trustees.csv and Stewards.csv are exactly the same giving in the example.

For completeness, here is the print:

./manage generategenesisfiles "./tmp/Trustees.csv" "./tmp/Stewards.csv"

Using: docker-compose --log-level ERROR

Downloading the latest version of genesis_from_files.py from https://raw.githubusercontent.com/sovrin-foundation/steward-tools/master/create_genesis/genesis_from_files.py ... Traceback (most recent call last): File "cli-scripts/genesis_from_files.py", line 106, in make_pool_genesis(args.pool, node_defs) File "cli-scripts/genesis_from_files.py", line 56, in make_pool_genesis pool_ledger = open_ledger(pool_pathname) File "cli-scripts/genesis_from_files.py", line 50, in open_ledger ledger = create_genesis_txn_init_ledger(baseDir, txnFile) File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/ledger/genesis_txn/genesis_txn_file_util.py", line 17, in create_genesis_txn_init_ledger return initiator.create_initiator_ledger() File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/ledger/genesis_txn/genesis_txn_initiator_from_file.py", line 45, in create_initiator_ledger ensureDurability=False) File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/storage/text_file_store.py", line 24, in init open=open) File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/storage/kv_store_single_file.py", line 25, in init open=open) File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/storage/kv_store_file.py", line 39, in init self.open() File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/storage/kv_store_file.py", line 59, in open self._initDB(self._db_dir, self._db_name) File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/storage/kv_store_file.py", line 45, in _initDB self.db_file = self._init_db_file() File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/storage/text_file_store.py", line 34, in _init_db_file return open(self.db_path, mode="a+") PermissionError: [Errno 13] Permission denied: '/tmp/pool_transactions_genesis'

WadeBarnes commented 2 years ago

The issue is the permissions of the directories in your working copy of von-network at this point, specifically the tmp folder. The user account in the docker container does not have permissions to write to that directory. You need to set the permission on the tmp directory such that the user account in the docker container can write to it.

edbkei commented 2 years ago

You´re right. It worked. Thanks.

./manage generategenesisfiles "./tmp/Trustees.csv" "./tmp/Stewards.csv"

Using: docker-compose --log-level ERROR

Downloading the latest version of genesis_from_files.py from https://raw.githubusercontent.com/sovrin-foundation/steward-tools/master/create_genesis/genesis_from_files.py ... 2022-04-27 22:51:42,911|DEBUG|text_file_store.py|new line check for file: /tmp/pool_transactions_genesis 2022-04-27 22:51:42,911|INFO|ledger.py|Starting ledger... 2022-04-27 22:51:42,912|INFO|ledger.py|Recovering tree from transaction log 2022-04-27 22:51:42,912|INFO|ledger.py|Recovered tree in 0.0003153560101054609 seconds 2022-04-27 22:51:42,916|DEBUG|text_file_store.py|new line check for file: /tmp/domain_transactions_genesis 2022-04-27 22:51:42,916|INFO|ledger.py|Starting ledger... 2022-04-27 22:51:42,916|INFO|ledger.py|Recovering tree from transaction log 2022-04-27 22:51:42,916|INFO|ledger.py|Recovered tree in 0.0002287020324729383 seconds ls -la ... drwxrwxr-x 2 root root 4096 Apr 27 22:51 tmp ubuntu@eduardoito-bionic:~/von-network$ cd tmp ubuntu@eduardoito-bionic:~/von-network/tmp$ ls -la total 24 drwxrwxr-x 2 root root 4096 Apr 27 22:51 . drwxrwxr-x 13 ubuntu ubuntu 4096 Apr 24 23:20 .. -rw-rw-r-- 1 ubuntu ubuntu 2193 Apr 24 13:50 Stewards.csv -rw-rw-r-- 1 ubuntu ubuntu 632 Apr 24 13:50 Trustees.csv -rw-r--r-- 1 1001 1001 2539 Apr 27 22:51 domain_transactions_genesis -rw-r--r-- 1 1001 1001 3145 Apr 27 22:51 pool_transactions_genesis