mobilecoinofficial / forest

Enables a Forest of MobileCoin enabled SignalBots. Beta software, APIs may change!
MIT License
19 stars 12 forks source link

Fatal error starting hellobot: ModuleNotFoundError: No module named 'aiohttp' #131

Closed dsernst closed 2 years ago

dsernst commented 2 years ago

Followed the readme install instructions, up to Running Hellobot. Manually testing messages w/ ./signal-cli send worked.

Now when attempting to start hellobot with:

pipenv run python -m sample_bots.hellobot

Throws the fatal error:

Traceback (most recent call last):
  File "/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/dsernst/Documents/forest/sample_bots/hellobot.py", line 5, in <module>
    from forest.core import Bot, Message, run_bot
  File "/Users/dsernst/Documents/forest/forest/core.py", line 33, in <module>
    import aiohttp
ModuleNotFoundError: No module named 'aiohttp'
dsernst commented 2 years ago

I thought I had installed all the dependencies at the beginning? Hmm maybe I forgot... will try again with:

pipenv install --dev

And then again trying:

pipenv run python -m sample_bots.hellobot

Now getting:

Traceback (most recent call last):
  File "/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/dsernst/Documents/forest/sample_bots/hellobot.py", line 5, in <module>
    from forest.core import Bot, Message, run_bot
  File "/Users/dsernst/Documents/forest/forest/core.py", line 33, in <module>
    import aiohttp
  File "/Users/dsernst/.local/share/virtualenvs/forest-RQF5VO1v/lib/python3.9/site-packages/aiohttp/__init__.py", line 5, in <module>
    from . import hdrs as hdrs
  File "/Users/dsernst/.local/share/virtualenvs/forest-RQF5VO1v/lib/python3.9/site-packages/aiohttp/hdrs.py", line 8, in <module>
    from multidict import istr
ModuleNotFoundError: No module named 'multidict'
dsernst commented 2 years ago

I'm making progress by manually pip install X the different No module named X errors it's giving me.

dsernst commented 2 years ago

So manually running

pip install aioprocessing asyncpg base58 phonenumberslite prometheus_async prometheus_client protobuf termcolor ulid2 pycryptodome

(from all the deps listed in Pipfile)

worked up until errors about Missing module libfuse.

Eventually realized from seeing it in all the Dockerfiles that one is not a python lib.

Found https://github.com/libfuse/libfuse/, which pointed me to https://osxfuse.github.io since I'm trying to run this from OS X. Installed, which then required a restart and now we're past all the dependency errors....

So I'm personally unblocked from that particular class of errors now.

Seems like I did something wrong w/ my pipenv / virtualenv config. I tried looking into the virtualenv docs to figure out what but didn't have much luck.

Happy to close this issue now, maybe it can be helpful to others who get stuck in a similar way, or maybe there's something missing from the install instructions to prevent it in the future. I don't feel qualified to say, but since I'm unblocked, I will close.

transfaeries commented 2 years ago

This is an issue I'd encountered before but didn't know how to fix or reproduce. This might end up being really helpful, so thank you!

transfaeries commented 2 years ago

@dsernst in the end, did you fall back on running without using pipenv?

I would like to be able to fix this pipenv issue so I can provide better guideance to people, but I'm also unsure about where exactly the breakdown in dependency management is happening. It might even be a bug with Pipenv.

Reopening for now I guess, since I'm having this issue too, and it'll be good to keep that in mind. Might close again if we... change the way we're handling dependencies or something, but it's a known bug right now. I just don't know exactly how to reproduce it.

dsernst commented 2 years ago

Hard to say... I haven't gotten it all working yet. Had to stop for the night and haven't had a chance to come back to it yet — hopefully later today if I can finish some other work 🙂

I believe running:

pip install aioprocessing asyncpg base58 phonenumberslite prometheus_async prometheus_client protobuf termcolor ulid2 pycryptodome

fixed the dependency issues. Because then running

pipenv run python -m sample_bots.hellobot

would show new, different errors. Making progress 😄

But my recollection was the newest error I got stuck on was along the lines of Can't find /etc/hostnames. Haven't opened an issue for it yet.

Hope this helps

dsernst commented 2 years ago

Update: Just got a chance to pull in @technillogue's latest fix https://github.com/mobilecoinofficial/forest/pull/137... worked like a charm.

Hellobot is up and running! 🥂

image

technillogue commented 2 years ago

I'm sure this issue will come up again with poetry but I can't current reproduce anything so