Error while loading shared libraries: libreadline.so.5:
I'm trying to run the command sudo pip install --upgrade virtualenv, but I keep receiving the following error:
/opt/bitnami/python/bin/.python2.7.bin: error while loading shared libraries: libreadline.so.5: cannot open shared object file: No such file or directory
I've attempted to use the recommendation on this link [Bitnami - /opt/bitnami/python/bin/.python2.7.bin: error while loading shared libraries: libreadline.so.5](Bitnami - /opt/bitnami/python/bin/.python2.7.bin: error while loading shared libraries: libreadline.so.5 and no prevai), but it was not helpful.
Why do I receive the error?
I figured this out.
You have to be in the root level by issueing the sudo su command.
Now while in root level run the following command . /opt/bitnami/scripts/setenv.sh
I'm loggin into my server using SSH, apparently I have to follow the same steps every session.
installing virtualenv using pip installs it in bitnami stack hence to use virtualenv we need to execute setenv.sh shell script this script gives powers to virtualenv but we need to run it everytime so better to install virtualenv in root of the system using sudo apt-get
install virtualenv in root
sudo apt-get install python-virtualenv
So while maplesyrup's answer is good, I have found a solution that works better in practice.
Run sudo echo '. /opt/bitnami/scripts/setenv.sh' >> /opt/bitnami/.bitnamirc
This will append the script call in maplesyrup's answer, but then it will be called at every logon. The only downside is you have to enter your password immediately after logging in through ssh, but it is much better than having to manually call the script each time you login.
The required file is not in directory. usually this happened because the update which replaced the certain version of the file and with the newer version (e.g. libreadline.so.5 replaced by libreadline.so.8). to fix this, first you should check the library directory (/usr/lib) if a version version of the file is exist then you can create a link to that that file named with the file that is missing.
the following example is creating a link named with the missing file (libreadline.so.5) that linked to libreadline.so.8. but be CAREFULL because this might cause your terminal unable to get input if the certain libreadline.so.* is lost
cd /usr/lib ln -sf libreadline.so.8 -T libreadline.so.5
this solution works for me.