Как узнать, какой .dll отсутствует в python с помощью cx_freeze? - PullRequest
1 голос
/ 21 апреля 2020

У меня есть проект, который я упаковываю с помощью cx_freeze. Когда я пытаюсь запустить полученный exe-файл, я получаю ImportError: DLL load failed: The specified module could not be found.

Вот мой setup.py:

from cx_Freeze import setup, Executable

# Dependencies are automatically detected, but it might need
# fine tuning.
buildOptions = dict(build_exe='liquidation', packages=['scipy', 'numpy'], excludes=['scipy.spatial.cKDTree'],
                    includes=['scipy', 'numpy', 'numpy.core._methods', 'scipy.sparse.csgraph._validation',
                              'numpy.lib.format', 'numpy.linalg._umath_linalg', 'scipy.sparse._csparsetools',
                              'scipy.sparse.linalg.isolve._iterative', 'scipy.sparse.linalg.eigen.arpack._arpack',
                              'scipy.special._ufuncs_cxx', 'scipy.special.specfun', 'scipy.integrate._odepack',
                              'scipy.integrate._quadpack', 'scipy.integrate.vode', 'scipy.integrate._dop',
                              'scipy.integrate.lsoda', 'scipy.optimize._minpack', 'scipy.optimize._zeros',
                              'scipy.spatial', 'scipy.spatial.ckdtree', 'scipy.spatial.kdtree',
                              'scipy._distributor_init', 'numpy.core._multiarray_umath'])

base = 'Console'

executables = [
    Executable('liquidation.py', base=base, targetName='liquidation.exe')
]

setup(name='liquidation',
      version='2.0',
      description='Program to run and test Liquidation algorithms',
      options=dict(build_exe=buildOptions),
      executables=executables)

Когда я запускаю python setup.py build_exe, он, кажется, завершается успешно, но когда Я запускаю exe, я получаю следующий вывод:

Traceback (most recent call last):
  File "C:\Users\tamar\PycharmProjects\liquidation\venv\lib\site-packages\numpy\core\__init__.py", line 24, in <module>
    from . import multiarray
  File "C:\Users\tamar\PycharmProjects\liquidation\venv\lib\site-packages\numpy\core\multiarray.py", line 14, in <module>
    from . import overrides
  File "C:\Users\tamar\PycharmProjects\liquidation\venv\lib\site-packages\numpy\core\overrides.py", line 7, in <module>
    from numpy.core._multiarray_umath import (
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\tamar\PycharmProjects\liquidation\venv\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 40, in run
    module.run()
  File "C:\Users\tamar\PycharmProjects\liquidation\venv\lib\site-packages\cx_Freeze\initscripts\Console.py", line 37, in run
    exec(code, {'__name__': '__main__'})
  File "liquidation.py", line 64, in <module>
    from io_tools.stock_wrapper import StockWrapper
  File "C:\Users\tamar\PycharmProjects\liquidation\io_tools\stock_wrapper.py", line 4, in <module>
    from io_tools.io_helper import *
  File "C:\Users\tamar\PycharmProjects\liquidation\io_tools\io_helper.py", line 7, in <module>
    from numpy import float_
  File "C:\Users\tamar\PycharmProjects\liquidation\venv\lib\site-packages\numpy\__init__.py", line 142, in <module>
    from . import core
  File "C:\Users\tamar\PycharmProjects\liquidation\venv\lib\site-packages\numpy\core\__init__.py", line 54, in <module>
    raise ImportError(msg)
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
  1. Check that you expected to use Python3.7 from "C:\Users\tamar\PycharmProjects\liquidation\liquidation\liquidation.exe",
     and that you have no directories in your PATH or PYTHONPATH that can
     interfere with the Python and numpy version "1.18.3" you're trying to use.
  2. If (1) looks fine, you can open a new issue at
     https://github.com/numpy/numpy/issues.  Please include details on:
     - how you installed Python
     - how you installed numpy
     - your operating system
     - whether or not you have multiple versions of Python installed
     - if you built from source, your compiler versions and ideally a build log

- If you're working with a numpy git repository, try `git clean -xdf`
  (removes all files not under version control) and rebuild numpy.

Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.

Original error was: DLL load failed: The specified module could not be found.

Я понимаю, что мне нужно указать cx_freeze на отсутствующие DLL (либо добавив их в buildOptions.include_files, либо фактически скопировав DLL в папку сборки ) но я в растерянности относительно того, как узнать, какие DLL мне не хватает. numpy.core._multiarray_umath находится в папке сборки, поэтому я не знаю, что это может быть.

Мне кажется, я использую последние версии numpy (1.18.3), scipy (1.4.1) и cx-freeze (6.1). Любая помощь будет принята с благодарностью!

Обновление: Я использовал Dependency Walker, чтобы попытаться увидеть, что мне не хватает, и в нем был указан файл с именем LIBOPENBLAS.SVHFG5YE3RK3Z27NVFUDAPL2O3W6IMXW.GFORTRAN-WIN32.DLL, который не может быть найден. Все остальные зависимости были скопированы в сборку, поэтому имеет смысл, что это будет отсутствующая. Кто-нибудь знает, где я могу найти этот файл?

...