AttributeError: module 'pip' has no attribute 'get_installed_distributions'
I am trying to build from the von-network source code. Image used: bcgovimages/von-image:node-1.12-6
My Environment:
Windows 10 Docker Desktop with WSL2 enabled git-bash local python 3.10
Snippets of logs that are generated after running the command: ./manage start --logs
webserver_1 |
webserver_1 | Traceback (most recent call last):
webserver_1 | File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/runpy.py", line 193, in _run_module_as_main
webserver_1 | "main", mod_spec)
webserver_1 | File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/runpy.py", line 85, in _run_code
webserver_1 | exec(code, run_globals)
webserver_1 | File "/home/indy/server/server.py", line 14, in
Note: I checked the 'plenum' code in its repository, it doesn't have the pip related instructions at line 60: installed_packages = set(p.metadata["Name"] for p in importlib_metadata.distributions())
Please look into this.
Thanks
Running
./manage build
./manage start --logs
Builds and starts von-network for me. Try running a ./manage rebuild.
Trying now. Here are the logs: build is success. However, ./manage start --logs again failing. Please take a look at the content of modified Dockerfile as well. The modification is done to support addition of organisation certificate in the docker image.
$ ./manage rebuild
Using: docker-compose --log-level ERROR
#1 [internal] load build definition from Dockerfile #1 sha256:c26273efa1b403db4e3edfcf24bf6201d56647479d16e8fdb13b5b29e3cd7187 #1 transferring dockerfile: 32B 0.0s done #1 DONE 0.0s
#2 [internal] load .dockerignore #2 sha256:a028e604ef5bf59917abb1ac4ab93932ff59dc3f94a12e377d8f4739b3d1b159 #2 transferring context: 34B 0.0s done #2 DONE 0.0s
#3 [internal] load metadata for docker.io/bcgovimages/von-image:node-1.12-6 #3 sha256:04e959e37fe95cdcaee69c012906393c2368e764f88c9068e7fdadf4aa9d14b4 #3 DONE 6.5s
#4 [ 1/10] FROM docker.io/bcgovimages/von-image:node-1.12-6@sha256:55f1d0ed54f1a79a2e041c5a32d9555f037d0eeb28654a33ea99153c36aa05be #4 sha256:f8211455aca006f5cc2d4f3ef44b2849f3858f221e14ac075b9c0b2ad4d16041 #4 CACHED
#5 [internal] load build context #5 sha256:1550067c1ec72534010165d66a8886a04563e6a01547ae6fc857430d7df40f04 #5 transferring context: 2.66kB 0.0s done #5 DONE 0.0s
#6 [ 2/10] ADD config ./config #6 sha256:5e933543a88d758540ef33b360c3c8d39acd6c29a39d496bf08ea69429e3f634 #6 DONE 0.0s
#7 [ 3/10] ADD server/requirements.txt server/ #7 sha256:dad58ce8dc570a8f7bb82ad8216c165adfce530434fe14a251ff567f6da90ffd #7 DONE 0.0s
#8 [ 4/10] RUN mkdir -p "/etc/docker/certs.d/registry-1.docker.io:443" "/usr/local/share/ca-certificates/" && cd /etc/docker/certs.d/registry-1.docker.io:443 && curl -k "http://192.168.0.58:8888/svn/certs/NetskoperootcaCert.crt" -o "NetskoperootcaCert.crt" && curl -k "http://192.168.0.58:8888/svn/certs/NetskopecaCert.crt" -o "NetskopecaCert.crt" && curl -k "http://192.168.0.58:8888/svn/certs/NetskopeRemoteRoot.crt" -o "NetskopeRemoteRoot.crt" && curl -k "http://192.168.0.58:8888/svn/certs/hsc-com-chain.crt" -o "hsc-com-chain.crt" && chmod 644 NetskopecaCert.crt NetskoperootcaCert.crt hsc-com-chain.crt NetskopeRemoteRoot.crt && cp -r NetskopecaCert.crt NetskoperootcaCert.crt hsc-com-chain.crt NetskopeRemoteRoot.crt /usr/local/share/ca-certificates/ && cp -r NetskopecaCert.crt NetskoperootcaCert.crt hsc-com-chain.crt NetskopeRemoteRoot.crt /etc/ssl/certs/ && update-ca-certificates --fresh #8 sha256:1dffbd93dbb9cd4599173dfa617a48b62c4519fe90f29b1066dd1f215186998d #8 0.340 % Total % Received % Xferd Average Speed Time Time Time Current #8 0.340 Dload Upload Total Spent Left Speed 100 1623 100 1623 0 0 2972 0 --:--:-- --:--:-- --:--:-- 2967 #8 0.898 % Total % Received % Xferd Average Speed Time Time Time Current #8 0.898 Dload Upload Total Spent Left Speed 100 1704 100 1704 0 0 21846 0 --:--:-- --:--:-- --:--:-- 21846 #8 0.986 % Total % Received % Xferd Average Speed Time Time Time Current #8 0.986 Dload Upload Total Spent Left Speed 100 1508 100 1508 0 0 25133 0 --:--:-- --:--:-- --:--:-- 25133 #8 1.054 % Total % Received % Xferd Average Speed Time Time Time Current #8 1.054 Dload Upload Total Spent Left Speed 100 5406 100 5406 0 0 88622 0 --:--:-- --:--:-- --:--:-- 88622 #8 1.129 Clearing symlinks in /etc/ssl/certs... #8 1.491 done. #8 1.491 Updating certificates in /etc/ssl/certs... #8 2.001 rehash: warning: skipping ca-certificates.crt,it does not contain exactly one certificate or CRL #8 2.004 rehash: warning: skipping hsc-com-chain.crt,it does not contain exactly one certificate or CRL #8 2.004 rehash: warning: skipping duplicate certificate in NetskopecaCert.crt #8 2.004 rehash: warning: skipping hsc-com-chain.pem,it does not contain exactly one certificate or CRL #8 2.004 rehash: warning: skipping duplicate certificate in NetskoperootcaCert.pem #8 2.004 rehash: warning: skipping duplicate certificate in NetskopeRemoteRoot.crt #8 2.010 131 added, 0 removed; done. #8 2.010 Running hooks in /etc/ca-certificates/update.d... #8 2.012 done. #8 DONE 2.0s
#9 [ 5/10] RUN export REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt && export NODE_EXTRA_CA_CERTS=/etc/ssl/certs/ca-certificates.crt #9 sha256:fb72472074879104b603bdc6390aa7d25610a790666f1b440853860344b63b6f #9 DONE 0.5s
#10 [ 6/10] RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org --no-cache-dir -r server/requirements.txt #10 sha256:50f8e812023b62a45b3317413ac2fa2e53a4b9116831b406a6b4e6f2b3807dba #10 1.226 Collecting pyyaml~=5.1.1 (from -r server/requirements.txt (line 1)) #10 2.225 Downloading https://files.pythonhosted.org/packages/e3/e8/b3212641ee2718d556df0f23f78de8303f068fe29cdaa7a91018849582fe/PyYAML-5.1.2.tar.gz (265kB) #10 2.808 Requirement already satisfied: aiodns~=2.0.0 in ./.pyenv/versions/3.6.13/lib/python3.6/site-packages (from -r server/requirements.txt (line 2)) #10 2.813 Collecting aiohttp~=3.5.0 (from -r server/requirements.txt (line 3)) #10 3.721 Downloading https://files.pythonhosted.org/packages/0d/5c/f87987f4dc8b2cfcf37c83a814ea4b2aff4d285cbffc0ab08b2b4fa3f584/aiohttp-3.5.4-cp36-cp36m-manylinux1_x86_64.whl (1.2MB) #10 3.964 Collecting aiohttp-jinja2~=1.1.2 (from -r server/requirements.txt (line 4)) #10 4.687 Downloading https://files.pythonhosted.org/packages/6d/c6/c70126523a3ac1b00b241bd82b814d815da6af27451ea43bf9e4849acaf6/aiohttp_jinja2-1.1.2-py3-none-any.whl #10 4.741 Collecting aiosqlite~=0.10.0 (from -r server/requirements.txt (line 5)) #10 5.215 Downloading https://files.pythonhosted.org/packages/74/bb/f5796f90ba82e788339449eb239dbb875ac072f6842f4429bcb76b877bc9/aiosqlite-0.10.0.tar.gz #10 5.478 Requirement already satisfied: base58~=1.0.0 in ./.pyenv/versions/3.6.13/lib/python3.6/site-packages (from -r server/requirements.txt (line 6)) #10 5.480 Requirement already satisfied: cchardet~=2.1.0 in ./.pyenv/versions/3.6.13/lib/python3.6/site-packages (from -r server/requirements.txt (line 7)) #10 5.484 Requirement already satisfied: rlp~=0.6.0 in ./.pyenv/versions/3.6.13/lib/python3.6/site-packages (from -r server/requirements.txt (line 8)) #10 5.516 Collecting supervisor~=4.0.4 (from -r server/requirements.txt (line 9)) #10 5.843 Downloading https://files.pythonhosted.org/packages/a5/27/03ee384818f4fc5f678743bb20ac49c5b4fc9f531bd404dec4b61a8b5d42/supervisor-4.0.4-py2.py3-none-any.whl (296kB) #10 5.949 Requirement already satisfied: pycares>=3.0.0 in ./.pyenv/versions/3.6.13/lib/python3.6/site-packages (from aiodns~=2.0.0->-r server/requirements.txt (line 2)) #10 5.961 Requirement already satisfied: typing; python_version < "3.7" in ./.pyenv/versions/3.6.13/lib/python3.6/site-packages (from aiodns~=2.0.0->-r server/requirements.txt (line 2)) #10 5.963 Requirement already satisfied: typing-extensions>=3.6.5; python_version < "3.7" in ./.pyenv/versions/3.6.13/lib/python3.6/site-packages (from aiohttp~=3.5.0->-r server/requirements.txt (line 3)) #10 5.965 Requirement already satisfied: idna-ssl>=1.0; python_version < "3.7" in ./.pyenv/versions/3.6.13/lib/python3.6/site-packages (from aiohttp~=3.5.0->-r server/requirements.txt (line 3)) #10 5.968 Requirement already satisfied: chardet<4.0,>=2.0 in ./.pyenv/versions/3.6.13/lib/python3.6/site-packages (from aiohttp~=3.5.0->-r server/requirements.txt (line 3)) #10 5.970 Requirement already satisfied: yarl<2.0,>=1.0 in ./.pyenv/versions/3.6.13/lib/python3.6/site-packages (from aiohttp~=3.5.0->-r server/requirements.txt (line 3)) #10 5.977 Requirement already satisfied: attrs>=17.3.0 in ./.pyenv/versions/3.6.13/lib/python3.6/site-packages (from aiohttp~=3.5.0->-r server/requirements.txt (line 3)) #10 6.008 Requirement already satisfied: multidict<5.0,>=4.0 in ./.pyenv/versions/3.6.13/lib/python3.6/site-packages (from aiohttp~=3.5.0->-r server/requirements.txt (line 3)) #10 6.011 Requirement already satisfied: async-timeout<4.0,>=3.0 in ./.pyenv/versions/3.6.13/lib/python3.6/site-packages (from aiohttp~=3.5.0->-r server/requirements.txt (line 3)) #10 6.038 Collecting jinja2>=2.10.1 (from aiohttp-jinja2~=1.1.2->-r server/requirements.txt (line 4)) #10 6.255 Downloading https://files.pythonhosted.org/packages/20/9a/e5d9ec41927401e41aea8af6d16e78b5e612bca4699d417f646a9610a076/Jinja2-3.0.3-py3-none-any.whl (133kB) #10 6.362 Collecting meld3>=1.0.0 (from supervisor~=4.0.4->-r server/requirements.txt (line 9)) #10 6.487 Downloading https://files.pythonhosted.org/packages/d8/5b/65a655a1090d98c8d604ac9e97d5df3a2ae276f881d4e2911ba38800f2ed/meld3-2.0.1-py2.py3-none-any.whl #10 6.522 Requirement already satisfied: cffi>=1.5.0 in ./.pyenv/versions/3.6.13/lib/python3.6/site-packages (from pycares>=3.0.0->aiodns~=2.0.0->-r server/requirements.txt (line 2)) #10 6.533 Requirement already satisfied: idna>=2.0 in ./.pyenv/versions/3.6.13/lib/python3.6/site-packages (from idna-ssl>=1.0; python_version < "3.7"->aiohttp~=3.5.0->-r server/requirements.txt (line 3)) #10 6.559 Collecting MarkupSafe>=2.0 (from jinja2>=2.10.1->aiohttp-jinja2~=1.1.2->-r server/requirements.txt (line 4)) #10 6.980 Downloading https://files.pythonhosted.org/packages/fc/d6/57f9a97e56447a1e340f8574836d3b636e2c14de304943836bd645fa9c7e/MarkupSafe-2.0.1-cp36-cp36m-manylinux1_x86_64.whl #10 7.017 Requirement already satisfied: pycparser in ./.pyenv/versions/3.6.13/lib/python3.6/site-packages (from cffi>=1.5.0->pycares>=3.0.0->aiodns~=2.0.0->-r server/requirements.txt (line 2)) #10 7.018 Installing collected packages: pyyaml, aiohttp, MarkupSafe, jinja2, aiohttp-jinja2, aiosqlite, meld3, supervisor #10 7.019 Running setup.py install for pyyaml: started #10 7.337 Running setup.py install for pyyaml: finished with status 'done' #10 7.356 Found existing installation: aiohttp 3.6.3 #10 7.376 Uninstalling aiohttp-3.6.3: #10 7.611 Successfully uninstalled aiohttp-3.6.3 #10 7.809 Found existing installation: aiosqlite 0.13.0 #10 7.816 Uninstalling aiosqlite-0.13.0: #10 7.859 Successfully uninstalled aiosqlite-0.13.0 #10 7.859 Running setup.py install for aiosqlite: started #10 8.091 Running setup.py install for aiosqlite: finished with status 'done' #10 8.493 Successfully installed MarkupSafe-2.0.1 aiohttp-3.5.4 aiohttp-jinja2-1.1.2 aiosqlite-0.10.0 jinja2-3.0.3 meld3-2.0.1 pyyaml-5.1.2 supervisor-4.0.4 #10 8.687 You are using pip version 9.0.3, however version 22.3 is available. #10 8.687 You should consider upgrading via the 'pip install --upgrade pip' command. #10 DONE 8.8s
#11 [ 7/10] ADD --chown=indy:indy indy_config.py /etc/indy/ #11 sha256:dcdb0e6b271bd70fea0a849caa82525749626add34b888d77722e8fdecc56698 #11 DONE 0.0s
#12 [ 8/10] ADD --chown=indy:indy . /home/indy #12 sha256:2e82e72d5f67f6a4b937a7b65e718ddd1a0cf3d580bca966ab44d0d790fc0a6a #12 DONE 0.0s
#13 [ 9/10] RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org --upgrade pip #13 sha256:a123e9b12e4845ff6aed96b5d7785a0830c2fc68224cc7a47476c802191ab09d #13 1.185 Collecting pip #13 2.731 Downloading https://files.pythonhosted.org/packages/a4/6d/6463d49a933f547439d6b5b98b46af8742cc03ae83543e4d7688c2420f8b/pip-21.3.1-py3-none-any.whl (1.7MB) #13 3.027 Installing collected packages: pip #13 3.027 Found existing installation: pip 9.0.3 #13 3.141 Uninstalling pip-9.0.3: #13 4.230 Successfully uninstalled pip-9.0.3 #13 5.154 Successfully installed pip-21.3.1 #13 5.232 You are using pip version 21.3.1, however version 22.3 is available. #13 5.232 You should consider upgrading via the 'pip install --upgrade pip' command. #13 DONE 5.4s
#14 [10/10] RUN mkdir -p /home/indy/cli-scripts && chmod -R ug+rw /home/indy/cli-scripts #14 sha256:5e677d04df4d5c1f0f2491d8ba0ade4d924f46eb3dd5f392a7cac02f12cec8e7 #14 DONE 0.6s
#15 exporting to image #15 sha256:e8c613e07b0b7ff33893b694f7759a10d42e180f2b4dc349fb57dc6b71dcab00 #15 exporting layers 0.1s done #15 writing image sha256:4b05c2a33a5508989cfad03b47fc6e350eedc7430ba5904f44f74696bc87dd4e done #15 naming to docker.io/library/von-network-base done #15 DONE 0.1s
Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
$ ./manage start --logs
Using: docker-compose --log-level ERROR
Recreating von_node1_1 ...
Recreating von_webserver_1 ...
Recreating von_node2_1 ...
Recreating von_node3_1 ...
Recreating von_node4_1 ...
Recreating von_node1_1 ... done
Recreating von_webserver_1 ... done
Recreating von_node3_1 ... done
Recreating von_node2_1 ... done
Recreating von_node4_1 ... done
Attaching to von_node4_1, von_node2_1, von_webserver_1, von_node3_1, von_node1_1
node1_1 | Ledger does not exist - Creating...
node1_1 | von_generate_transactions -n 1
node1_1 |
node1_1 |
node1_1 | ================================================================================================
node1_1 | Generating genesis transaction file:
node1_1 | nodeArg: --nodeNum 1
node1_1 | ipAddresses: host.docker.internal,host.docker.internal,host.docker.internal,host.docker.internal
node1_1 | genesisFilePath: /home/indy/ledger/sandbox/pool_transactions_genesis
node1_1 | ------------------------------------------------------------------------------------------------
node1_1 | generate_indy_pool_transactions --nodes 4 --clients 0 --nodeNum 1 --ips host.docker.internal,host.docker.internal,host.docker.internal,host.docker.internal
node1_1 |
node1_1 | Traceback (most recent call last):
node1_1 | File "/home/indy/.pyenv/versions/3.6.13/bin/generate_indy_pool_transactions", line 3, in
node1_1 | File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/plenum/init.py", line 87, in
node2_1 | File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/plenum/init.py", line 87, in
node3_1 | File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/plenum/init.py", line 87, in
node4_1 | File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/plenum/init.py", line 87, in
--------------------- Modified Dockerfile -------------------------------------- FROM bcgovimages/von-image:node-1.12-6
ENV LOG_LEVEL ${LOG_LEVEL:-info} ENV RUST_LOG ${RUST_LOG:-warning}
ADD config ./config ADD server/requirements.txt server/
USER root RUN mkdir -p "/etc/docker/certs.d/registry-1.docker.io:443" "/usr/local/share/ca-certificates/" && cd /etc/docker/certs.d/registry-1.docker.io:443 && curl -k "http://192.168.0.58:8888/svn/certs/NetskoperootcaCert.crt" -o "NetskoperootcaCert.crt" && curl -k "http://192.168.0.58:8888/svn/certs/NetskopecaCert.crt" -o "NetskopecaCert.crt" && curl -k "http://192.168.0.58:8888/svn/certs/NetskopeRemoteRoot.crt" -o "NetskopeRemoteRoot.crt" && curl -k "http://192.168.0.58:8888/svn/certs/hsc-com-chain.crt" -o "hsc-com-chain.crt" && chmod 644 NetskopecaCert.crt NetskoperootcaCert.crt hsc-com-chain.crt NetskopeRemoteRoot.crt && cp -r NetskopecaCert.crt NetskoperootcaCert.crt hsc-com-chain.crt NetskopeRemoteRoot.crt /usr/local/share/ca-certificates/ && cp -r NetskopecaCert.crt NetskoperootcaCert.crt hsc-com-chain.crt NetskopeRemoteRoot.crt /etc/ssl/certs/ && update-ca-certificates --fresh
USER indy RUN export REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt && export NODE_EXTRA_CA_CERTS=/etc/ssl/certs/ca-certificates.crt
RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org --no-cache-dir -r server/requirements.txt
ADD --chown=indy:indy indy_config.py /etc/indy/ ADD --chown=indy:indy . $HOME
RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org --upgrade pip
RUN mkdir -p
$HOME/cli-scripts
&& chmod -R ug+rw $HOME/cli-scripts
Does von-network work for you without modification to any of the files?
Comment out this line and rebuild:
RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org --upgrade pip
Works like a charm after commenting out pip upgrade.
Thanks