Intel® Distribution for Python*
Engage in discussions with community peers related to Python* applications and core computational packages.

Simple Py_InitializeEx app doesnt work

philip_miloslavsky
初學者
4,934 檢視

I'm writing an app that does Py_InitializeEx(0) and that ends up calling exit()

'irisdb.exe' (Win32): Loaded 'C:\Windows\System32\bcryptprimitives.dll'. Symbols loaded without source information.
Fatal Python error: failed to get the Python codec of the filesystem encoding
'irisdb.exe' (Win32): Loaded 'C:\Windows\System32\kernel.appcore.dll'. Symbols loaded without source information.

 

when I call PyInitializeEx(0) in the python39.dll that you ship.

 

My application works fine for conda which is based on python311/python311.dll now.

 

I'm not sure what I can change, this is basic embedded python.

0 積分
1 解決方案
Kaleem_A_Intel
4,238 檢視

Sorry for the delay, We analyzed the problem and encountered the same failure for both Miniconda for Python 3.9 and IDP for 3.9.


After our observation, we concluded that since you got it to work for Python 3.11 with conda, We'll give you the benefit of the doubt that it's a problem with Python 3.9, and has nothing to do with IDP. 

Please let us know If you find further issues.



在原始文章中檢視解決方案

10 回應
Kaleem_A_Intel
4,892 檢視

Hi Philip,

It appears that your application is functioning properly when using open-source Python 3.11, but encountering issues when using IntelPython 3.9. Please let me know if my understanding is wrong.

 

Please provide details about the operating system and steps to reproduce the issue.


philip_miloslavsky
初學者
4,873 檢視

zip file attached.

There are 2 visual studio simple projects: a Console App one and a DLL one.

There are 2 pythons you can use depending on an #if in the console project.

python.org 3.9, the working one results in this:

Hello World!
doing import numpy in dll:
hello from python
import done

C:\Users\pmilosla\source\repos\ConsoleApplication\x64\Release\ConsoleApplication.exe (process 16820) exited with code 0.
Press any key to close this window . . .

 

Your python results in this:

 

Hello World!
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = 'python'
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = 'C:\\Users\\pmilosla\\source\\repos\\ConsoleApplication\\x64\\Release\\ConsoleApplication.exe'
sys.base_prefix = 'C:\\ProgramData\\intelpython3'
sys.base_exec_prefix = 'C:\\ProgramData\\intelpython3'
sys.platlibdir = 'lib'
sys.executable = 'C:\\Users\\pmilosla\\source\\repos\\ConsoleApplication\\x64\\Release\\ConsoleApplication.exe'
sys.prefix = 'C:\\ProgramData\\intelpython3'
sys.exec_prefix = 'C:\\ProgramData\\intelpython3'
sys.path = [
'C:\\ProgramData\\intelpython3\\python39.zip',
'.\\DLLs',
'.\\lib',
'C:\\Users\\pmilosla\\source\\repos\\ConsoleApplication\\x64\\Release',
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00008e24 (most recent call first):
<no Python frame>

C:\Users\pmilosla\source\repos\ConsoleApplication\x64\Release\ConsoleApplication.exe (process 13100) exited with code 1.
Press any key to close this window . . .

Kaleem_A_Intel
4,852 檢視

Thank you for sharing the reproducible. We will keep you updated once we have any new information. Could you please provide us with more details about your environment, such as the version of Windows and Visual Studio that you are using?


philip_miloslavsky
初學者
4,837 檢視

Win 11 Pro, visual studio 2022. I would be really surprised if that matters.

Kaleem_A_Intel
4,798 檢視

Thank you for sharing the environment details. We will update you once we have an update


Kaleem_A_Intel
4,737 檢視

We were able to reproduce the issue with intelpython3 and will update you as soon as we have more information


Kaleem_A_Intel
4,239 檢視

Sorry for the delay, We analyzed the problem and encountered the same failure for both Miniconda for Python 3.9 and IDP for 3.9.


After our observation, we concluded that since you got it to work for Python 3.11 with conda, We'll give you the benefit of the doubt that it's a problem with Python 3.9, and has nothing to do with IDP. 

Please let us know If you find further issues.



philip_miloslavsky
初學者
4,213 檢視

Do you happen to have a timeline for when you will update your product to be based on conda/python3.11 ?

Kaleem_A_Intel
4,098 檢視

In 2024.2, IDP will release Python 3.11 builds as online packages, which will receive necessary updates.


Please try using IDP version 3.10 and let us know if the issue persists.


Kaleem_A_Intel
3,955 檢視

We are closing this case, Please feel free to raise a new thread in case of further issues.



回覆