Python (mandatory)
LightWin requires Python 3.12 or higher. Ensure that you have an appropriate version of Python installed on your system. If not, you can download the latest version from the official Python website.
Installation with pip (recommended)
Navigate to the LightWin base folder (i.e., where the
pyproject.pyfile is located).In a dedicated Python environment, run the following command:
pip install -e .
The mandatory packages with their dependencies should be automatically downloaded.
Hint
The -e flag means that the installation is editable.
In other words, you can edit the source files and the changes will be taken into account when calling lightwin.
Note
If there is a problem during the installation, file an issue.
Give me your OS, development environment, and the full log error.
You can probably fix the issue yourself by manually installing the packages listed in pyproject.toml, taking a more recent version of the offending package(s).
In any case, I’ll be happy to have the information.
Installation with conda (not recommended)
The package dependencies are listed in a single compact pyproject.toml file.
This is not yet supported by conda.
So the installation will require more work from your side.
In a dedicated environment, install all the dependencies defined in the
pyproject.toml(some can be removed, see following sections).Add the
/path/to/LightWin/srcto yourPYTHONPATHenvironment variable. This is the folder containing thelightwinfolder.
Todo
Consider providing more detailed instructions for setting the PYTHONPATH.
For now, you can search for “PYTHONPATH” or “ModuleNotFoundError” online for additional guidance.
Following packages are optional
cython- Used to speed up calculations. Check cython integration documentation.Note: Installing
cythonprior topymooenable compilation of somepymoofunctions for improved performance.
pytest- To run tests and ensure everything is working as expected.cloudpickle- To pickle/unpickle some objects (see theutil.picklingdocumentation).
For developers
The files are formatted with black (text width: 79 characters) and isort.
The docstrings must adhere to the numpy style.
Reminders
Installation of a package
To install a package, use the appropriate method based on your environment:
If using
pip:pip install <package>
If using
conda, avoid mixing withpipto prevent potential conflicts. Instead, use:conda install <package>
Note
Since pymoo is not available on the default Anaconda channels, you should create a conda environment and use conda-forge:
conda create -n <env-name> -c conda-forge python=3.12
conda activate <env-name>
conda install cython matplotlib numpy palettable pandas scipy tkinter pymoo pytest -c conda-forge
Always specify -c conda-forge when installing or updating packages.
Warning
pip and conda are not fully compatible.
Avoid using them together, or create a dedicated environment to prevent conflicts.
For more details, you may refer to this video.