pythonpyinstallercosine-similaritysentence-transformers

'tqdm>=4.27' distribution was not found error while executing a .exe file created using Pyinstaller


I am trying to create a application which checks for sentence similarity. .exe file got created. I get the below error message while executing .exe file after giving required inputs.

Error Message

The 'tqdm>=4.27' distribution was not found and is required by this application.
Try: pip install transformers -U or pip install -e '.[dev]' if you're working with git main

spec file

# -*- mode: python ; coding: utf-8 -*-


block_cipher = None


a = Analysis(['render_ui.py'],
             pathex=[],
             binaries=[],
             datas=[('Config\\favicon.ico',"."), ('Config\\miniLM.sav',".")],
             hiddenimports=['sklearn.metrics._pairwise_distances_reduction._datasets_pair', 'sklearn.metrics._pairwise_distances_reduction._middle_term_computer', 'sklearn.metrics._pairwise_distances_reduction._argkmin', 'sklearn.metrics._pairwise_distances_reduction._base', 'sklearn.metrics._pairwise_distances_reduction._radius_neighbors',
                            'sentence_transformers.SentenceTransformer'],
             hookspath=[],
             hooksconfig={},
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)

exe = EXE(pyz,
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,  
          [],
          name='App',
          debug=False,
          bootloader_ignore_signals=False,
          strip=False,
          upx=True,
          upx_exclude=[],
          runtime_tmpdir=None,
          console=True,
          disable_windowed_traceback=False,
          target_arch=None,
          codesign_identity=None,
          entitlements_file=None,
          icon='Config\\favicon.ico')

I already have "tqdm==4.64.1" installed. I am not sure what is causing this problem. Can someone please help me out on this?


Solution

  • after adding below instructions in spec file I was able to resolve the issue

    datas += copy_metadata('tqdm')
    datas += copy_metadata('regex')
    datas += copy_metadata('requests')
    datas += copy_metadata('packaging')
    datas += copy_metadata('filelock')
    datas += copy_metadata('numpy')
    datas += copy_metadata('tokenizers')
    datas += copy_metadata('importlib_metadata')
    datas += copy_metadata('tensorflow')