Skip to content
crispweed edited this page Mar 24, 2019 · 20 revisions

All commands here are in a bash terminal (from MSYS-Git, but cygwin should work the same).

Windows dev with a Virtual Environment :

This creates a Virtual Environment to install all dependencies into, keeping your environment self-contained and clean.

  • Install Python 3.6
  • Clone the client repo
  • cd into the client repo
  • Create virtualenv: python -m venv <venvpath>
    • You may need to use the full path to python if you did not install it into your system path
    • <venvpath> here and in the following steps should always be the full path to a location where you have access (For example, c:/users/<username>/fafclient-venv)
  • Activate venv
    • how to do that depends on whether you are using cmd or bash
    • bash: source <venvpath>/Scripts/activate
    • cmd: <venvpath>/Script/activate.bat
  • Should you receive an error about pip not being installed then make sure that your Python install directory is added to the Environment Variable Path and then run python -m ensurepip
  • pip install pywin32
  • pip install -r requirements.txt
  • Add pywin32 libs to path
    • bash: export PATH=<venvpath>/Lib/site-packages/pywin32_system32:$PATH
    • cmd: ??
      • Add the Path manually opening the Control Panel -> System and Security -> System -> Advanced System Settings -> Environment Variables... and add a new Path for the pywin32 libs to path eg C:\Lib\site-packages\pywin32_system32\
      • You have to open a new console window after adding the Path manually

That's all! python src and python runtests.py should now work, provided your working directory is a checkout of the client repository.

You will have to activate the venv and make sure the pywin32 libs are in path every time you launch a new terminal.

Windows dev without a Virtual Environment :

If you have trouble having a virtual environment, it is not necessary to run the client, you can do these steps instead :

  • Install Python 3.6
  • Verify pip & python are working by doing python --version and pip--version (there shouldn't have any error)
  • Clone the client repo
  • cd into the client repo
  • pip install pyqt5
  • pip install https://github.com/FAForever/python-wheels/releases/download/2.0.0/pywin32-221-cp36-cp36m-win32.whl(if error at this step check common issues & their solution part)
  • pip install pytest
  • pip install -r requirements.txt
    Then you can start the client by doing :
    python src
    You can also try the tests by doing :
    python runtests.py

Common issues & their solutions

Error "failed to get uid"

It is most likely due because you don't have faf-uid.exe in the "lib" folder of the git repo you cloned. You can copy and paste the faf-uid.exe you have in the client you use to play. (This will be in a directory like 'C:\Program Files (x86)\Forged Alliance Forever\lib'.)

Error with pywin

If the wheel doesn't work, you can download and install an executable instead, for example there: https://sourceforge.net/projects/pywin32/files/pywin32/Build%20221/ Download and install pywin32-221.win32-py3.6 or pywin32-221.win-amd64-py3.6 (don't remember which one, try both I guess)

Pywin wheel 'not supported on this platform'

If you get something like 'pywin32-221-cp36-cp36m-win32.whl is not a supported wheel on this platform' when installing the pywin32 wheel, check that you are installing into a 32 bit python environment. You should normally see some text that shows whether you are in a 32 or 64 bit environment in the header that comes up when you start the python interpreter.

Client error for release-version

You can remove this message by having a "RELEASE-VERSION" file in the "res" folder, which has this content : 0.16.1-rc.1+2374 (or the last version it is, you can also grab this RELEASE-VERSION from the client you use to play)

Error with python --version and pip--version (no command found for example)

Verify in your variable environment system called PATH that you have in the list :
for pip (it must be the first in the list, top of the list):
C:\Python36\Scripts\
for python (it must be second in the list, 2nd top of the list):
C:\Python36\
The folder Python36 is where you installed python36 (the location of python.exe, you have to point where this exe is, for example "C:\Python36" )
The folder Python36 is where you have pip(the location of pip.exe, you have to point where this exe is, for example "C:\Python36\Scripts")

Error with PyQt5 pip installation, error 13. Permission denied

Execute the cmd as admin

Error with installing cx_Freeze and pywin32

Use Python3.6 instead of 3.7

Python doesnt recognize PyQt5 being installed even though it is

use PyQt5.9 instead of a higher version (e.g. 'pip install pyqt5==5.9')

'ImportError: DLL load failed' error on import of win32api

Following (from: https://github.com/michaelgundlach/pyspeech/issues/23) helped me solve this problem: "After you installed the pywin32 libs, there is a directory "Lib/site-packages/pywin32_system32", which including three dll libs, copy them to the "/Lib/site-packages/win32" directory, which including the win32api.pyd or win32api.pyc. There will be no ImportError Exception any more" (For info, in my case, there were just two dlls to copy.)