brandon-rhodes / luca

Bookkeeping in Python
67 stars 16 forks source link

Error using "complete" command on us.1040 due to missing f1040-tax-table.csv #3

Closed zrisher closed 8 years ago

zrisher commented 8 years ago

When running the complete command on a default json input created using the form command, I'm presented with the following error:

(luca_example)ubuntu@ip-172-31-6-233:~/luca_example/2012$ luca complete 2012-f1040.json
2012-f1040.json
Traceback (most recent call last):
  File "/home/ubuntu/anaconda/envs/luca_example/bin/luca", line 11, in <module>
    sys.exit(main())
  File "/home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages/luca/commandline.py", line 34, in main
    for line in _main(args, terminal):
  File "/home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages/luca/commandline.py", line 64, in _main
    luca.forms.actions.complete(args['<tax-filing.json>'], not args['-j'])
  File "/home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages/luca/forms/actions.py", line 70, in complete
    form_module, form = complete_form(json_path)
  File "/home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages/luca/forms/actions.py", line 110, in complete_form
    form, form_module = process(json_data)
  File "/home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages/luca/forms/actions.py", line 157, in process
    form_module.compute(form)
  File "/home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages/luca/forms/us/f1040.py", line 100, in compute
    f.line44 = tax_from_tax_table(f.line43, f.filing_status)
  File "/home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages/luca/forms/us/f1040.py", line 201, in tax_from_tax_table
    with open(os.path.join(here, 'f1040-tax-table.csv')) as f:
IOError: [Errno 2] No such file or directory: '/home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages/luca/forms/us/f1040-tax-table.csv'

This appears to occur because the version of Luca distributed via pip is missing https://github.com/brandon-rhodes/luca/blob/master/luca/forms/us/f1040-tax-table.csv

Manually inserting this file into the downloaded library fixes this issue.

brandon-rhodes commented 8 years ago

Thanks, I had not know about this error! I have just pushed 5cc72eb9301d616e63d455978776e2a873e85f22 to fix it, so a fresh:

pip install https://github.com/brandon-rhodes/luca/archive/master.zip

should get you a copy that can find the old tax table.

Of course, another problem might arise: I have not had time to load a new tax table for 2015 yet, so if you are trying to do this year's taxes (as opposed to your 2014 taxes) then it still might not be able to find an up-do-date tax table. I'll welcome a pull request to add one, though — if you look at the format, it should be easy to make a new one for this year. :)

Let me know whether the tax-table error goes away for you now. Thanks again!

zrisher commented 8 years ago

@brandon-rhodes Thanks for getting back to me on these issues. I'm actually not using this to do my personal taxes, but rather to ensure others could take their tax inputs in the format they'd supply to Luca and then run them through https://github.com/open-source-economics/Tax-Calculator to calculate their resulting taxes given any tax plan (e.g. a particular presidential candidate's plan, a proposal of their own, or simply the current law tax plan and compare the output). I'm working with the Open Source Policy Center to accomplish that. So here, I'm just trying to get up and running with Luca and become familiar with how someone would use it.

To that end, yes a 2015 tax table would be helpful, but I can assist in getting it together as well.

Your commit definitely seems like it should solve it. I'm having a little trouble actually getting pip to pull the newest version, but I'm sure it's some small thing I'm doing incorrectly. You'll have to excuse my relative unfamiliarity with Python and managing its dependencies. I'll lay out my steps below, in case anything quickly comes to mind for you:

(luca_example)ubuntu@ip-172-31-6-233:~/luca_example/2013$ pip uninstall luca
Uninstalling luca-1.0:
  /home/ubuntu/anaconda/envs/luca_example/bin/luca
  /home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages/luca-1.0-py2.7.egg-info
  /home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages/luca/__init__.py
  /home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages/luca/__init__.pyc
  /home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages/luca/commandline.py
  ... etc more files ...
Proceed (y/n)? y
  Successfully uninstalled luca-1.0
