Installation¶
If you have not really worked with Python before, we recommend using miniconda or anaconda. Please follow the installation guides to set up a Python environment. For convenience we also provide a quick guide below.
Stable¶
To install the most recent stable release of pymoo please use PiPy
pip install -U pymoo
For MacOSX and Windows compiled packages are available. For Linux the package will be compiled during installation (make sure that NumPy is installed before executing the pip command). If you encounter any difficulties during compilation or you prefer to compile the package by yourself please the our guide below.
To quickly check if the compilation was successful you can use the following command:
python -c "from pymoo.util.function_loader import is_compiled;print('Compiled Extensions: ', is_compiled())"
Release Candidate¶
To install the current release candidate you simply have to add --pre
to the installation command:
pip install --pre -U pymoo
Development¶
If you intend to use not the latest development, select the branch you intend to use (below it is master) and install it by:
pip install numpy
git clone https://github.com/anyoptimization/pymoo
cd pymoo
make compile
pip install .
Compilation¶
The pymoo framework can be run with and without compiled modules. Some computationally more expensive function has been implemented using Cython for speedup.
The compilation requires NumPy to be installed because its header files are needed. You can use the make command below directly:
make compile
Or execute the same command by
python setup.py build_ext --inplace
Or if Cython shall be used to create the cpp
files from scratch use
python setup.py build_ext --inplace --cythonize
All the commands above will show you detailed error messages if the compilation has failed.
Windows: For Windows you have to install C++ Distributable Library to compile the modules available here.
Conda¶
Please check if conda is available in the command line:
conda --version
If you are already familiar with conda you might want to use an environment you have already created, or you might need pymoo in an existing one.
Otherwise, create a new python environment with NumPy preinstalled and activate it:
conda create -n pymoo -y python==3.9 numpy
conda activate pymoo
pip install -U pymoo
If the environment is not set up correctly, the installation will NOT fail and you will still be able to use pymoo without the benefit of the compiled modules.