1

The linux server is not connected to the network. I need use the serve to train my deep learning model. So, I installed Anaconda to manage the environment. I have created a empty environment Example. I have installed offline Python 3.6.7 into Example (The Linux server had Python 3.8.8). My problem is: when I use "python setup.py install" to install setuptool in “setuptools-57.0.0" folder,an error occurred: ImportError: libffi.so.6: cannot open shared object file: No such file or directory

So, what should I do? Do I need to updata Python? What should I do without upgrading Python? Thank you very much!

hkzhang
  • 11
  • 1
  • 4
  • I'm sorry, the Linux server had Python 3.8.5, base environment had Python 3.8.8, Example environment had Python 3.6.7. – hkzhang Jun 25 '21 at 08:30
  • I have upgraded python 3.6.7 to 3.8.5, but it didn't work. The same error occurred. – hkzhang Jun 25 '21 at 09:04
  • You can download libffi6 from e.g. https://packages.ubuntu.com/bionic/libffi6 – Knud Larsen Jun 25 '21 at 11:49
  • Does this answer your question? [Ubuntu 20.04 upgrade, Python missing libffi.so.6](https://stackoverflow.com/questions/61875869/ubuntu-20-04-upgrade-python-missing-libffi-so-6) – Osvald Laurits Nov 23 '21 at 11:42
  • Add your Python home directory (3.6.7 ?) to `LD_LIBRARY_PATH` so it can find your .so files. – Amit Naidu Jan 25 '22 at 23:23
  • libffi can be installed via conda and pip as well. See https://github.com/libffi/libffi for the proper version to install. – roshambo Nov 21 '22 at 22:25

2 Answers2

3

Follow this link it worked for me.

find /usr/lib -name "libffi.so*"
#== output 
/usr/lib -name "libffi.so*"
/usr/lib/i386-linux-gnu/libffi.so.7
/usr/lib/i386-linux-gnu/libffi.so.7.1.0
/usr/lib/x86_64-linux-gnu/libffi.so
/usr/lib/x86_64-linux-gnu/libffi.so.7
/usr/lib/x86_64-linux-gnu/libffi.so.6
/usr/lib/x86_64-linux-gnu/libffi.so.7.1.0

  • The above command will give you paths just copylibffi.so.7 path and use in below cammad.

  • create simlink

sudo ln -s /usr/lib/x86_64-linux-gnu/libffi.so.7 /usr/lib/x86_64-linux-gnu/libffi.so.6
Farid
  • 72
  • 10
1

I had the same error after updating conda. conda would not install a package:

(myEnv) $ conda install requests
Traceback (most recent call last):
   File "/home/me/miniconda2/bin/conda", line 13, in <module>
...
ImportError: libffi.so.6: cannot open shared object file: No such file or directory

I have found libffi.so.6 in packages in miniconda and created a symlink:

cd ~/miniconda2/lib
# this would list all libffi and no libffi.so.6 there
ls -lsah libffi*
# there might be different libffi versions, you can delete a link if not working
# I had libffi.so.6 in this folder
ls ../pkgs/libffi-3.3-he6710b0_2/lib/
# created a symlink
ln -s ../pkgs/libffi-3.3-he6710b0_2/lib/libffi.so.6 libffi.so.6
# or you could try creating symlink from libffi.so.7.1.0, both libffi.so.7 and libffi.so.6 were symlinks to it
ln -s ../pkgs/libffi-3.3-he6710b0_2/lib/libffi.so.7.1.0 libffi.so.6

Now ~/miniconda2/lib has libffi.so.6 and install worked.

If there was libffi.so.7.1.0 in ~/miniconda2/lib you could try creating symlink to it, I did not have it.

Vladislav Povorozniuc
  • 2,149
  • 25
  • 26