Jump to content
J. Robroeks

Getting started with Ubuntu 18.04. Error Could not open DLL

Recommended Posts



I'm trying to get started with the python4delphi with Ubuntu 18.04 on Subsytem for Windows. But I always receive the error:

Could not open DLL "libpython3.3m.so". 


What I've tried so far:

  1. Downloaded the packages via Git on 26-2 
  2. Installation did trow errors of unavailable packages. I finally build the non-dcl projects again and installed the dcl as 'Explicit rebuild'. (I don't know whether it had something to do with the $(auto).bpl suffix).
  3. Building and Running Demo project files for 32 bits Windows. (works)
  4. Building and deploying for 64 bit Linux (works)
  5. Installing Python 3.8 via get-apt and tested it via CLI (works)
  6. Running Python commands in Ubuntu after installation via get-apt (works)
  7. Changing the standard python verison on ubuntu to 3. (works, even though this is not recommended)
  8. Located the .so file via locate libpython3. Changed the PythonEnging paths and DLL's accordingly. (no succes)
    1. Result:
      1. /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1
      2. /usr/lib/x86_64-linux-gnu/libpython3.6m.so.1.0
      3. /usr/lib/config-3.6m-x86_64-linux-gnu/libpython3.6.so
      4. /usr/lib/config-3.6m-x86_64-linux-gnu/libpython3.6m.so
      5. I don't know why the 3.8 .so files are not found. 
  9. Searching for Linux examples, but only found one for Lazarus. But I think I've overlooked something here. (I tried the source, bit without luck)
  10. I've changed the DLL name to several different versions. libpython3.8m.so, libpython3.8.so and even older 2.7 versions.  (No luck)
  11. Played with several PythonEngine settings, such as uselastknownversion, redirect IO, Autoload etc. Changing dllpaths. (No luck)


The project file so far as Console application:

    PythonEngine1:= TPythonEngine.Create(nil);
    PythonInOut  := TPythonInputOutput.Create(nil);
      PythonEngine1.IO := PythonInOut;

      PythonEngine1.DllName := 'libpython3.6m.so';
      PythonEngine1.AutoLoad := true;

      PythonEngine1.DllPath := '/usr/lib/x86_64-linux-gnu/';
      PythonEngine1.AutoFinalize := true;
      PythonEngine1.AutoLoad     := true;
      PythonEngine1.AutoUnload   := true;
      PythonEngine1.RedirectIO   := true;
      PythonEngine1.UseLastKnownVersion := true; 
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);


Is there anyone who knows what I'm doing wrong here? Is it probably my Delphi environment, or Ubunut?



Kind regards,







Share this post

Link to post

If UseLastKnownVersion is True, then try installing also libpython3.X-dev package. Or set UseLastKnownVersion to false and assign DllPath and DllName

Share this post

Link to post

working also on this  topic,  and need to find out how  get the correct settings on different UNIX system, 

I started from your code and did this code now : 


Share this post

Link to post
Posted (edited)
On 3/1/2021 at 9:18 AM, J. Robroeks said:

Installation did throw errors of unavailable packages

The installations issues are probably due to the fact that you are using Delphi 10.4 (is this the case?).   Please upgrade to Delphi 10.4.1 or better to 10.4.2

Edited by pyscripter

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now