microsoft / vscode-postgresql

PostgreSQL extension for VSCODE
Other
392 stars 50 forks source link

PostgreSQL: PostgreSQL Tools Service component could not start. #83

Closed HideyoshiNakazone closed 3 years ago

HideyoshiNakazone commented 3 years ago

Steps to Reproduce:

  1. Installing PostgreSQL
  2. VS Code returns a error

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 File "/usr/local/lib/python3.6/dist-packages/ptvsd/init.py", line 17, in File "/usr/local/lib/python3.6/dist-packages/ptvsd/attach_server.py", line 35, in File "/usr/local/lib/python3.6/dist-packages/ptvsd/visualstudio_py_debugger.py", line 24, in File "/usr/lib/python3.6/ctypes/init.py", line 7, in ImportError: libffi.so.6: cannot open shared object file: No such file or directory [Error - 2:27:29 PM] Connection to server got closed. Server will not be restarted.

AsterixMechant commented 3 years ago

I am having this exact same issue, too. Here's some details about my running environment:

I am not an expert or anything, but it seems to me that the problem is with the installed version of Python. The extension seems to rely on some package from Python 3.6, whereas Ubuntu 20.04 ships with Python 3.8.

I wonder how this issue could be addressed for Focal Fossa users? Shoud we downgrade our Python version? I'm afraid this would break something on Ubuntu though. Can someone please point me on some good direction?

Cheers!

AsterixMechant commented 3 years ago

So, I did some more digging, and here's what I've found:

So apparently, there's nothing one could do about this right now, but either switch back to Ubuntu 18.04 or sit back and hope that the dev team will upgrade the dependency on Python to version 3.8.

Or, alternatively - but I strongly recommend NOT doing so, even though it seems to work - you can work around it like this:

Install Python 3.6 (you don't need to unisntall the current version, you can have multiple versions alongside). You can use deadsnakes' PPA for that. Up to this point, nothing too messy.

Then (and this is the messed up part), follow the instructions in the accepted answer on this discussion, to symlink your libffi dependency to libffi7, tricking your Python runtime to think it is using the correct library version. However, it is hard to predict what kinds of other issues this could cause. I wouldn't really recommend doing so, so do it at your own risk!

HideyoshiNakazone commented 3 years ago

Technically i could just downgrade my Debian package of python because i mainly use Anaconda Python for my works. Thanks a lot for the response!

chintanp commented 3 years ago

This solution of manually install libffi.so.6 worked for me on Ubuntu 20.04. It is hacky (as it is not suggested to manually install packages in Ubuntu), it seems the least hackiest so far. I also did not need Python 3.6. Though, I have not tested this extension yet to know how well it works.

Apreche commented 2 years ago

Chiming in two years later here. I just want to say that this is still a problem. Indeed, manually installing the deb package for libffi6 appears to have fixed the issue. However, I don't consider that to be a real solution worthy of marking this as closed. This is going to affect all future Ubuntu/WSL versions. I guess there just aren't that many people using the VSCode Postgres extension with that specific combination?

sepsol commented 2 years ago

Same here. I ran the following to install libffi.so.6 and was able to fix it as originally mentioned here:

curl -LO http://archive.ubuntu.com/ubuntu/pool/main/libf/libffi/libffi6_3.2.1-8_amd64.deb
sudo apt install ./libffi6_3.2.1-8_amd64.deb