Skip to content

PythonFfiException: Failed to cache Python runtime for version 3.11.3 on windows #16

@bmsrangel

Description

@bmsrangel

When trying to run the command dart run dartpip install on Windows 11, an exception was thrown:

PS python_ffi_poc> dart run dartpip install
supportDir: C:\Users\[...]\AppData\Local\Temp
Unhandled exception:
PythonFfiException: Failed to cache Python runtime for version 3.11.3 on windows
#0      PythonFfiCPythonDart._ensurePythonRuntime (package:python_ffi_cpython_dart/src/python_ffi_cpython_dart_base.dart:144:7)
<asynchronous suspension>
#1      PythonFfiCPythonDart.openDylib (package:python_ffi_cpython_dart/src/python_ffi_cpython_dart_base.dart:115:7)
<asynchronous suspension>
#2      PythonFfiCPythonMixin.initialize (package:python_ffi_cpython_dart/src/python_ffi_cpython_dart_base.dart:416:7)
<asynchronous suspension>
#3      solve (package:dartpip_solver/src/dartpip_solver_base.dart:49:3)
<asynchronous suspension>
#4      InstallCommand._collectAllDependencies (package:dartpip/commands/install.dart:113:58)
<asynchronous suspension>
#5      InstallCommand._downloadAllDependencies (package:dartpip/commands/install.dart:138:9)
<asynchronous suspension>
#6      InstallCommand.run (package:dartpip/commands/install.dart:190:34)
<asynchronous suspension>
#7      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#8      main (file:///C:/Users/[...]/AppData/Local/Pub/Cache/git/dart_python_ffi-8c63ce86bc25d9bbeed222389088f30583d67db9/packages/dartpip/bin/dartpip.dart:14:3)
<asynchronous suspension>

Note: I do have Python 3.11.5 installed on the PC and I'm using the latest GitHub updates of the repo (main branch).

PS C:\Users\[...]\Programming\python_ffi_poc> python --version
Python 3.11.5

So, I decided to try to use the download command first, and then the bundle command:

PS C:\Users\[...]\Programming\python_ffi_poc> dart run dartpip download openpyxl
Cache directory: null/.dartpip/cache/pypi
Downloading Python module 'openpyxl'...
Downloading https://files.pythonhosted.org/packages/42/e8/af028681d493814ca9c2ff8106fc62a4a32e4e0ae14602c2a98fc7b741c8/openpyxl-3.1.2.tar.gz...
Extracting null/.dartpip/cache/pypi/openpyxl-3.1.2.tar.gz...
PS C:\Users\[...]\Programming\python_ffi_poc> dart run dartpip bundle -r . -m python-modules
Bundling Python module 'basic_operations'...
Bundling Python module 'excel_test'...

From that, I noticed that the cache folder (null/.dartpip...) was created in the root of the project and the openpyxl files were extracted there. However, its dependency (et-xmlfile) was not downloaded. Also, none of those files were included under python-modules folder.
image

Flutter Doctor:

PS C:\Users\[...]\Programming\python_ffi_poc> flutter doctor -v
[✓] Flutter (Channel stable, 3.13.2, on Microsoft Windows [Version 10.0.22621.2134], locale pt-BR)
    • Flutter version 3.13.2 on channel stable at C:\src\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ff5b5b5fa6 (12 days ago), 2023-08-24 08:12:28 -0500
    • Engine revision b20183e040
    • Dart version 3.1.0
    • DevTools version 2.25.0

[✓] Windows Version (Installed version of Windows is version 10 or higher)

[✗] Android toolchain - develop for Android devices
    ✗ ANDROID_HOME = C:\Users\[...]\AppData\Local\Android\Sdk
      but Android SDK not found at this location.

[✓] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[✓] Visual Studio - develop Windows apps (Visual Studio Community 2019 16.11.5)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.11.31729.503
    • Windows 10 SDK version 10.0.19041.0

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).

[✓] VS Code, 64-bit edition (version 1.81.1)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 3.46.0

[✓] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22621.2134]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 116.0.5845.141
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 116.0.1938.69

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockedThis issue will be addressed later.bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions