Getting AssertionError in bindepend.get_python_library_path

70 views
Skip to first unread message

Shivanshu Dixit

unread,
Jul 10, 2024, 7:30:01 AM7/10/24
to PyInstaller
When trying to do a build getting assertion error,

It sometimes works some times throws this error

207 INFO: Appending 'datas' from .spec
208 INFO: checking Analysis
208 INFO: Building Analysis because Analysis-00.toc is non existent
208 INFO: Initializing module dependency graph...
209 INFO: Caching module graph hooks...
216 INFO: Analyzing base_library.zip ...
618 INFO: Loading module hook 'hook-heapq.py' from '/usr/local/lib/python3.8/dist-packages/PyInstaller/hooks'...
691 INFO: Loading module hook 'hook-encodings.py' from '/usr/local/lib/python3.8/dist-packages/PyInstaller/hooks'...
1657 INFO: Loading module hook 'hook-pickle.py' from '/usr/local/lib/python3.8/dist-packages/PyInstaller/hooks'...
2230 INFO: Caching module dependency graph...
2307 INFO: Running Analysis Analysis-00.toc
2307 INFO: Looking for Python shared library...
Traceback (most recent call last):
  File "/usr/local/bin/pyinstaller", line 8, in <module>
    sys.exit(_console_script_run())
  File "/usr/local/lib/python3.8/dist-packages/PyInstaller/__main__.py", line 214, in _console_script_run
    run()
  File "/usr/local/lib/python3.8/dist-packages/PyInstaller/__main__.py", line 198, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "/usr/local/lib/python3.8/dist-packages/PyInstaller/__main__.py", line 69, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/PyInstaller/building/build_main.py", line 1071, in main
    build(specfile, distpath, workpath, clean_build)
  File "/usr/local/lib/python3.8/dist-packages/PyInstaller/building/build_main.py", line 1011, in build
    exec(code, spec_namespace)
  File "/usr/src/dast_client.spec", line 8, in <module>
    a = Analysis(
  File "/usr/local/lib/python3.8/dist-packages/PyInstaller/building/build_main.py", line 470, in __init__
    self.__postinit__()
  File "/usr/local/lib/python3.8/dist-packages/PyInstaller/building/datastruct.py", line 184, in __postinit__
    self.assemble()
  File "/usr/local/lib/python3.8/dist-packages/PyInstaller/building/build_main.py", line 578, in assemble
    python_lib = bindepend.get_python_library_path()
  File "/usr/local/lib/python3.8/dist-packages/PyInstaller/depend/bindepend.py", line 803, in get_python_library_path
    python_libname = findLibrary(name)
  File "/usr/local/lib/python3.8/dist-packages/PyInstaller/depend/bindepend.py", line 558, in resolve_library_path
    fullpath = _resolve_library_path_unix(name)
  File "/usr/local/lib/python3.8/dist-packages/PyInstaller/depend/bindepend.py", line 632, in _resolve_library_path_unix
    assert os.path.isfile(lib)
AssertionError

bwoodsend

unread,
Jul 11, 2024, 6:25:52 PM7/11/24
to PyInstaller

What Linux distribution is this and how did you install Python and PyInstaller?

Whilst it shouldn’t be raising assertion errors, generally whenever something goes wrong in get_python_library_path(), it means that your Python environment doesn’t provide libpython3.x.so so it’s unusable to PyInstaller anyway. If everything had gone smoothly, you’d probably just be looking at this error instead.

Shivanshu Dixit

unread,
Jul 11, 2024, 9:48:05 PM7/11/24
to PyInstaller
Using 
NAME="Ubuntu"
VERSION="18.04.6 LTS (Bionic Beaver)"

python version used is python3.8, it breaks sometimes,but it also passes sometimes (50% chance of passing).

One change is python3.6 is uninstalled,

Thsi file sis present /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0

Some times it picks this file
2240 INFO: Caching module dependency graph...
2335 INFO: Running Analysis Analysis-00.toc
2336 INFO: Looking for Python shared library...
2405 INFO: Using Python shared library: /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0

bwoodsend

unread,
Jul 12, 2024, 10:41:38 AM7/12/24
to PyInstaller

Shivanshu Dixit

unread,
Jul 14, 2024, 10:39:42 PM7/14/24
to PyInstaller
Python3.8 is installe d using apt 

apt-get install -y libpq-dev python3.8 python3.8-dev python3.8-distutils

Installed pip using (added python as alternative for python3.8)

curl -s https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
python get-pip.py --force-reinstall && \

rm get-pip.py

pyinstaller using pip
RUN pip install pyinstaller==6.3.0

Reply all
Reply to author
Forward
0 new messages