The pymoo framework can be run with and without compiled modules. Some computationally more expensive function have been implemented using Cython for speedup. To figure out what version is used after the installation please see Plain/Compiled Modules section.
Setting up the Python environment using Conda¶
Here, we are setting up the environment in order to be able to use the speedup of Cython. Therefore, before using the install command, the environment needs to be set up. We recommend using miniconda or anaconda.
Please check if conda is available in your current terminal:
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.7 numpy conda activate pymoo
If the environment is not setup correct, the installation will NOT fail and you will still be able to use pymoo without the benefit of the compiled modules.
To use the current stable release of pymoo use
pip install -U pymoo
If you have already installed an older version of the framework you can force an update by using the -U option as shown above.
To forcefully fetch and recompile the package is might be necessary to disable the local cache created by pip.
pip install -U --no-cache-dir pymoo
If you like to use our current development version or like to contribute to our framework you can install the current version on GitHub by
git clone https://github.com/msu-coinlab/pymoo cd pymoo pip install .
To compile the modules or see an output log:
pip install Cython make compile-with-cython
This translates the pyx files to cpp files and then compiles them. If anything fails this will provide more details about why this has happened.
As said above, the pymoo installation will not fail if the modules are not compiled successfully, but no speedup will be available. To check if the compilation has worked during the installation, you can use the following command:
python -c "from pymoo.util.function_loader import is_compiled;print('Compiled Extensions: ', is_compiled())"
If no compilation is available, we recommend pulling the latest stable release from GitHub and to execute
This shows detailed error messages why the compilation was not successful.