0

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?

Community
  • 1
  • 1
maplesyrup
  • 61
  • 1
  • 1
  • 3
  • 1
    Do you have `libreadline.so.5` in the `LD_LIBRARY_PATH`? If you don't, but have `libreadline.so.5.2` or similar, you just need to run ldconfig. If your python is built on another system, it may be linked to library versions that you don't have. Try and rebuilding it on your own system. – Robert Jørgensgaard Engdahl Jul 25 '14 at 19:27
  • Before receiving your comment. I ran the command sudo apt-get install libreadline5 and now when issuing the same command sudo pip install --upgrade virtualenv I'm receiving the following error... ImportError: /opt/bitnami/python/lib/python2.7/lib-dynload/_ctypes.so: undefined symbol: PyUnicodeUCS2_FromEncodedObject – maplesyrup Jul 25 '14 at 20:56
  • That function is probably not defined in your system. Can't you just install virtualenv and python in a supported way, so that you don't need to deal with library versions and missing symbols? – Robert Jørgensgaard Engdahl Jul 25 '14 at 22:31

4 Answers4

3

I figured this out.

  1. You have to be in the root level by issueing the sudo su command.

  2. Now while in root level run the following command . /opt/bitnami/scripts/setenv.sh

  3. I'm loggin into my server using SSH, apparently I have to follow the same steps every session.

maplesyrup
  • 61
  • 1
  • 1
  • 3
0

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

Shubham Badal
  • 1,125
  • 13
  • 33
0

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.

Community
  • 1
  • 1
-1

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.

mol
  • 103
  • 4
  • 2
    This is an extremely dangerous approach to this problem. Identifying the dependency problem and addressing it by updating your python install should clear the issue. Be advised that you'll be creating a bigger problem here than you'll be solving. – Chris Larson Jan 27 '19 at 08:55
  • Oh, don't do that, seriously. I can't update my computer anymore. Great. – BuddhiLW Nov 22 '21 at 20:18