Installation#

Install Python#

Cornac supports most versions of Python 3. If you have not done so, go to the official Python download page.

Install Cornac#

There are 3 different ways in which you could install cornac. Depending on your environment and requirements, choose and run the corresponding codes to install Cornac:

2. Using conda#

Conda is an open-source package management system and environment management system for installing, creating, and managing software environments on Windows, macOS, Linux, and other operating systems.

conda install cornac -c conda-forge

3. From GitHub source - For latest updates#

Should you require the latest updates of Cornac from GitHub, you could manually build and install using the following codes:

pip3 install git+https://github.com/PreferredAI/cornac.git

Model dependencies#

Certain models in Cornac may require additional dependencies. The requirements.txt file shows what dependencies are required for each model.

Take the model WMF for example.

models/wmf/requirements.txt PreferredAI/cornac#
tensorflow==2.12.0

In order to utilize this model, this dependency needs to be installed. To install all dependencies in a provided requirements.txt file, follow these steps:

  1. Using your favourite terminal/command prompt, navigate to the models in which you want to utilize

cd cornac/models/wmf
  1. Install the dependencies by using this command:

pip3 install -r requirements.txt

Note for MacOS users

Some algorithm implementations use OpenMP to support multi-threading. For MacOS users, in order to run those algorithms efficiently, you might need to install gcc from Homebrew to have an OpenMP compiler:

brew install gcc | brew link gcc

Verifying Installation#

After installing Cornac, you can verify that it has been successfully installed by running the following command on your favourite terminal/command prompt:

python3 -c "import cornac; print(cornac.__version__)"

You should see the following output:

2.2

Congratulations! Your machine has Cornac and you’re now ready to create your first experiment!

What’s next?#

Start creating your first experiment by following the Quickstart guide.