Skip to content

DLL load error when importing tensorflow #628

@georgea3

Description

@georgea3

Describe the problem
I have built a portable Python 3.13.11 environment on Windows. I have installed a number of modules including tensorflow 2.20.0. When I try to launch my Python application from my java application, I get this error just on the import tensorflow statement.

Caused by: jep.JepException: <class 'ImportError'>: Traceback (most recent call last):
  File "C:\Python313\python\Lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 73, in <module>
    from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: A dynamic link library (DLL) initialization routine failed.
Failed to load the native TensorFlow runtime.

However when I run a simple
python -c "import tensorflow as tf; print(tf.__version__)"
from command line, I get the expected version printed.
I'm not entirely sure which dll is missing - however when I inspect the pyd file in question in the Dependencies tool, it highlights the python313.dll as unresolved even though that dependency is in the root python folder.

So I wondered since this error only happens when using Jep, whether this has anything to do with the error and whether you can help in any way.

Many thanks.

Environment (please complete the following information):

  • OS Platform, Distribution, and Version: Windows 11
  • Python Distribution and Version: Python 3.13.11
  • Java Distribution and Version: Zulu Openjdk 21.0.2
  • Jep Version: 4.3.1
  • Python packages used (e.g. numpy, pandas, tensorflow): numpy (2.4.0), pandas (2.3.3), tensorflow (2.20.0), scikit-learn (1.8.0), matplotlib(3.10.8)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions