15

I have an AntiVirus false positive problem of my exe file generated using PyInstaller, by searching i found this answer witch consist of recompiling the bootloader and i just can't get it done. This what i've tried so far:

  1. try to install C++ build-tools with choco using "choco install -y vcbuildtools" for some reasons the installation failed.
  2. installing visual studio community from here then goes to "cd bootloader" and do python ./waf distclean all got the error can't open file './waf': [Errno 2] No such file or directory
  3. installing MinGW-w64 and setting the path then retry, i got the same error.

Or maybe there is another way to make the executable not detected as virus/trojan.

Packages used : PyQt5, pysnmp, pandas, numpy.

EDIT: Thanks to @Ana Knickerbocker answer i was able to make a progression, now when i run python ./waf all i got the error : Python Version : 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] Checking for 'msvc' (C compiler) : not found Checking for 'gcc' (C compiler) : not found Checking for 'clang' (C compiler) : not found could not configure a C compiler!

I guess i still don't have a compiler, i've tried pip install vsbuildtoolsbut i got this message : No matching distribution found for vcbuildtools any ideas ?

Im on Windows 7 x64

infantry
  • 336
  • 1
  • 5
  • 15

3 Answers3

18

Hey you don't need visual studio to build pyinstaller's bootloader, you can do it in your terminal if you have python or python3 installed. It's important to know which one you are using. I will assume you use python3, try the following steps in your terminal/command line:

  1. git clone https://github.com/pyinstaller/pyinstaller

  2. cd pyinstaller, then cd bootloader

  3. Run python3 ./waf distclean all to build the bootloader for your system.

  4. Once the bootloader has been built, in the pyinstaller directory type in: python3 setup.py install (if this fails, pip install . might work instead)

  5. This should have installed pyinstaller. Type pyinstaller in the terminal and hit enter. It should recognize the command, but it will complain about more arguments.

  6. Use the command pyinstaller yourfile.py to create your executable.

Hope this helped!

Iwan Plays
  • 29
  • 3
AbdurRehman Khan
  • 830
  • 9
  • 20
  • my problem is when i do "python3 ./waf distclean all" i got this error : `python: can't open file './waf': [Errno 2] No such file or directory` – infantry Dec 10 '18 at 13:04
  • Then you must not be in the right directory, run pwd to look at where you are. It should be .../pyinstaller/bootloader – AbdurRehman Khan Dec 13 '18 at 07:27
  • Also use ls to list all files, there should be a file named waf in the directory you're in... – AbdurRehman Khan Dec 13 '18 at 09:42
  • 3
    This honestly worked for me. for step 3 make sure you're in the pyinstaller-3.5/bootloader directory to run "python ./waf distclean all" then for step 4 make sure you cd .. back to the pyinstaller-3.5 folder and run "python setup.py install" on the setup.py file. Worked perfect the first time. – griffinc Dec 01 '19 at 22:59
  • 1
    The answer works for me too. The `python ./waf distclean all` command used the VS2019 complier in my pc to compile and build all the`run*.exe` files under `~\pyInstaller-3.6\bootloader\Windows-64bit\` directory. – thewaywewere Mar 18 '20 at 19:38
  • 1
    If you get error `task in 'run_d' failed with exit status 1169`, try moving your build dir to a shorter path. https://github.com/pyinstaller/pyinstaller/issues/4824 – ErikusMaximus Oct 20 '20 at 18:48
  • I did the `python3 ./waf distclean all` but there was no setup.py file available after that..... – raw-bin hood Dec 10 '20 at 19:11
  • @jonnyjandles you've gotta cd back to the root directory (pyinstaller probably) and use the setup.py file available there. Like griffinc's comment mentions. – AbdurRehman Khan Dec 21 '20 at 13:37
  • I tried the steps, but have the following error upon using setup.py: C:\Python311\Lib\site-packages\setuptools\command\easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools. warnings.warn( running bdist_egg Error: Aborting implicit building of eggs. To install from source, use 'pip install .' instead of 'python setup.py install'. – HexTree Feb 25 '23 at 19:58
  • @HexTree Did you try doing what the warning says? "pip install ."? This is probably happening because you're using a more recent python version (3.11 I'm guessing), I don't remember what python version I was working with back when I did this, but it was probably <= 3.6 – AbdurRehman Khan Feb 27 '23 at 09:17
  • @AbdurRehmanKhan thanks for the clarification. I had misread and thought it was telling me to pip install from the online source. Your suggestion worked. And it was Python 3.11 – HexTree Feb 28 '23 at 10:19
3

For anyone getting the error 'could not configure a C compiler!

Simply install a C compiler on your machine.

I installed Visual Studio with C++ compiler as was easier and more legitimate.

https://visualstudio.microsoft.com/vs/features/cplusplus/

2

The bootloader source is not installed if you are using pip install …. You need to use a source package of PyInstaller (either a git clone or download an archive from github).

GitHub - Bootloader Issue

PyInstaller GitHub

purple
  • 66
  • 5