nagadomi / waifu2x

Image Super-Resolution for Anime-Style Art
http://waifu2x.udp.jp/
MIT License
27.33k stars 2.71k forks source link

install_lua_modules.sh is failing, not recognizing torch #404

Open fedorzajac opened 3 years ago

fedorzajac commented 3 years ago

i have torch installed: ` $ th

__ | Torch7 / / ____/ / | Scientific computing for Lua. / / / \/ / / \ | Type ? for help // _// _//// | https://github.com/torch | http://torch.ch

th> `

but when I try to install_lua_modules.sh, torch is not recognized, can somebody help me out pls?

` bash install_lua_modules.sh

=> bash install_lua_modules.sh

Error: No results matching query were found. Installing https://luarocks.org/lua-csnappy-0.1.5-2.src.rock gcc -O2 -fPIC -I/usr/include/lua5.1 -c lsnappy.c -o lsnappy.o gcc -shared -o snappy.so -L/usr/local/lib lsnappy.o lua-csnappy 0.1.5-2 is now installed in /usr/local (license: BSD)

Installing https://luarocks.org/md5-1.3-1.rockspec gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/compat-5.2.c -o src/compat-5.2.o -Isrc/ gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/md5.c -o src/md5.o -Isrc/ gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/md5lib.c -o src/md5lib.o -Isrc/ gcc -shared -o md5/core.so -L/usr/local/lib src/compat-5.2.o src/md5.o src/md5lib.o gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/compat-5.2.c -o src/compat-5.2.o -Isrc/ gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/des56.c -o src/des56.o -Isrc/ gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/ldes56.c -o src/ldes56.o -Isrc/ gcc -shared -o des56.so -L/usr/local/lib src/compat-5.2.o src/des56.o src/ldes56.o md5 1.3-1 is now installed in /usr/local (license: MIT/X11)

Installing https://luarocks.org/uuid-0.2-1.src.rock uuid 0.2-1 is now installed in /usr/local (license: Apache 2.0)

Error: No results matching query were found. Cloning into '.cudnn'... remote: Enumerating objects: 2074, done. remote: Total 2074 (delta 0), reused 0 (delta 0), pack-reused 2074 Receiving objects: 100% (2074/2074), 801.49 KiB | 1.90 MiB/s, done. Resolving deltas: 100% (1351/1351), done. Missing dependencies for cudnn scm-1: torch >= 7.0 (not installed) cutorch (not installed) nn (not installed)

cudnn scm-1 depends on torch >= 7.0 (not installed)

Error: Could not satisfy dependency torch >= 7.0: No results matching query were found. Installing https://luarocks.org/turbo-2.1-2.rockspec Cloning into 'turbo'... remote: Enumerating objects: 176, done. remote: Counting objects: 100% (176/176), done. remote: Compressing objects: 100% (154/154), done. remote: Total 176 (delta 34), reused 67 (delta 19), pack-reused 0 Receiving objects: 100% (176/176), 654.55 KiB | 1.37 MiB/s, done. Resolving deltas: 100% (34/34), done. Note: checking out '3b773d61a584a614ea1f854a2326e94c1212899a'.

You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example:

git checkout -b

Warning: variable CFLAGS was not passed in build_variables make -C deps/http-parser library make[1]: Entering directory '/tmp/luarocks_turbo-2.1-2-hicoxP/turbo/deps/http-parser' gcc -I. -fPIC -DHTTP_PARSER_STRICT=0 -O3 -Wall -Wextra -c http_parser.c -o libhttp_parser.o gcc -shared -Wl,-soname=libhttp_parser.so.2.1 -o libhttp_parser.so.2.1 libhttp_parser.o make[1]: Leaving directory '/tmp/luarocks_turbo-2.1-2-hicoxP/turbo/deps/http-parser' gcc -Ideps/http-parser/ -shared -O3 -Wall -g -fPIC deps/http-parser/libhttp_parser.o deps/turbo_ffi_wrap.c -o libtffi_wrap.so -lcrypto -lssl ==== Installing Turbo.lua v2.1.0 to: ==== ==== /home/fedor/torch/install/lib/lua/5.1 and ==== ==== /home/fedor/torch/install/share/luajit-2.0.4 ==== mkdir -p /home/fedor/torch/install/lib mkdir -p /home/fedor/torch/install/bin mkdir -p /home/fedor/torch/install/share/lua/5.1/turbo mkdir -p /home/fedor/torch/install/share/luajit-2.0.4/turbo cp -r turbo/ /home/fedor/torch/install/share/lua/5.1/turbo cp -r turbo.lua /home/fedor/torch/install/share/lua/5.1 cp -r turbovisor.lua /home/fedor/torch/install/share/lua/5.1 cp -r turbo/ /home/fedor/torch/install/share/luajit-2.0.4/turbo cp -r turbo.lua /home/fedor/torch/install/share/luajit-2.0.4 cp -r turbovisor.lua /home/fedor/torch/install/share/luajit-2.0.4 install -m 0755 bin/turbovisor /home/fedor/torch/install/bin ==== Building 3rdparty modules ==== make -C deps/http-parser library make[1]: Entering directory '/tmp/luarocks_turbo-2.1-2-hicoxP/turbo/deps/http-parser' gcc -shared -Wl,-soname=libhttp_parser.so.2.1 -o libhttp_parser.so.2.1 libhttp_parser.o make[1]: Leaving directory '/tmp/luarocks_turbo-2.1-2-hicoxP/turbo/deps/http-parser' gcc -Ideps/http-parser/ -shared -O3 -Wall -g -fPIC deps/http-parser/libhttp_parser.o deps/turbo_ffi_wrap.c -o libtffi_wrap.so -lcrypto -lssl ==== Installing libtffi_wrap ==== test -f libtffi_wrap.so && \ install -m 0755 libtffi_wrap.so /home/fedor/torch/install/lib/libtffi_wrap.so.2.1.0 && \ ldconfig -n /home/fedor/torch/install/lib && \ ln -sf libtffi_wrap.so.2.1.0 /home/fedor/torch/install/lib/libtffi_wrap.so ==== Successfully installed Turbo.lua 2.1.0 to /home/fedor/torch/install ==== turbo 2.1-2 is now installed in /usr/local (license: Apache 2.0)

` I am using jetson nano B01 with original ubuntu 18.04 image. Thank you for help!

nagadomi commented 3 years ago

-I/usr/include/lua5.1 now installed in /usr/local

Try which luarocks command.

% which luarocks
/home/nagadomi/torch/install/bin/luarocks

If the luarocks command is in /usr/bin or /usr/local/bin, you have run a different command than the one installed by the torch installer. Torch has its own lua environment(~/torch/install) and does not use the system lua and luarocks commands.

The torch installer will add the following command to your .bashrc to set the environment variables.

. /home/fedor/torch/install/bin/torch-activate

If this line is missing, you need to add it and then run source ~/.bashrc. https://github.com/nagadomi/waifu2x/issues/253#issuecomment-497631624

As an additional note, there are reports that turbo (web interface) does not work on Linux with Jetson nano. #307

fedorzajac commented 3 years ago

Thank you, which luarocks returns home/fedor/Desktop/torch/install/bin/luarocks

I have /home/fedor/torch/install/bin/torch-activate in my bashrc file and i have restarted pc after it was added by torch.

as per web interface, working script is enough for me.

Maybe I am missing some linkage, but I have never used torch nor lua.

nagadomi commented 3 years ago

home/fedor/Desktop/torch/install/bin/luarocks /home/fedor/torch/install/bin/torch-activate

It seems that the path Desktop is missing. Unless this is a copy-and-paste mistake, there may be a problem if you install torch in a location other than ~/torch/. (I've never tried this before)

fedorzajac commented 3 years ago

Thank you, I will try to mv torch into ~ and repeat instalation process.

fedorzajac commented 3 years ago

So I have reinstall torch and waifu repository and now:

`$ luarocks

LuaRocks 2.3.0, a module deployment system for Lua ... `

which luarocks /home/fedor/torch/install/bin/luarocks

` luarocks install graphicsmagick --local mkdir: cannot create directory ‘/home/fedor/.cache/luarocks/https_raw.githubusercontent.com_torch_rocksmaster’: Permission denied mkdir: cannot create directory ‘/home/fedor/.cache/luarocks/httpsraw.githubusercontent.com_torch_rocks_master’: Permission denied mkdir: cannot create directory ‘/home/fedor/.cache/luarocks/https_raw.githubusercontent.com_torch_rocksmaster’: Permission denied Warning: Failed searching manifest: Failed creating temporary cache directory /home/fedor/.cache/luarocks/httpsraw.githubusercontent.com_torch_rocks_master mkdir: cannot create directory ‘/home/fedor/.cache/luarocks/https_raw.githubusercontent.com_rocks-moonscript-org_moonrocks-mirrormaster’: Permission denied mkdir: cannot create directory ‘/home/fedor/.cache/luarocks/httpsraw.githubusercontent.com_rocks-moonscript-org_moonrocks-mirror_master’: Permission denied mkdir: cannot create directory ‘/home/fedor/.cache/luarocks/https_raw.githubusercontent.com_rocks-moonscript-org_moonrocks-mirrormaster’: Permission denied Warning: Failed searching manifest: Failed creating temporary cache directory /home/fedor/.cache/luarocks/httpsraw.githubusercontent.com_rocks-moonscript-org_moonrocks-mirror_master

Error: No results matching query were found. `

and with sudo:

sudo luarocks install graphicsmagick --local sudo: luarocks: command not found

I am lost >__>

nagadomi commented 3 years ago

libgraphicsmagick is reuiqred.

sudo apt-get install libgraphicsmagick1-dev

Edit:

gm (GraphicsMagick) binary not found, please install (see www.graphicsmagick.org)

This message can be suppressed by installing graphicsmagick commands.

sudo apt-get install graphicsmagick
nagadomi commented 3 years ago
cuda runtime error (701) : too many resources requeste

Maybe -force_cudnn 1 option is required for Jetson Nano.

waifu2x runs out of memory on this device without using cuDNN. I'm not too concern about this as long as it works using cuDNN. From #307

or use small crop_size -crop_size 128.

fedorzajac commented 3 years ago

thank you very much for help, in the end I end up following this tutorial: https://qiita.com/dona0712/items/b1b55686f580fc6f4173

simple benchmark: for 700 x 500 picture it takes about 20s on jetson nano.

nagadomi commented 3 years ago

Note that waifu2x-converter-cpp only supports the early, older model (2015 ver).