microsoft / vscode-postgresql

PostgreSQL extension for VSCODE
Other
392 stars 50 forks source link

ImportError: libffi.so.6 #77

Closed j-ibarra closed 2 years ago

j-ibarra commented 4 years ago

Steps to Reproduce:

  1. Install ext
  2. Ctrl + Shift + P
  3. PostgreSQL: New Query

the ouput is

Initializing PostgreSQL tools service for the PostgreSQL extension.
Note: PostgreSQL commands will be available after installing the service.

Platform-------------: linux, x86_64, name=ubuntu, version=20.04 (Ubuntu16)

Installing PostgreSQL tools service to /home/jibarra/.vscode/extensions/ms-ossdata.vscode-postgresql-0.3.0/pgsqltoolsservice/v1.4.0/Ubuntu16.
Downloading https://github.com/Microsoft/pgtoolsservice/releases/download/v1.4.0/pgsqltoolsservice-linux-x64.tar.gz
(21369 KB) ...
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/cx_Freeze/initscripts/__startup__.py", line 14, in run
  File "/usr/local/lib/python3.6/dist-packages/cx_Freeze/initscripts/Console.py", line 26, in run
  File "pgsqltoolsservice/pgtoolsservice_main.py", line 11, in <module>
  File "/usr/local/lib/python3.6/dist-packages/ptvsd/__init__.py", line 17, in <module>
  File "/usr/local/lib/python3.6/dist-packages/ptvsd/attach_server.py", line 35, in <module>
  File "/usr/local/lib/python3.6/dist-packages/ptvsd/visualstudio_py_debugger.py", line 24, in <module>
  File "/usr/lib/python3.6/ctypes/__init__.py", line 7, in <module>
ImportError: libffi.so.6: cannot open shared object file: No such file or directory
[Error - 9:52:03 p. m.] Connection to server got closed. Server will not be restarted.

I tried this

sudo dpkg -S libffi.so

libffi7:amd64: /usr/lib/x86_64-linux-gnu/libffi.so.7.1.0
libffi7:amd64: /usr/lib/x86_64-linux-gnu/libffi.so.7

sudo ln /usr/lib/x86_64-linux-gnu/libffi.so.7 /usr/lib/x86_64-linux-gnu/libffi.so.6

reboot, this solve the problem but not its the best solution

a-mckinley commented 4 years ago

This problem also exists on Arch Linux with an identical error message.

paxet commented 4 years ago

It also happens in Void Linux

jhanschoo commented 4 years ago

@J-Ibarra a better workaround is to install the libffi6 package from eoan.

flowHater commented 3 years ago

@J-Ibarra You got libffi.so.7. That extension expect libffi.so.6 On my Archlinux, get fixed by installing libffi6 from AUR.

highpost commented 3 years ago

I'm getting the same problem on Ubuntu 20.04. It's interesting that I'm running VS Code with a virtualenv, yet this is trying to find a system Python version that isn't even installed. This looks for Python 3.6 and my Ubuntu 20.04 has Python 3.8 installed. And my virtualenv is based on Python 3.8.5 built from source.

talentlessguy commented 3 years ago

Happens on Manjaro Linux as well, even though I have it installed:

local/lib32-libffi 3.3-2
    A portable, high level programming interface to various calling conventions (32-bit)
local/libffi 3.3-3
    Portable foreign function interface library
Forrin commented 3 years ago

This package is missing from your machine, but used to be installed on prior versions of Ubuntu.

You do not want to use a symbolic link here. Who knows what sort of instability that may cause.

You can download and install that package using these commands.

wget http://mirrors.kernel.org/ubuntu/pool/main/libf/libffi/libffi6_3.2.1-8_amd64.deb
sudo apt install ./libffi6_3.2.1-8_amd64.deb
RaphaelSilv commented 3 years ago

Anyone facing the same on openSUSE Tumbleweed? Couldn't find any provider.

RaphaelSilv commented 3 years ago

Anyone facing the same on opensSUSE Tumbleweed? Couldn't find any provider.

Found it.

and done:

sudo zypper se -i libffi                                                                                                                                           
Loading repository data...
Reading installed packages...

S  | Name    | Summary                            | Type
---+---------+------------------------------------+--------
i+ | libffi6 | Shared library for libffi          | package
i+ | libffi8 | Foreign Function Interface Library | package

YMMV.

Kilavagora commented 3 years ago

For lazy and more risk tolerant people:

cd ~/.vscode/extensions/ms-ossdata.vscode-postgresql-0.3.0/pgsqltoolsservice/v1.4.0/Ubuntu16/pgsqltoolsservice/lib/python3.6/
cp /usr/lib64/python3.6/lib-dynload/_ctypes.cpython-36m-x86_64-linux-gnu.so .

this worked for me on openSUSE Leap 15.2.

brylie commented 3 years ago

On Ubuntu 20.10, run the following command and then restart VS Code:

sudo apt install libffi6
jwarkentin commented 3 years ago

On Ubuntu 20.10, run the following command and then restart VS Code:

sudo apt install libffi6

@brylie You must have a PPA that provides it. I'm running 20.10 and it can't find the package.

brylie commented 3 years ago

@jwarkentin here are the details of the libffi6 package on my Ubuntu 20.10 installation:

$ sudo apt info libffi6
Package: libffi6
Version: 0~3.2.1-8
Priority: optional
Section: libs
Source: libffi
Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org>
Installed-Size: 53,2 kB
Depends: libc6 (>= 2.14)
Download-Size: 20,6 kB
APT-Manual-Installed: yes
APT-Sources: http://ppa.launchpad.net/kxstudio-debian/libs/ubuntu bionic/main amd64 Packages
Description: Foreign Function Interface library runtime
 A foreign function interface is the popular name for the interface that
 allows code written in one language to call code written in another
 language.

So yeah, it looks like it is in the KXStudio PPA (which is really good if you're into music production.)

valerio-oliveira commented 2 years ago

This package is missing from your machine, but used to be installed on prior versions of Ubuntu.

You do not want to use a symbolic link here. Who knows what sort of instability that may cause.

You can download and install that package using these commands.

wget http://mirrors.kernel.org/ubuntu/pool/main/libf/libffi/libffi6_3.2.1-8_amd64.deb
sudo apt install ./libffi6_3.2.1-8_amd64.deb

It worked for my Mint 20.2! Cheers mate!