1

I'm trying to set up the environment of deepmind/dqn. I run ./install_dependencies.sh to install

LuaJIT and Torch 7.0
nngraph
Xitari
AleWrap

But I got:

/home/dqn/torch/bin/luajit: error while loading shared libraries: libreadline.so.7: cannot open shared object file: No such file or directory

=> Torch7 has been installed successfully

Installing nngraph ...
/home/dqn/torch/bin/luajit: error while loading shared libraries: libreadline.so.7: cannot open shared object file: No such file or directory
Error. Exiting.

The install_dependencies.sh is:

# Install dependencies for Torch:
sudo apt-get update
sudo apt-get install -qqy build-essential
sudo apt-get install -qqy gcc g++
sudo apt-get install -qqy cmake
sudo apt-get install -qqy curl
sudo apt-get install -qqy libreadline-dev
sudo apt-get install -qqy git-core
sudo apt-get install -qqy libjpeg-dev
sudo apt-get install -qqy libpng-dev
sudo apt-get install -qqy ncurses-dev
sudo apt-get install -qqy imagemagick
sudo apt-get install -qqy unzip
sudo apt-get update

echo "==> Torch7's dependencies have been installed"

# Build and install Torch7
cd /tmp
rm -rf luajit-rocks
git clone https://github.com/torch/luajit-rocks.git
cd luajit-rocks
mkdir -p build
cd build
git checkout master; git pull
rm -f CMakeCache.txt
cmake .. -DCMAKE_INSTALL_PREFIX=$PREFIX -DCMAKE_BUILD_TYPE=Release
RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi
make
RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi
make install
RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi


path_to_nvcc=$(which nvcc)
if [ -x "$path_to_nvcc" ]
then
cutorch=ok
cunn=ok
fi

# Install base packages:
$PREFIX/bin/luarocks install cwrap
$PREFIX/bin/luarocks install paths
$PREFIX/bin/luarocks install torch
$PREFIX/bin/luarocks install nn

[ -n "$cutorch" ] && \
($PREFIX/bin/luarocks install cutorch)
[ -n "$cunn" ] && \
($PREFIX/bin/luarocks install cunn)

$PREFIX/bin/luarocks install luafilesystem
$PREFIX/bin/luarocks install penlight
$PREFIX/bin/luarocks install sys
$PREFIX/bin/luarocks install xlua
$PREFIX/bin/luarocks install image
$PREFIX/bin/luarocks install env

echo ""
echo "=> Torch7 has been installed successfully"
echo ""


echo "Installing nngraph ... "
$PREFIX/bin/luarocks install nngraph
RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi
echo "nngraph installation completed"

echo "Installing Xitari ... "
cd /tmp
rm -rf xitari
git clone https://github.com/deepmind/xitari.git
cd xitari
$PREFIX/bin/luarocks make
RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi
echo "Xitari installation completed"

echo "Installing Alewrap ... "
cd /tmp
rm -rf alewrap
git clone https://github.com/deepmind/alewrap.git
cd alewrap
$PREFIX/bin/luarocks make
RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi
echo "Alewrap installation completed"

echo
echo "You can run experiments by executing: "
echo
echo " ./run_cpu game_name"
echo
echo " or "
echo
echo " ./run_gpu game_name"
echo
echo "For this you need to provide the rom files of the respective games (game_name.bin) in the roms/ directory"
echo

When I test the code ./run_gpu {game_name}, I got:

../torch/bin/luajit: error while loading shared libraries: libreadline.so.7: cannot open shared object file: No such file or directory

When I run:

ldconfig -p | grep readline

My version is 6

libreadline.so.6 (libc6,x86-64) => /lib/x86_64-linux-gnu/libreadline.so.6
libreadline.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libreadline.so
libguilereadline-v-18.so.18 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libguilereadline-v-18.so.18
libguilereadline-v-18.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libguilereadline-v-18.so

But I cannot install libreadline7:

sudo apt-get install libreadline7-dev

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libreadline7-dev

How could I install libreadline7??

1
  • 5
    What version of Ubuntu are you using? (7.0-5 is in libs, inc. -dev but it's recent..) – guiverc Sep 16 '18 at 3:38
1

The file you need, /lib/x86_64-linux-gnu/libreadline.so.7 is provided by the package libreadline7, not by any version of libreadline-dev. There's no such package as libreadline7-dev in any Ubuntu distribution.

Since you have libreadline.so.6 and its friends, you're probably using Ubuntu 16.04 or 14.04. The libreadline7 package is available in Ubuntu 18.04. So, the straightforward answer here is that you can get it by upgrading to or installing 18.04. To check, you'd then run

apt policy libreadline7

and if it's not installed, run

sudo apt update
sudo apt install libreadline7

There's a really dirty hack (not recommended, but not very dangerous) you could try if you just want to get past this step to see if you're going to hit another issue before you commit to upgrading, or you really can't upgrade right now. This is to make a symlink pointing to the older version of the library, so that the program thinks it's using libreadline.so.7 and is actually using libreadline.so.6:

sudo ln -s /lib/x86_64-linux-gnu/libreadline.so.6 /lib/x86_64-linux-gnu/libreadline.so.7

This might possibly make the program run. But it might also crash mysteriously without any meaningful error messages. If you leave the symlink like this, other programs you install from third party sources might also fail to report the missing dependency and crash mysteriously. You might forget what you did and wonder what is wrong with your silly system, so it's better only to try things like this for testing. You can always just delete the symlink libreadline.so.7 to get back where you started.

1

To resolve this dependency you need to manually install the mentioned package. Go to the Ubuntu store and search for the package.

https://packages.ubuntu.com/search?suite=default&section=all&arch=any&keywords=libreadline7&searchon=names

This will list the package information. Click on the hyperlink provided in the package description. In this case :

https://packages.ubuntu.com/bionic/libreadline7

Click on any link for your region. This will start download of the Debian file for the package.

Once you have got the Debian filem you simply have to install it using the dpkg command. For example:

sudo dpkg -i Desktop/libreadline7_7.0-3_amd64.deb

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.