(luca_example)ubuntu@ip-172-31-6-233:~/luca_example/2013$ pip install https://github.com/brandon-rhodes/luca/archive/master.zip
Collecting https://github.com/brandon-rhodes/luca/archive/master.zip
  Downloading https://github.com/brandon-rhodes/luca/archive/master.zip (130kB)
    100% |████████████████████████████████| 133kB 681kB/s
Requirement already satisfied (use --upgrade to upgrade): blessings in /home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages (from luca==1.0)
Requirement already satisfied (use --upgrade to upgrade): docopt in /home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages (from luca==1.0)
Requirement already satisfied (use --upgrade to upgrade): fdfgen in /home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages (from luca==1.0)
Requirement already satisfied (use --upgrade to upgrade): pandas in /home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages (from luca==1.0)
Requirement already satisfied (use --upgrade to upgrade): pyyaml in /home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages (from luca==1.0)
Requirement already satisfied (use --upgrade to upgrade): reportlab in /home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages (from luca==1.0)
Requirement already satisfied (use --upgrade to upgrade): requests in /home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages (from luca==1.0)
Requirement already satisfied (use --upgrade to upgrade): pyPdf in /home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages (from luca==1.0)
Requirement already satisfied (use --upgrade to upgrade): pytz>=2011k in /home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages (from pandas->luca==1.0)
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in /home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages (from pandas->luca==1.0)
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.7.0 in /home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages (from pandas->luca==1.0)
Requirement already satisfied (use --upgrade to upgrade): pip>=1.4.1 in /home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages (from reportlab->luca==1.0)
Requirement already satisfied (use --upgrade to upgrade): pillow>=2.4.0 in /home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages (from reportlab->luca==1.0)
Requirement already satisfied (use --upgrade to upgrade): setuptools>=2.2 in /home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages/setuptools-20.3-py2.7.egg (from reportlab->luca==1.0)
Requirement already satisfied (use --upgrade to upgrade): six>=1.5 in /home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages (from python-dateutil->pandas->luca==1.0)
Installing collected packages: luca
  Running setup.py install for luca ... done
Successfully installed luca-1.0
(luca_example)ubuntu@ip-172-31-6-233:~/luca_example/2013$ ls /home/ubuntu/anaconda/envs/luca_example/lib/python2.7/site-packages/luca/forms/us
f1040.py     f1040sc.py   f1040sse_long.py   f1120s.py     f8949.py   fw9.py
f1040.pyc    f1040sc.pyc  f1040sse_long.pyc  f1120s.pyc    f8949.pyc  fw9.pyc
f1040sa.py   f1040sd.py   f1040sse.py        f1120ssk.py   f940.py    __init__.py
f1040sa.pyc  f1040sd.pyc  f1040sse.pyc       f1120ssk.pyc  f940.pyc   __init__.pyc
f1040sb.py   f1040se.py   f1099msc.py        f8829.py      f941.py
f1040sb.pyc  f1040se.pyc  f1099msc.pyc       f8829.pyc     f941.pyc

So the file never actually shows up in the directory, and the same error occurs. I can see that it properly exists there it github. I've tried installing using git+https://github.com/brandon-rhodes/luca.git@master and git+https://github.com/brandon-rhodes/luca.git@5cc72eb9301d616e63d455978776e2a873e85f22, same issues.

I'll keep working on this and get back to you when I can confirm it's fixed.

brandon-rhodes commented 8 years ago

I forgot: it's not enough to list a file in the MANIFEST, it also then has to be listed again in the setup.py file. So I have just committed fe68bc76bf14e0f09b4d2b60ce78e8ee8a8e3c7b and, this time, double checked by hand that it makes it into a real install of Luca! (Before I just verified it appeared in the .tar.gz file, which obviously was only half the task of getting it all the way installed.)

Hopefully this gets this part fixed! Re-open if it doesn't. :)

zrisher commented 8 years ago

@brandon-rhodes Yep, that fixed it. Thank you!