optuna / kurobako-py

A Python library to help implement kurobako's solvers and problems
MIT License
9 stars 7 forks source link

[Bug Report] Executing the codes in the Usage Example. #2

Closed HideakiImamura closed 4 years ago

HideakiImamura commented 4 years ago

Now, I try to execute the Usage Example in README.md. However, I faced to the following error. My version of kurobako-py is the current maser one (comit id: 707a4551f24d84e1924b810c12c0e04275d63609). My version of kurobako is also the current master one (comit id: 8c7953641ba68f5dcbc2258710e88f01272c39bb). I can execute the Usage Example of kurobako, so I think the kurobako works well in my environment. I suspect that this error is caused by a mismatch of latest versions of kurobako and kurobako-py.

(venv) hideakibookpuro:kurobako-python mamu$ echo $SOLVER
{"command":{"path":"python","args":["random_solver.py"]}}
(venv) hideakibookpuro:kurobako-python mamu$ echo $PROBLEM
{"command":{"path":"python","args":["quadratic_problem.py"]}}
(venv) hideakibookpuro:kurobako-python mamu$ kurobako studies --solvers $SOLVER --problems $PROBLEM | kurobako run -q > result.json

Error: IoError (cause; No such file or directory (os error 2))
HISTORY:
  [0] at /Users/mamu/.cargo/registry/src/github.com-1ecc6299db9ec823/kurobako_core-0.1.6/src/epi/problem/external_program.rs:71 -- self.path="python"
  [1] at /Users/mamu/.cargo/registry/src/github.com-1ecc6299db9ec823/kurobako_core-0.1.6/src/epi/problem/external_program.rs:84
  [2] at /Users/mamu/.cargo/registry/src/github.com-1ecc6299db9ec823/kurobako-0.1.9/src/problem.rs:75
  [3] at /Users/mamu/.cargo/registry/src/github.com-1ecc6299db9ec823/kurobako-0.1.9/src/problem.rs:33
  [4] at /Users/mamu/.cargo/registry/src/github.com-1ecc6299db9ec823/kurobako-0.1.9/src/runner.rs:214
  [5] at /Users/mamu/.cargo/registry/src/github.com-1ecc6299db9ec823/kurobako-0.1.9/src/runner.rs:131
  [6] at /Users/mamu/.cargo/registry/src/github.com-1ecc6299db9ec823/kurobako-0.1.9/src/runner.rs:141
  [7] at /Users/mamu/.cargo/registry/src/github.com-1ecc6299db9ec823/kurobako-0.1.9/src/main.rs:82
sile commented 4 years ago

Thank you for reporting this issue. It seems that kurobako could not find python command on your environment. If you have installed python3, you can modify commands to generate solver and problem recipes to use the command as follows:

$ SOLVER=$(kurobako solver command python3 random_solver.py)
$ PROBLEM=$(kurobako problem command python3 quadratic_problem.py)
sile commented 4 years ago

I updated README.md (https://github.com/sile/kurobako-py/commit/5fa515857ef6bb7eb4196400b1a37e921903f5bb) to use python3 as Python2 has been the end of life (since January 2020).

HideakiImamura commented 4 years ago

Thank you for your reply. I updated the commands to use python3 not python, but faced the same error as follows.

(venv) hideakibookpuro:kurobako-python mamu$ SOLVER=$(kurobako solver command python3 random_solver.py)
(venv) hideakibookpuro:kurobako-python mamu$ PROBLEM=$(kurobako problem command python3 quadratic_problem.py)
(venv) hideakibookpuro:kurobako-python mamu$ kurobako studies --solvers $SOLVER --problems $PROBLEM | kurobako run -q > result.json

Error: IoError (cause; No such file or directory (os error 2))
HISTORY:
  [0] at /Users/mamu/.cargo/registry/src/github.com-1ecc6299db9ec823/kurobako_core-0.1.6/src/epi/problem/external_program.rs:71 -- self.path="python3"
  [1] at /Users/mamu/.cargo/registry/src/github.com-1ecc6299db9ec823/kurobako_core-0.1.6/src/epi/problem/external_program.rs:84
  [2] at /Users/mamu/.cargo/registry/src/github.com-1ecc6299db9ec823/kurobako-0.1.9/src/problem.rs:75
  [3] at /Users/mamu/.cargo/registry/src/github.com-1ecc6299db9ec823/kurobako-0.1.9/src/problem.rs:33
  [4] at /Users/mamu/.cargo/registry/src/github.com-1ecc6299db9ec823/kurobako-0.1.9/src/runner.rs:214
  [5] at /Users/mamu/.cargo/registry/src/github.com-1ecc6299db9ec823/kurobako-0.1.9/src/runner.rs:131
  [6] at /Users/mamu/.cargo/registry/src/github.com-1ecc6299db9ec823/kurobako-0.1.9/src/runner.rs:141
  [7] at /Users/mamu/.cargo/registry/src/github.com-1ecc6299db9ec823/kurobako-0.1.9/src/main.rs:82

(venv) hideakibookpuro:kurobako-python mamu$ which python3
/Users/mamu/Documents/Work/pfn/venv/bin/python3

It looks like the cargo missed my python binary in venv. How do we specify the binary with kurobako?

sile commented 4 years ago

I updated the commands to use python3 not python, but faced the same error as follows.

Hmm, it seems a bug of the kurobako command... I want to fix the bug this weekend but at the moment, I think, you can specify the full path of python3 binary like kurobako solver command /Users/mamu/Documents/Work/pfn/venv/bin/python3 random_solver.py as a workaround.

HideakiImamura commented 4 years ago

Thank you for your quick help. I specified the full path of python3 and then got the appropriate result. Thank you.

(venv) hideakibookpuro:kurobako-python mamu$ SOLVER=$(kurobako solver command ~/Documents/Work/pfn/venv/bin/python3 random_solver.py)
(venv) hideakibookpuro:kurobako-python mamu$ PROBLEM=$(kurobako problem command ~/Documents/Work/pfn/venv/bin/python3 quadratic_problem.py)
(venv) hideakibookpuro:kurobako-python mamu$ kurobako studies --solvers $SOLVER --problems $PROBLEM | kurobako run -q > result.json
sile commented 4 years ago

Published kurobako-v0.1.10 that has resolved this problem.