3

I am trying to follow this instructions here:

https://github.com/hyperledger/indy-agent/blob/master/python/README.md

in order to simulate Hyperledger indy interactions, on a ubuntu 18.04 AWS instance.

I already cloned the repository and installed dependencies.(I am following dev mode instruction because the docker fails)

Then i launch the command:

python3 indy-agent.py 8094

And here the logs I have:

Traceback (most recent call last):

  File "indy-agent.py", line 17, in <module>
    import aiohttp_jinja2

  File "/home/ubuntu/.local/lib/python3.5/site-packages/aiohttp_jinja2/__init__.py", line 6, in <module>
    from aiohttp import web

  File "/home/ubuntu/.local/lib/python3.5/site-packages/aiohttp/__init__.py", line 6, in <module>
    from .client import (

  File "/home/ubuntu/.local/lib/python3.5/site-packages/aiohttp/client.py", line 12, in <module>
    from typing import (  # noqa

ImportError: cannot import name 'Coroutine'

This the aiohttp/client.py file:

"""HTTP Client for asyncio."""

import asyncio
import base64
import hashlib
import json
import os
import sys
import traceback
import warnings
from types import SimpleNamespace, TracebackType
from typing import (  # noqa
    Any,
    Coroutine,
    Generator,
    Generic,
….
)

This is the aiohttp/init.py file:

version = '3.5.4'

from typing import Tuple  # noqa

from . import hdrs
from .client import (

….

And this is the aiohttp_jinja2/init.py:

import asyncio
import functools
import warnings
import jinja2
from collections import Mapping
from aiohttp import web
….

Any ideas on how to fix it? Should I change some lines of code in one of these files?

Thanks

ADDITIONAL INFORMATION(BASED ON ANSWERS)

After the feedback from the answers, I updated to python 3.6.9. While the asyncio problems fixed, still I get problems While setting up docker in the /python directory, I got the following:

1)make docker-build

2)sudo make docker-start PORT=8094

docker run -it -p $PORT:$PORT -e PORT=$PORT --name indy-agent_$PORT indy-agent
Traceback (most recent call last):
  File "indy-agent.py", line 20, in <module>
    from modules.connection import Connection, AdminConnection
  File "/app/modules/__init__.py", line 1, in <module>
    from python_agent_utils.messages.errors import ValidationException
ModuleNotFoundError: No module named 'python_agent_utils'
Makefile:5: recipe for target 'docker-start' failed
make: [docker-start] Error 1 (ignored)
docker rm indy-agent_$PORT
indy-agent_8094

When I try to install manually(without docker), I try to launch “pip install -r requirements.txt”, and I get the following:

ERROR: Could not find a version that satisfies the requirement aiohttp==3.5.4 …….ERROR: No matching distribution found for aiohttp==3.5.4 (from -r requirements.txt (line 2))

Then, when I try to launch the command “python3.6 indy-agent.py 8094”, I get continuously logs about missing modules. I installed them manually, which allowed me to go a little further in the process. But then I receive logs about modules that I cannot install through python.

This fact of having to install all the modules manually seems very strange to me, but I installed the agent outside the indy-sdk directory and also inside indy-sdk directory, and I get the same results. Here’s the commands I launch and the logs I get:

1)python3.6 indy-agent.py 8094

ModuleNotFoundError: No module named 'aiohttp_jinja2'

2)python3.6 -m pip install aiohttp_jinja2

3)python3.6 indy-agent.py 8094

ModuleNotFoundError: No module named 'base58'

4)python3.6 -m pip install base58

No module named 'dateutil'

5)python3.6 -m pip install python-dateutil

6)python3.6 indy-agent.py 8094

ModuleNotFoundError: No module named 'indy'

7)sudo apt-get update

8)sudo apt-get install -y libindy

9)python3.6 -m pip install indy

10)python3.6 indy-agent.py 8094

ImportError: cannot import name 'did'

11)python -m pip install did

12)sudo python3 -m pip install did

The directory '/home/ubuntu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '/home/ubuntu/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

Could not find a version that satisfies the requirement did (from versions: ) No matching distribution found for did

Luca
  • 41
  • 1
  • 3
  • 1
    Try to format your post properly. This will increase readability for other users.https://stackoverflow.com/help/how-to-ask – Jones1220 Jul 15 '19 at 11:39
  • 2
    On your linked page, it lists python 3.6 as a requirement. You are trying to run with python 3.5. Could you try with python 3.6 instead? – FlyingTeller Jul 15 '19 at 12:45
  • 1
    I faced same error in Ubuntu 16.04. – Trinayan Jul 16 '19 at 10:07
  • 1
    @FlyingTeller I tried again after installing python3.6. You were right, the Asyncio module problem was fixed because of this, thanks for that. The problem is that I still have some error logs. I edit the issue with the last logs I get, both on docker and on manual installation under the title “Additional Information” – Luca Jul 17 '19 at 13:39
  • Did you also run `python3.6 -m pip install -r requirements.txt` with the requirements.txt from the cloned repo that you have linked? – FlyingTeller Jul 17 '19 at 13:45
  • @FlyingTeller I already run the python3.6 -m pip install -r requirements.txt. I rebooted the instance and run this command again, followed by python3.6 indy-agent.py 8094.And it Worked! Thanks for that – Luca Jul 18 '19 at 15:54

0 Answers0