DelphiFMX4Python
DelphiFMX4Python copied to clipboard
Linux issues
Ubuntu 20.04 Python 3.8
from delphifmx import *
Causes: Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
Python app created with Delphi runs properly so dependencies should be installed.
Is it like the error when you run a Python program? Or whether you ran this line on the REPL and came across this?
Just calling "from delphifmx import *" frim the python command prompt!
I couldn't reproduce the same issue with Python 3.9. Will check a 3.8 env and get back to you..
Still couldn't reproduce the issue using Python 3.8. Hey @cosina , could you please give some more details? screenshots, more system info and all..
Hi,
- Use Hyper-V (Win11)
- "Quick Create" Ubuntu 20.04 LTS
- Python 3.8 is already there
- sudo apt install python3.8-venv
- Install Linux dependencies according to (https://docwiki.embarcadero.com/RADStudio/Sydney/en/FireMonkey_for_Linux)
- PIP delphifmx
- open Python prompt and execute "from delphifmx import *"
- SIGSEG errors is raised
I tested the same scenario on 22.04 and built-in pyton3.10 and everything works as expected.
In general, the SIGSEGV is a segmentation fault error that is related to memory mapping. I think this is not related to the Ubuntu or Python version. Something broke in any of the installation processes, which might've raised this issue. The second time you might have successfully installed everything without breaking anything unknowingly which made the import work sccessfully.
I think we can close the issue if you're not facing the issue anymore..
On my side problem is persistent on any version other then Ubuntu 22 After some trace messages i found that .pyd crashes as soon as it reach timeModule := PyImport_ImportModule('time'); line.
Oh then, it's a matter of concern. We shall try to emulate the issue and look for the reason and shall try a fix for it..
Python distributed by APT is not compatible with DelphiFMX. Python must provide interpreter's symbols somehow.
There are some discussions across this issue: https://github.com/Embarcadero/DelphiFMX4Python/issues/20 https://github.com/Embarcadero/DelphiFMX4Python/discussions/22
Let me know if it applies to you.
Python distributed by APT is not compatible with DelphiFMX. Python must provide interpreter's symbols somehow.
There are some discussions across this issue: #20 #22
Let me know if it applies to you.
Segfault happens with miniconda installed python under linux, Happens at least with python versions 3.7, 3.9 & 3.10 (the only versions I tried).
To reproduce:
(bash) conda create -n delphitest python=3.10 conda activate delphitest pip install delphifmx python
from delphifmx install * (segfault)
This is a showstopper. If I have to install a particular version of python in a particular way (using the script? Really? In 2023??), I don't see how this will be of general utility.
I ran it fine under windows btw, so there isn't anything fundamentally wrong with the library.
I even tried to emulate the installation directories as created by the install scripts and symlink the anaconda python binaries but I didn't get very far with that.
This was all attempted on 15 March 2023; I assume the pip install step installs the latest stable version.
This is all running under Pop_OS! 22.04; I'm wondering if it's an issue with the supplied libDelphiFMX.so shared lib and my system?
This is all running under Pop_OS! 22.04; I'm wondering if it's an issue with the supplied libDelphiFMX.so shared lib and my system?
I just installed a Fedora 37 machine, and tried delphifmx in a venv using the default python shipped with that system (3.11) - it doesn't segfault, so it seems there is a specific issue with the python shipped with Pop_OS!, which is the same as the python installed by ubuntu I believe.
The Python C API symbols are not exposed by the APT Python compilation. The DelphiFMX extension module requires Python to statically or dynamically link the interpreter library.
This is all running under Pop_OS! 22.04; I'm wondering if it's an issue with the supplied libDelphiFMX.so shared lib and my system?
I just installed a Fedora 37 machine, and tried delphifmx in a venv using the default python shipped with that system (3.11) - it doesn't segfault, so it seems there is a specific issue with the python shipped with Pop_OS!, which is the same as the python installed by ubuntu I believe.
@mvdw73 , By the way, we support conda Python environments. The Screenshots that you can see here: https://github.com/Embarcadero/DelphiFMX4Python/issues/40#issuecomment-1225513388 is a conda environment under PureOS. If you're running using conda environment manager, I think it shouldn't matter the OS you're running. Maybe you tried an APT-based Python installation under Pop_OS. Either it's Fedora or Pop_OS miniconda installs Python from its conda-forge repo, which is a CPython distribution, and we support that. Not sure what's wrong. Please post some screenshots of where it's gone wrong to recheck once.
Try the following command to make Python with shared libraries:
apt-get update apt-get install -y build-essential openssl openssl-dev* wget curl wget https://www.python.org/ftp/python/3.10.3/Python-3.10.3.tgz tar -xvf Python-3.10.3.tgz cd Python-3.10.3 ./configure --enable-shared make make test make install
You can choose whatever version you want.
Hi all,
we have a release candidate fixing this issue. Download it directly from test.pypi:
pip install -i https://test.pypi.org/simple/ delphifmx==1.0.6
This is all running under Pop_OS! 22.04; I'm wondering if it's an issue with the supplied libDelphiFMX.so shared lib and my system?
I just installed a Fedora 37 machine, and tried delphifmx in a venv using the default python shipped with that system (3.11) - it doesn't segfault, so it seems there is a specific issue with the python shipped with Pop_OS!, which is the same as the python installed by ubuntu I believe.
@mvdw73 , By the way, we support conda Python environments. The Screenshots that you can see here: #40 (comment) is a conda environment under PureOS. If you're running using conda environment manager, I think it shouldn't matter the OS you're running. Maybe you tried an APT-based Python installation under Pop_OS. Either it's Fedora or Pop_OS miniconda installs Python from its conda-forge repo, which is a CPython distribution, and we support that. Not sure what's wrong. Please post some screenshots of where it's gone wrong to recheck once.
I'm also not sure what went wrong, but it seems to be fixed now (inexplicibly)
I had run it on my Pop OS laptop, with the aforementioned segfault. The segfault happened whether I was running the system python or any conda installed python version (I tried 3.7, 3.9, 3.10 and 3.11 IIRC).
Then I decided for unrelated reasons to install fedora on the computer, and knowing that fedora worked tried it with success.
Then, I didn't like fedora as much as I thought I had, and reinstalled Pop with the latest ISO image.
Finally, under Pop OS (latest as of March 2023), I made a venv for delphifmx using the native venv tool, and installed delphifmx from the pypi repository, and it worked!
TL;DR: Pop OS used to not work for some reason, but now it does. Not sure if it's been fixed at the delphi end or at the Pop OS end, but something has changed to make it all good.
Did you install using just pip install delphifmx
or the above-mentioned pip install -i https://test.pypi.org/simple/ delphifmx==1.0.6
? Can you check the pip list
and see what delphifmx
version you have and say?
The same issue in Debian 11.2 with python 3.9.2.
The error with pip install delphifmx
looks like:
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from delphifmx import *
double free or corruption (out)
The error after pip install -i https://test.pypi.org/simple/ delphifmx==1.0.6
is:
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from delphifmx import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ashtokalo/.local/lib/python3.9/site-packages/delphifmx/__init__.py", line 83, in <module>
package = new_import()
File "/home/ashtokalo/.local/lib/python3.9/site-packages/delphifmx/__init__.py", line 76, in new_import
ld = loader.create_module(spec)
ImportError: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /home/ashtokalo/.local/lib/python3.9/site-packages/delphifmx/Linux64/libDelphiFMX.so)
Hi @ashtokalo , we mistakenly compiled the Python package for Linux on Ubuntu 22.04. We shall compile it on Ubuntu 20.04 and will update it here.
Hi Priyatham:
I have several linux machines running various distributions, and can report the following:
1. Pop_OS 22.04 (old, existing installation).
Using Anaconda/miniconda python, the following sequence of commands causes the segfault issue:
conda create -n delphi python=3.10
conda activate delphi
pip install delphifmx
python ./hello.py
==> Segfaults with
double free or corruption (out)
Aborted (core dumped)
2. Pop OS 22.04 (old installation)
Using Anaconda/miniconda python, the following sequence of commands is successful:
conda create -n delphi python=3.10
conda activate delphi
pip install -i https://test.pypi.org/simple/ delphifmx==1.0.6
python ./hello.py
==> Success!
3. Pop OS 22.04 (old installation)
Using Built-in (so-called APT) python, the following sequence of commands is successful:
python -m venv create ~/.venv/delphi
source ~/.venv/delphi/bin/activate
pip install delphifmx
python ./hello.py
==> Success!
4. Pop OS 22.04 (Brand new installation)
Using Built-in (so-called APT) Python, and virtual environments:
python -m venv create ~/.venv/delphi
source ~/.vene/delphi/bin/activate
pip install delphifmx
python ./hello.py
==> Success
5. Fedora 37
Using Built-in Python, and virtual environments:
python -m venv create ~/.venv/delphi
source ~/.vene/delphi/bin/activate
pip install delphifmx
python ./hello.py
==> Success
6. Ubuntu 22.04 (Live iso version)
Using Built-in (so-called APT) Python:
sudo add-apt-repository universe
sudo apt update && sudo apt install python3-pip
pip3 install delphifmx
python3 ./hello.py
==> Success!!
Conclusions
- Under Pop_OS, the default apt-based python will work with 1.0.5
- Under Ubuntu 22.04, the default apt-based python will work with 1.0.5
- Under Fedora 37, the default distribution-installed python will work with 1.0.5
- Anaconda-based python requires the fixes in 1.0.6, at least under Ubuntu-based distributions (didn't test Fedora)
The recent
Using Anaconda/miniconda python, the following sequence of commands is successful:
conda create -n delphi python=3.10 conda activate delphi pip install -i https://test.pypi.org/simple/ delphifmx==1.0.6 python ./hello.py
==> Success!
Good analysis @mvdw73 . The recent test PyPI version (1.0.6) works correctly for both under conda and apt-based Python in Linux when the pre-installed GNU C Library (GLIBC
) in that Linux distribution is >=2.34
. You can check the GLIBC version in your distro using the command: ldd --version
. We will compile the delphifmx
using a lower GLIB version-based distribution (Ubuntu 20.04) to have broader range support.
We
The same issue in Debian 11.2 with python 3.9.2.
The error with
pip install delphifmx
looks like:Python 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from delphifmx import * double free or corruption (out)
The error after
pip install -i https://test.pypi.org/simple/ delphifmx==1.0.6
is:Python 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from delphifmx import * Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/ashtokalo/.local/lib/python3.9/site-packages/delphifmx/__init__.py", line 83, in <module> package = new_import() File "/home/ashtokalo/.local/lib/python3.9/site-packages/delphifmx/__init__.py", line 76, in new_import ld = loader.create_module(spec) ImportError: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /home/ashtokalo/.local/lib/python3.9/site-packages/delphifmx/Linux64/libDelphiFMX.so)
Hi @ashtokalo,
We have released the delphifmx 1.0.6 officially, which can resolve your issue. Please install the delphifmx now with the following command: pip install -U delphifmx
and it should install the latest 1.0.6 version without any issue.
Thanks!!
We have released the delphifmx 1.0.6 officially, which can resolve your issue. Please install the delphifmx now with the following command: pip install -U delphifmx and it should install the latest 1.0.6 version without any issue.
Thanks Priyatham10: I guess this issue can be closed as solved with the solution being "Install the latest version 1.0.6 or later".
Thanks for the effort on this - it's frustrating for everyone when it works on one place and with one set of libraries and not with another.
Closed as fixed