kuz / DeepMind-Atari-Deep-Q-Learner

The original code from the DeepMind article + my tweaks
http://www.nature.com/nature/journal/v518/n7540/full/nature14236.html
1.83k stars 532 forks source link

qlua: ./initenv.lua:115: module 'alewrap' not found: #14

Closed andyyuan78 closed 8 years ago

andyyuan78 commented 8 years ago

envy@ub1404envy:~/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner$ ./run_gpu roms/breakout.bin -framework alewrap -game_path /home/envy/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner/roms/ -name DQN3_0_1_roms/breakout.bin_FULL_Y -env roms/breakout.bin -env_params useRGB=true -agent NeuralQLearner -agent_params lr=0.00025,ep=1,ep_end=0.1,ep_endt=replay_memory,discount=0.99,hist_len=4,learn_start=50000,replay_memory=1000000,update_freq=4,n_replay=1,network="convnet_atari3",preproc="net_downsample_2x_full_y",state_dim=7056,minibatch_size=32,rescale_r=1,ncols=1,bufferSize=512,valid_size=500,target_q=10000,clip_delta=1,min_reward=-1,max_reward=1 -steps 50000000 -eval_freq 250000 -eval_steps 125000 -prog_freq 10000 -save_freq 125000 -actrep 4 -gpu 0 -random_starts 30 -pool_frms type="max",size=2 -seed 1 -threads 4 Torch Threads: 4 Using GPU device id: 0 Torch Seed: 1 CUTorch Seed: 1791095845 qlua: ./initenv.lua:115: module 'alewrap' not found: no field package.preload['alewrap'] no file '/home/envy/.luarocks/share/lua/5.1/alewrap.lua' no file '/home/envy/.luarocks/share/lua/5.1/alewrap/init.lua' no file '/home/envy/torch/install/share/lua/5.1/alewrap.lua' no file '/home/envy/torch/install/share/lua/5.1/alewrap/init.lua' no file './alewrap.lua' no file '/home/envy/torch/install/share/luajit-2.1.0-beta1/alewrap.lua' no file '/usr/local/share/lua/5.1/alewrap.lua' no file '/usr/local/share/lua/5.1/alewrap/init.lua' no file '/home/envy/torch/install/lib/alewrap.so' no file '/home/envy/.luarocks/lib/lua/5.1/alewrap.so' no file '/home/envy/torch/install/lib/lua/5.1/alewrap.so' no file './alewrap.so' no file '/usr/local/lib/lua/5.1/alewrap.so' no file '/usr/local/lib/lua/5.1/loadall.so' stack traceback: [C]: at 0x7f57114a59f0 [C]: in function 'require' ./initenv.lua:115: in function 'setup' train_agent.lua:52: in main chunk envy@ub1404envy:~/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner$ vim install_dependencies.sh envy@ub1404envy:~/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner$ which nvcc /usr/local/cuda-7.5/bin/nvcc

also try the run_cpu ,same issue.

iostreamdoth commented 8 years ago

Did u execute installdependency? And I guess command should be ./run_gpu breakout

andyyuan78 commented 8 years ago

sure, installdependency has done, and it looks alewrap has installed success

Scanning dependencies of target alewrap [ 50%] Building CXX object alewrap/CMakeFiles/alewrap.dir/alewrap.cc.o [100%] Linking CXX shared module libalewrap.so [100%] Built target alewrap make -C build install make: Entering directory /tmp/alewrap/build' make[1]: Entering directory/tmp/alewrap/build' make[2]: Entering directory /tmp/alewrap/build' make[2]: Leaving directory/tmp/alewrap/build' [100%] Built target alewrap make[1]: Leaving directory /tmp/alewrap/build' Install the project... -- Install configuration: "Release" -- Installing: /home/envy/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner/torch/lib/luarocks/rocks/alewrap/0-0/lib/libalewrap.so -- Set runtime path of "/home/envy/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner/torch/lib/luarocks/rocks/alewrap/0-0/lib/libalewrap.so" to "$ORIGIN/../lib:/home/envy/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner/torch/lib:/home/envy/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner/torch/include" -- Installing: /home/envy/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner/torch/lib/luarocks/rocks/alewrap/0-0/lua/alewrap/AtariLayer.lua -- Installing: /home/envy/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner/torch/lib/luarocks/rocks/alewrap/0-0/lua/alewrap/AleEnv.lua -- Installing: /home/envy/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner/torch/lib/luarocks/rocks/alewrap/0-0/lua/alewrap/aleffi.lua -- Installing: /home/envy/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner/torch/lib/luarocks/rocks/alewrap/0-0/lua/alewrap/GameEnvironment.lua -- Installing: /home/envy/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner/torch/lib/luarocks/rocks/alewrap/0-0/lua/alewrap/GameScreen.lua -- Installing: /home/envy/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner/torch/lib/luarocks/rocks/alewrap/0-0/lua/alewrap/init.lua -- Installing: /home/envy/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner/torch/lib/luarocks/rocks/alewrap/0-0/lua/alewrap/alewrap.inl make: Leaving directory/tmp/alewrap/build' Updating manifest for /home/envy/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner/torch/lib/luarocks/rocks alewrap 0-0 is now built and installed in /home/envy/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner/torch/

Alewrap installation completed Installing Lua-GD ... mkdir: cannot create directory ‘/home/envy/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner/torch/src’: File exists Cloning into 'lua-gd'... remote: Counting objects: 1418, done. remote: Total 1418 (delta 0), reused 0 (delta 0), pack-reused 1418 Receiving objects: 100% (1418/1418), 1.35 MiB | 32.00 KiB/s, done. Resolving deltas: 100% (1034/1034), done. Checking connectivity... done. Warning: variable CFLAGS was not passed in buildvariables gcc -o gd.lo -c `gdlib-config --features |sed -e "s/GD/-DGD_/g"-O3 -Wall -fPIC -fomit-frame-pointergdlib-config --cflags`pkg-config lua5.1 --cflags -DVERSION=\"2.0.33r3\" luagd.c gcc -o gd.so gd.lo -shared gdlib-config --ldflags gdlib-config --libs -lgd ../../bin/luajit test_features.lua Lua-GD version: lua-gd 2.0.33r3 Lua-GD features: PNG support ..................... Enabled GIF support ..................... Enabled JPEG support .................... Enabled XPM/XBM support ................. Enabled FreeType support ................ Enabled Fontconfig support .............. Enabled Updating manifest for /home/envy/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner/torch/lib/luarocks/rocks luagd 2.0.33r3-1 is now built and installed in /home/envy/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner/torch/ (license: MIT/X11)

Lua-GD installation completed

You can run experiments by executing:

./run_cpu game_name

        or   

./run_gpu game_name

For this you need to provide the rom files of the respective games (game_name.bin) in the roms/ directory

envy@ub1404envy:~/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner$ ./run_gpu breakout -framework alewrap -game_path /home/envy/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner/roms/ -name DQN3_0_1_breakout_FULL_Y -env breakout -env_params useRGB=true -agent NeuralQLearner -agent_params lr=0.00025,ep=1,ep_end=0.1,ep_endt=replay_memory,discount=0.99,hist_len=4,learn_start=50000,replay_memory=1000000,update_freq=4,n_replay=1,network="convnet_atari3",preproc="net_downsample_2x_full_y",state_dim=7056,minibatch_size=32,rescale_r=1,ncols=1,bufferSize=512,valid_size=500,target_q=10000,clip_delta=1,min_reward=-1,max_reward=1 -steps 50000000 -eval_freq 250000 -eval_steps 125000 -prog_freq 10000 -save_freq 125000 -actrep 4 -gpu 0 -random_starts 30 -pool_frms type="max",size=2 -seed 1 -threads 4 Torch Threads: 4 Using GPU device id: 0 Torch Seed: 1 CUTorch Seed: 1791095845 qlua: ./initenv.lua:115: module 'alewrap' not found: no field package.preload['alewrap'] no file '/home/envy/.luarocks/share/lua/5.1/alewrap.lua' no file '/home/envy/.luarocks/share/lua/5.1/alewrap/init.lua' no file '/home/envy/torch/install/share/lua/5.1/alewrap.lua' no file '/home/envy/torch/install/share/lua/5.1/alewrap/init.lua' no file './alewrap.lua' no file '/home/envy/torch/install/share/luajit-2.1.0-beta1/alewrap.lua' no file '/usr/local/share/lua/5.1/alewrap.lua' no file '/usr/local/share/lua/5.1/alewrap/init.lua' no file '/home/envy/torch/install/lib/alewrap.so' no file '/home/envy/.luarocks/lib/lua/5.1/alewrap.so' no file '/home/envy/torch/install/lib/lua/5.1/alewrap.so' no file './alewrap.so' no file '/usr/local/lib/lua/5.1/alewrap.so' no file '/usr/local/lib/lua/5.1/loadall.so' stack traceback: [C]: at 0x7ff521ceb9f0 [C]: in function 'require' ./initenv.lua:115: in function 'setup' train_agent.lua:52: in main chunk envy@ub1404envy:~/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner$

iostreamdoth commented 8 years ago

install dependency installs torch in local directory.

as the messages are no file '/home/envy/.luarocks/share/lua/5.1/alewrap.lua' no file '/home/envy/.luarocks/share/lua/5.1/alewrap/init.lua' it seems rather than going into os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner/torch/bin

it is going to your torch folder in your home directory installation.

Did you modify ./run_cpu and ./run_gpu?

iostreamdoth commented 8 years ago

I do remember facing this issue. What I did was I modified ../torch/bin/qlua train_agent.lua $args to .qlua train_agent.lua $args. and on another instance I modified Installdependencies pwd variable.

andyyuan78 commented 8 years ago

it doesn't work .

envy@ub1404envy:~/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner$ ./run_gpu breakout -framework alewrap -game_path /home/envy/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner/roms/ -name DQN3_0_1_breakout_FULL_Y -env breakout -env_params useRGB=true -agent NeuralQLearner -agent_params lr=0.00025,ep=1,ep_end=0.1,ep_endt=replay_memory,discount=0.99,hist_len=4,learn_start=50000,replay_memory=1000000,update_freq=4,n_replay=1,network="convnet_atari3",preproc="net_downsample_2x_full_y",state_dim=7056,minibatch_size=32,rescale_r=1,ncols=1,bufferSize=512,valid_size=500,target_q=10000,clip_delta=1,min_reward=-1,max_reward=1 -steps 50000000 -eval_freq 250000 -eval_steps 125000 -prog_freq 10000 -save_freq 125000 -actrep 4 -gpu 0 -random_starts 30 -pool_frms type="max",size=2 -seed 1 -threads 4 ./run_gpu: line 46: ../torch/bin/.qlua: No such file or directory

envy@ub1404envy:~/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner$ git diff diff --git a/run_gpu b/run_gpu index bd1363a..59c50c0 100755 --- a/run_gpu +++ b/run_gpu @@ -43,4 +43,4 @@ args="-framework $FRAMEWORK -game_path $game_path -name $agent_name -env $ENV -e echo $args

cd dqn -../torch/bin/qlua train_agent.lua $args +../torch/bin/.qlua train_agent.lua $args envy@ub1404envy:~/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner$

andyyuan78 commented 8 years ago

-../torch/bin/qlua train_agent.lua $args +.qlua train_agent.lua $args

doesn;t work yet

iostreamdoth commented 8 years ago

I'm sorry. I don't know how that "." got in there your train agent file seems fine.

iostreamdoth commented 8 years ago

can you check if this exists. ~/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner/torch/lib/luarocks/rocks/alewrap

iostreamdoth commented 8 years ago

and if there are files in this ~/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner/torch/share/lua/5.1/alewrap

andyyuan78 commented 8 years ago

sure, seems all are fine

total 48 drwxrwxr-x 2 envy envy 4096 Feb 20 12:01 ./ drwxrwxr-x 28 envy envy 4096 Feb 20 12:01 ../ -rw-r--r-- 1 envy envy 4848 Feb 20 12:01 AleEnv.lua -rw-r--r-- 1 envy envy 2946 Feb 20 12:01 aleffi.lua -rw-r--r-- 1 envy envy 2851 Feb 20 12:01 alewrap.inl -rw-r--r-- 1 envy envy 3566 Feb 20 12:01 AtariLayer.lua -rw-r--r-- 1 envy envy 5265 Feb 20 12:01 GameEnvironment.lua -rw-r--r-- 1 envy envy 5027 Feb 20 12:01 GameScreen.lua -rw-r--r-- 1 envy envy 916 Feb 20 12:01 init.lua envy@ub1404envy:~/os_prj/github/_QA$ ll ~/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner/torch/lib/luarocks/rocks/alewrap total 12 drwxrwxr-x 3 envy envy 4096 Feb 20 12:01 ./ drwxrwxr-x 25 envy envy 4096 Feb 20 12:02 ../ drwxrwxr-x 3 envy envy 4096 Feb 20 12:01 0-0/ envy@ub1404envy:~/os_prj/github/_QA$ ll ~/os_prj/github/_deepmind/DeepMind-Atari-Deep-Q-Learner/torch/lib/luarocks/rocks/alewrap/0-0/ total 20 drwxrwxr-x 3 envy envy 4096 Feb 20 12:01 ./ drwxrwxr-x 3 envy envy 4096 Feb 20 12:01 ../ -rw-rw-r-- 1 envy envy 417 Feb 20 12:01 alewrap-0-0.rockspec drwxrwxr-x 2 envy envy 4096 Feb 20 12:01 doc/ -rw-rw-r-- 1 envy envy 781 Feb 20 12:01 rock_manifest envy@ub1404envy:~/os_prj/github/_QA$

taey16 commented 8 years ago

in my case, copied all of the dependency of torch files(i.e. /path/to/DeepMind-Atari-Deep-Q-Learner/torch/) into previously installed torch(i.e. ~/torch/install/) for example, cp -r /path/to/DeepMind-Atari-Deep-Q-Learner/torch/* ~/torch/install

andyyuan78 commented 8 years ago

great, it works, thank Taey16

baicaigithub commented 8 years ago

Thanks @taey16 for solving my issue! But I hope there is a long term fix for this.

murdo25 commented 7 years ago

THANKYOU @taey16 our whole lab's been having problems with that for months.. I can't believe we didn't try that.

yobibyte commented 7 years ago

I had this issue just now. This is because (for some reason) LUA_PATH and LUA_CPATH even without activation of the previous torch installation are set for the old one. Do unset LUA_PATH and unset LUA_CPATH and then run the code again.

Jiankai-Sun commented 6 years ago

The solution provided by @yobibyte also works. Thank you.

mkahn5 commented 6 years ago

I was able to get Deepmind running on Nvidia Tesla p100 gpus on ubuntu on Google Compute Engine with gcc and g++ 4.8. Big blocker for me was latest gcc and g++ (7.x) was not working with nvaa/torch. I installed torch manually and ran install_dependencies a few times before finding that latest gcc and g++ was incompatible with nvcc. After fixing gcc and g++ versions be sure to set alternatives. Make sure to copy dependencies if you install torch manually per @taey16 's comment above. Watch install_dependencies.sh and torch as it builds and look for any errors or failures if you are having issues with run_gpu.