AI-Feynman icon indicating copy to clipboard operation
AI-Feynman copied to clipboard

(Docker Machine) FileNotFoundError: [Errno 2] No such file or directory: './brute_force_oneFile_v3.scr' -- Solved

Open Amelrich opened this issue 4 years ago • 0 comments

Hi, While running your code on a Docker Debian Virtual Machine I got the following the error.

Traceback (most recent call last): File "ai_feynman_terminal_example.py", line 17, in <module> run_aifeynman(opts.pathdir, opts.filename, BF_try_time=opts.BF_try_time, BF_ops_file_type=opts.BF_ops_file_type, polyfit_deg=opts.polyfit_deg, File "/data/AI-Feynman-master/Code/S_run_aifeynman.py", line 165, in run_aifeynman PA = run_AI_all(pathdir,filename+"_train",BF_try_time,BF_ops_file_type, polyfit_deg, NN_epochs, PA=PA) File "/data/AI-Feynman-master/Code/S_run_aifeynman.py", line 37, in run_AI_all PA = run_bf_polyfit(pathdir,pathdir,filename,BF_try_time,BF_ops_file_type, PA, polyfit_deg) File "/data/AI-Feynman-master/Code/S_run_bf_polyfit.py", line 26, in run_bf_polyfit brute_force(pathdir_transformed,filename,BF_try_time,BF_ops_file_type,"+") File "/data/AI-Feynman-master/Code/S_brute_force.py", line 29, in brute_force subprocess.call(["./brute_force_oneFile_v3.scr", file_type, "%s" %try_time, pathdir+filename]) File "/usr/local/lib/python3.8/subprocess.py", line 340, in call with Popen(*popenargs, **kwargs) as p: File "/usr/local/lib/python3.8/subprocess.py", line 854, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/local/lib/python3.8/subprocess.py", line 1702, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: './brute_force_oneFile_v3.scr'

I was able to to solve it by changing the brute_force function in S_brute_force.py. I added "sh" at the beginning of the arguments of the subprocess.call method, the following way:

'if sep_type=="*":
    subprocess.call(["sh", "./brute_force_oneFile_v2.scr", file_type, "%s" %try_time, pathdir+filename])
    #subprocess.call(["sh", "./brute_force_oneFile_mdl_v3.scr", file_type, "%s" %try_time, pathdir+filename, "10", "0"])
if sep_type=="+":
    subprocess.call(["sh", "./brute_force_oneFile_v3.scr", file_type, "%s" %try_time, pathdir+filename])
    #subprocess.call(["sh", ./brute_force_oneFile_mdl_v2.scr", file_type, "%s" %try_time, pathdir+filename, "10", "0"])
return 1'

To reproduce the error here is the docker machine I used. Feel free to share or add it on your Readme as people might be interested in building Virtual Machine, especially for the Fortran binaries.

docker image pull python:3.8.3-buster
docker container run -it -v C:/Project/Docker:/data python:3.8.3-buster sh

apt-get update
apt-get install gfortran

pip install pandas scipy matplotlib sympy sortedcontainers
pip install torch==1.5.1+cpu torchvision==0.6.1+cpu -f https://download.pytorch.org/whl/torch_stable.html

cd data/AI-Feynman-master/Code
./compile.sh
python ai_feynman_terminal_example.py --pathdir=../example_data/ --filename=example1.txt

Amelrich avatar Jul 07 '20 15:07 Amelrich