UnboundLocalError When trying to install OS X #843

Closed
aschilling opened this Issue May 19, 2013 · 5 comments

Projects

None yet

3 participants

@aschilling

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
write_version_py()
File "setup.py", line 232, in write_version_py
a.close()
UnboundLocalError: local variable 'a' referenced before assignment

@josef-pkt
Member

a.close() in the finally needs to be protected again with a try except.

a is not defined if a = open(filename, 'w') fails.

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

@aschilling

Thanks for the help, it was a permission issue

@josef-pkt
Member

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.

@jseabold
Member

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.

@jseabold
Member
jseabold commented Apr 6, 2014

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.

@jseabold jseabold closed this Apr 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment