redstreet/fava_investor

Error: Importing module failed

scanta2 opened this issue · 11 comments

Hi,
I have been following the instructions in the readme on how to use this extension directly in the beancount ledger folder, or installed via pip. All I get is an error "Importing module "fava_investor" failed.".

Is there anything I am missing?

The git repo name unfortunately has a hyphen, which is not valid in python imports. I'll rename the repo. Meanwhile, move your clone:

mv fava-investor fava_investor

Assuming you did this in the same directory of your beancount source, invoke the fava extension using the line below, given the actual module lives in a subdirectory that is also named fava_investor:

# 2010-01-01 custom "fava-extension" "fava_investor.fava_investor" "{...}"

Let me know if that worked for you. I'll add a note to the README.

Did you try running the example? See CONTRIBUTING.md (I just moved it to README.md).

If that doesn't work, you might want to install the latest released version of fava.

"Importing module "fava_investor" failed."

That usually means the module was not found. Try running python3 interactively and typing:
import fava_investor.fava_investor

That should succeed. Does it?

EDIT: Just forget. I installed the module argh and now your example.bc file works.
I left just in case somebody has the same error. The solution is:
pip3 install argh

Regards and thank you for your work!

Tino.

Hi, the same here... I post the output to your last command:

Python 3.7.6 (default, Dec 30 2019, 19:38:26)
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import fava_investor.fava_investor
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/tinotuno/fava_investor/fava_investor/__init__.py", line 6, in <module>
    from .modules.assetalloc_class import libassetalloc
  File "/Users/tinotuno/fava_investor/fava_investor/modules/assetalloc_class/libassetalloc.py", line 4, in <module>
    import argparse,argcomplete,argh
ModuleNotFoundError: No module named 'argh'
>>>

Ah okay, that helps! This should fix it:
pip install argh argcomplete

Added to README.md

@scanta2, please reopen if you're still having trouble.

@redstreet you forgot
pip3 install argh
Without that doesn't work. pip3 install argcomplete is not enough.

Ah, thanks for catching this. Will add.

If either of you want to contribute the below, that'd be cool:
#25