tisimst/pyDOE

can't install

Closed this issue · 12 comments

setup.py imports pyDOE, so this can't be installed unless it's already installed. A catch-22.

@hsharrison A couple of questions:

  1. What version of python are you using to install it with?
  2. What did you actually do when you tried to install it?

I tried python setup.py install after cloning. Same issue with pip also.

Apparently this is just a Python 3 issue (I was using 3.3). It works fine in 2.7. The issue arises from changes in relative imports in Python 3. Not sure if you're trying to support 3.3, if not this isn't really an issue. Still, I think it's poor practice to import your own package in setup.py. I understand the idea is to grab the version info from somewhere else. But I think better practice is to reverse it: write out the version string in setup.py, and when you want to access it somewhere else do:

import pkg_resources
pkg_resources.require('pyDOE')[0].version

Alternatively you can do something like this:
http://stackoverflow.com/a/16084844/2909116

In short, make a __version__.py then read the file manually to get the version string.

Here's more useful discussion:
http://stackoverflow.com/questions/2058802/how-can-i-get-the-version-defined-in-setup-py-setuptools-in-my-package/2073599#2073599

I forked and made pyDOE python3 compatible:
https://github.com/hsharrison/pyDOE

Sorry the diffs, aren't very useful, not sure what happened there. I just ran 2to3 which mostly seemed to get rid of xrange and change the syntax of raise. Then I fixed up the imports myself.

Maybe I'll submit a pull request after I play around with it a bit and make sure that things are working.

Ok, I've gone through and simply made what compatibility changes I could figure out so that 2to3 wasn't actually necessary. I've also removed the pyDOE.__version__ call in setup.py, so that shouldn't be an issue any more. Would you be able to test the new version (0.3.2) to see if the updates work correctly? Thanks.

Still not working. You need to remove import pyDOE in setup.py.

Almost there... the imports in __init__.py aren't working in Python 3, see my changes:
https://github.com/hsharrison/pyDOE/blob/master/pyDOE/__init__.py

BTW, the reason I'm pushing for this is because I'm working on a Python experiment framework and it can construct experiments based on design matrices passed from pyDOE. But my package is Python 3 only at this point.

I really appreciate your feedback. I think I've got all the Python 3 compatibility issues worked out, including the way you suggested to do the imports. If you could check it with the recent release (0.3.4), I'd appreciate it. If you find it satisfactory, please close this ticket.

BTW, looks like you've got a nice experiment package!

Still some issues, now with the raise syntax in var_regression_matrix.py on line 32. Instead of

raise ValueError, "model and DOE don't suit together"

you need

raise ValueError("model and DOE don't suit together")

I ran 2to3 again and it looks like the rest of the changes it makes are false positives so this might be the last one (fingers crossed).

Wow, this sure has been a beast. Ok. NOW I think I've got it. I have done some minor tests, but give it a go and let me know if it does or doesn't work (version 0.3.5). Thanks for your debugging!

Looks good here, seems to be working! Appreciate the effort.