tisimst / pyDOE

Design of experiments for Python
BSD 3-Clause "New" or "Revised" License
263 stars 114 forks source link

can't install #1

Closed hsharrison closed 10 years ago

hsharrison commented 10 years ago

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

tisimst commented 10 years ago

@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?

hsharrison commented 10 years ago

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
hsharrison commented 10 years ago

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

hsharrison commented 10 years ago

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.

tisimst commented 10 years ago

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.

hsharrison commented 10 years ago

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

hsharrison commented 10 years ago

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

hsharrison commented 10 years ago

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.

tisimst commented 10 years ago

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!

hsharrison commented 10 years ago

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).

tisimst commented 10 years ago

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!

hsharrison commented 10 years ago

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