Bug 140236 (python-core-3.8.4) - ImportError: DLL load failed while importing _ctypes
Summary: ImportError: DLL load failed while importing _ctypes
Status: RESOLVED FIXED
Alias: python-core-3.8.4
Product: LibreOffice
Classification: Unclassified
Component: framework (show other bugs)
Version:
(earliest affected)
7.1.0.3 release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Jan-Marek Glogowski
URL:
Whiteboard: target:7.2.0 target:7.1.1
Keywords:
: 140279 (view as bug list)
Depends on:
Blocks: 140279
  Show dependency treegraph
 
Reported: 2021-02-07 11:36 UTC by ralf_reinders
Modified: 2021-02-19 06:10 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ralf_reinders 2021-02-07 11:36:04 UTC

    
Comment 1 ralf_reinders 2021-02-07 11:49:01 UTC
Hello folks,

since I try the new Libreoffice "7.1.0.3" I have a new problem with Python.

Example:

# 7.1.0.3
# C:\Program Files\LibreOffice\program>python
# Python 3.8.4 (default, Jan 28 2021, 10:59:35) [MSC v.1928 64 bit (AMD64)] on win32
# Type "help", "copyright", "credits" or "license" for more information.
# >>> import ctypes
# Traceback (most recent call last):
#   File "<stdin>", line 1, in <module>
#   File "C:\Program Files\LibreOffice\program\python-core-3.8.4\lib\ctypes\__init__.py", line 7, in <module>
#     from _ctypes import Union, Structure, Array
# ImportError: DLL load failed while importing _ctypes: Das angegebene Modul wurde nicht gefunden.
# >>>

by searching the internet I'am found: "libffi-7.dll". If i copy this dll to "C:\Program Files\LibreOffice\program\python-core-3.8.4\lib" all seems OK!

It`s a bug?
Comment 2 Jan-Marek Glogowski 2021-02-07 12:47:17 UTC
You can't confirm your own bug. This field is set to NEW, if someone else from QA or a developer can reproduce your problem... which I can :-(

My local build has a libffi-7.dll (and otherwise the Python unit tests wouldn't pass), but that dll is missing in the MSI package.
Comment 3 ralf_reinders 2021-02-07 12:58:01 UTC
Hi Jan-Marek,

thx for your response.

Some additional questions:

  1) exist any official source for "libffi-7_dll"?

     (my source was: "https://www.dllme.com/dll/files/libffi-7_dll.html")

  2) Why is it not included in the MSI package?

  3) is this anywhere documented?

thx
Comment 4 Jan-Marek Glogowski 2021-02-07 15:49:05 UTC
(In reply to ralf_reinders from comment #3)
> Some additional questions:
> 
>   1) exist any official source for "libffi-7_dll"?
> 
>      (my source was: "https://www.dllme.com/dll/files/libffi-7_dll.html")

Don't think so.

>   2) Why is it not included in the MSI package?

Python (which LO builds itself) used to have a build-in libffi version, but that was removed in 3.8, so now LO has to build it itself. And I forgot to add it to the MSI installer. Simply a bug.

>   3) is this anywhere documented?

Not sure what you're referring to. What do you expect?

The next update 7.1.1 will include the dll (https://wiki.documentfoundation.org/ReleasePlan/7.1#7.1.1_release)

There is already: https://gerrit.libreoffice.org/c/core/+/110537
Comment 5 ralf_reinders 2021-02-07 15:52:03 UTC
OK, can answer the first of my last questions self:

  2) "https://www.python.org/ftp/python/3.8.4/python-3.8.4-embed-amd64.zip"

btw: How can it be that such an important thing is missing, even though so many
     Python scripts need this dll under windows?

PS:  I ran into this problem because I wanted to run "get-pip.py"
Comment 6 ralf_reinders 2021-02-07 16:04:40 UTC
Hi Jan-Marek,

all questions are optimally answered - thank you very much for your work!

With best regards

Ralf
Comment 7 Jan-Marek Glogowski 2021-02-07 17:33:34 UTC
(In reply to ralf_reinders from comment #5)
> OK, can answer the first of my last questions self:
> 
>   2) "https://www.python.org/ftp/python/3.8.4/python-3.8.4-embed-amd64.zip"
> 
> btw: How can it be that such an important thing is missing, even though so
> many Python scripts need this dll under windows?

Nobody tests the installer. I guess primarily, because it takes ages to generate. I guess nothing else then a quick install test is done for a release MSI.

When you develop LO you have everything automatically "installed" in a directory, where you can start LO, run unit tests etc. This is fast. There the DLL is available.
Comment 8 Commit Notification 2021-02-07 18:18:32 UTC
Jan-Marek Glogowski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/fad7e203a25963128b9ce786d3fc465a32c238ce

tdf#140236 WIN install libffi with Python

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2021-02-07 19:05:03 UTC
Jan-Marek Glogowski committed a patch related to this issue.
It has been pushed to "libreoffice-7-1":

https://git.libreoffice.org/core/commit/9c7a9060adbbcd0fbf593a811b5a02fe9bae898a

tdf#140236 WIN install libffi with Python

It will be available in 7.1.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Jan-Marek Glogowski 2021-02-19 06:10:07 UTC
*** Bug 140279 has been marked as a duplicate of this bug. ***