how to include multiple hidden imports in pyinstaller inside spec file

I have to import tensorflow_core and h5py

I did this.

from PyInstaller.utils.hooks import collect_submodules

hiddenimports_tensorflow = collect_submodules('tensorflow_core')
hidden_imports_h5py = collect_submodules('h5py')


a = Analysis(['smile.py'],
             pathex=['D:\\myfolder\\myfile'],
             binaries=[],
             datas=[],
             hiddenimports=[hiddenimports_tensorflow,hidden_imports_h5py],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             noarchive=False)

hiddenimports=[hiddenimports_tensorflow,hidden_imports_h5py] is popping

TypeError: unhashable type: 'list'

How do i specify multiple imports here?

Upvotes: 2

Views: 2884

Answers (1)

My bad

from PyInstaller.utils.hooks import collect_submodules

hiddenimports_tensorflow = collect_submodules('tensorflow_core')
hidden_imports_h5py = collect_submodules('h5py')

just had to append two lists

all_hidden_imports = hiddenimports_tensorflow + hidden_imports_h5py
a = Analysis(['smile.py'],
             pathex=['D:\\myfolder\\myfile'],
             binaries=[],
             datas=[],
             hiddenimports=all_hidden_imports,
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             noarchive=False)

Upvotes: 2

Related Questions