When I try to install statsmodels under OSX, I get the following error message:
bash-3.2$ /usr/local/bin/python2.7 setup.py build
Traceback (most recent call last):
File "setup.py", line 476, in
File "setup.py", line 232, in write_version_py
UnboundLocalError: local variable 'a' referenced before assignment
a.close() in the finally needs to be protected again with a try except.
a is not defined if a = open(filename, 'w') fails.
a = open(filename, 'w')
to see why opening the file fails, you could help us and copy a = open(filename, 'w') on line 226 in setup.py into a line in front of the try line 225, and copy the full traceback to this ticket.
Thanks for the help, it was a permission issue
Thanks for reporting back.
I'm not sure, that we should really fix this, and hide the problem.
Do we want that statsmodels is installable without this permission?
Here it's only of minor importance because it just writes a file with the version number.
I used to run into this sometimes with pandas and numpy also (not sure about recently) but it is avoidable. With statsmodels it was usually a consequence of having to build everything twice with the Cython code before so that that file gets written by the sudo install step instead of the build command. I'm not opposed to a fix, but it's low priority for me.
Closing this. I haven't seen this in a while, and we haven't heard about it. I assume it was fixed by fixing the build issues.