Skip to content

Build fails on Gitlab CI Windows runner #5479

@DeepSpace2

Description

@DeepSpace2

I'm not sure this is a PyInstaller issue as everything is working as expected locally. However I'd love to see if we can understand where this issue comes from.

Description of the issue

pyinstaller script.py results with error OSError: [Errno 22] Invalid argument: 'c:\\users\\gitlab_runner\\.virtualenvs\\project-generator-_focglu2\\lib\\site-packages\\PyInstaller\\bootloader\\Windows-64bit\\run.exe'

Full trace:

40443 INFO: Bootloader c:\users\gitlab_runner\.virtualenvs\project-generator-_focglu2\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
40443 INFO: checking EXE
40443 INFO: Building EXE because EXE-00.toc is non existent
40443 INFO: Building EXE from EXE-00.toc
Traceback (most recent call last):
  File "c:\python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\gitlab_runner\.virtualenvs\project-generator-_FoCGLu2\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
  File "c:\users\gitlab_runner\.virtualenvs\project-generator-_focglu2\lib\site-packages\PyInstaller\__main__.py", line 114, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "c:\users\gitlab_runner\.virtualenvs\project-generator-_focglu2\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "c:\users\gitlab_runner\.virtualenvs\project-generator-_focglu2\lib\site-packages\PyInstaller\building\build_main.py", line 725, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "c:\users\gitlab_runner\.virtualenvs\project-generator-_focglu2\lib\site-packages\PyInstaller\building\build_main.py", line 672, in build
    exec(code, spec_namespace)
  File "C:\GitLab-Runner\builds\tufinps\tos2\project-generator\tos2-project-generator.spec", line 33, in <module>
    console=True )
  File "c:\users\gitlab_runner\.virtualenvs\project-generator-_focglu2\lib\site-packages\PyInstaller\building\api.py", line 450, in __init__
    self.__postinit__()
  File "c:\users\gitlab_runner\.virtualenvs\project-generator-_focglu2\lib\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__
    self.assemble()
  File "c:\users\gitlab_runner\.virtualenvs\project-generator-_focglu2\lib\site-packages\PyInstaller\building\api.py", line 541, in assemble
    self._copyfile(exe, tmpnm)
  File "c:\users\gitlab_runner\.virtualenvs\project-generator-_focglu2\lib\site-packages\PyInstaller\building\api.py", line 654, in _copyfile
    with open(infile, 'rb') as infh:
OSError: [Errno 22] Invalid argument: 'c:\\users\\gitlab_runner\\.virtualenvs\\project-generator-_focglu2\\lib\\site-packages\\PyInstaller\\bootloader\\Windows-64bit\\run.exe'

Context information (for bug reports)

  • Output of pyinstaller --version: 4.2
  • Version of Python: 3.7.9
  • Platform: Windows-10-10.0.17763-SP0

As mentioned, this error only happens when running on gitlab CI. When running locally (also on Windows 10) everything is working as expected.

My .gitlab-ci.yml:

stages:
    - build

build-windows:
  stage: build
  tags:
    - windows
  script:
    - choco install python --version=3.7.9 -y
    - $env:PATH+=";C:\Python37;C:\Python37\Scripts"
    - python -m pip install pipenv
    - pipenv update
    - pipenv run pyinstaller script.py --hidden-import gitlab.v4 --hidden-import gitlab.v4.objects --onefile  --noconfirm
  artifacts:
    paths:
      - dist/script.exe

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions