Yelp / MOE

A global, black box optimization engine for real world metric optimization.
Other
1.31k stars 139 forks source link

Supply Python vars to CMake automatically #412

Closed Rouslan closed 9 years ago

Rouslan commented 9 years ago

I have both Python 2.7 and 3.3 on my system. When I tried building this project to use in Python, it ended up linking with version 3 of the Python, despite having run setup.py from Python 2 (and despite it linking with the Python 2 Boost library).

It should use the same version of Python that setup.py was run with.

suntzu86 commented 9 years ago

automation++ Thanks @Rouslan! I should've done that from the start.

for posterity: cmake gives precedence to the last "-D" option when there are repeats, e.g.,

cmake -D OPT1=0 -D OPT1=1 -D OPT1=2 ...

sets OPT1 to 2 (as long as no further instances of OPT1). In particular, if the user sets either of the MOE_PYTHON_* vars manually, the automatic choice will be overridden.

I'll push another short branch updating our docs/install instructions.

suntzu86 commented 9 years ago

Note: as long as you're in a virtualenv with the appropriate version of Python, this will work seamlessly.

Rouslan commented 9 years ago

You're welcome.

I actually did run the setup from within virtualenv. It doesn't prevent CMake from finding a different version of Python.

suntzu86 commented 9 years ago

Sorry, I meant your change makes it work correctly now. Definitely broken before. Reminder to myself to make that clear in the docs.

I've had cmake fail to find the wrong version too. I just set those vars manually, so this is a welcome fix :) On Oct 11, 2014 11:12 AM, "Rouslan Korneychuk" notifications@github.com wrote:

You're welcome.

I actually did run the setup from within virtualenv. It doesn't prevent CMake from finding a different version of Python.

— Reply to this email directly or view it on GitHub https://github.com/Yelp/MOE/pull/412#issuecomment-58758859.

Rouslan commented 9 years ago

Ah, I see.

sc932 commented 9 years ago

Thanks @Rouslan!