I want to automate hyperparameter search. So I decided to write a python script that automated that task. Basically it (script.py
) looks like:
import os
parameters = [0.001, 0.002, 0.003]
for p in parameters:
os.system("python main.py --learning_rate={}".format(p))
While main.py
starts with import tensorflow as tf
and then does its magic.
When I run $ python main.py --learning_rate=0.001
it does its job without problem (both on my computer and on the server). When I try the script on my computer it works fine BUT when I try to run $ python script.py
on the server it says
Traceback (most recent call last):
File "main.py", line 1, in <module>
import tensorflow as tf
ImportError: No module named tensorflow
This is my first question, please let me know if I should make any changes or add/remove information. Thanks.
Solution:
Thanks for the help! By checking what was suggested in Script running in PyCharm but not from the command line I was able to spot the problem and solve my error. All I had to do in my script was then to change os.system("python main.py --learning_rate={}".format(p))
for os.system("python3.6 main.py --learning_rate={}".format(p))
to get it running.