cornac icon indicating copy to clipboard operation
cornac copied to clipboard

Unable to Install Cornac on Mac

Open monuoha opened this issue 1 year ago • 15 comments

Description

Whenever I try to install cornac, several Cython files refuse to compile.

In which platform does it happen?

macOS 12.7.3

How do we replicate the issue?

Run pip install cornac in Terminal

Expected behavior (i.e. solution)

The terminal command should be able to install the cornac package with no problems.

Other Comments

monuoha avatar Apr 02 '24 03:04 monuoha

Hi @monuoha,

In order to pinpoint the issue, could you share with us the exact error?

darrylong avatar Apr 02 '24 03:04 darrylong

Example of Cython file not compiling:

Error compiling Cython file: ------------------------------------------------------------ ... from ...utils import get_rng from ...utils.init_utils import uniform

  cdef floating _dot(int n, floating *x, int incx,
                     floating *y, int incy) noexcept nogil:
                                           ^
  ------------------------------------------------------------
  
  cornac/models/efm/recom_efm.pyx:39:42: Syntax error in C variable declaration
  cythoning cornac/models/comparer/recom_comparer_obj.pyx to cornac/models/comparer/recom_comparer_obj.cpp

monuoha avatar Apr 02 '24 03:04 monuoha

@monuoha may we know what is the version of Python that you're using?

Currently, we have pre-built binaries of Cornac for Python 3.8-3.11 on MacOS on PyPI. If you're also using one of those versions, it shouldn't recompile the Cython modules again.

qtuantruong avatar Apr 02 '24 05:04 qtuantruong

I currently use Python 3.8.8.

monuoha avatar Apr 02 '24 12:04 monuoha

That's very interesting. At the moment, it's challenging to setup the same environment as yours. May I suggest the following options:

  1. Use Conda to install Cornac.
  2. Reinstall C++ compiler using Homebrew with brew install gcc | brew link gcc, then try to install Cornac again using pip.

Let us know if it resolves your issue.

qtuantruong avatar Apr 02 '24 17:04 qtuantruong

Hello, I finally managed to install cornac using conda, but I only got version 1.7.1. How do I upgrade it to 2.1.0?

monuoha avatar Apr 03 '24 22:04 monuoha

@monuoha could you double check if it's installed from the conda-forge channel?

qtuantruong avatar Apr 03 '24 22:04 qtuantruong

conda install cornac -c conda-forge

The above command is what I used to install conda.

monuoha avatar Apr 03 '24 22:04 monuoha

You can check which version and which channel the package is pull from as shown in the image below: Screenshot 2024-04-03 at 3 43 08 PM

qtuantruong avatar Apr 03 '24 22:04 qtuantruong

How do I access that image, I exited out of the terminal window right after cornac was installed.

monuoha avatar Apr 03 '24 22:04 monuoha

you'll see it when you run the command conda install cornac -c conda-forge

qtuantruong avatar Apr 03 '24 23:04 qtuantruong

I already ran the command, and this is what it showed me:

Collecting package metadata (current_repodata.json): - WARNING conda.models.version:get_matcher(538): Using .* with relational operator is superfluous and deprecated and will be removed in a future version of conda. Your spec was 1.7.1.*, but conda is ignoring the .* and treating it as 1.7.1
done
Solving environment: done


==> WARNING: A newer version of conda exists. <==
  current version: 4.14.0
  latest version: 24.3.0

Please update conda by running

    $ conda update -n base -c conda-forge conda



# All requested packages already installed.

Retrieving notices: ...working... done

monuoha avatar Apr 03 '24 23:04 monuoha

you can uninstall cornac with conda uninstall cornac and try again with the command above

qtuantruong avatar Apr 03 '24 23:04 qtuantruong

I uninstalled it and then reinstalled it, and here is what I got

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    conda-22.9.0               |   py38h50d1736_2         966 KB  conda-forge
    ------------------------------------------------------------
                                           Total:         966 KB

The following NEW packages will be INSTALLED:

  cornac             conda-forge/osx-64::cornac-1.7.1-py38h9529b5f_0 None
  python_abi         conda-forge/osx-64::python_abi-3.8-2_cp38 None

The following packages will be UPDATED:

  conda              pkgs/main::conda-22.9.0-py38hecd8cb5_0 --> conda-forge::conda-22.9.0-py38h50d1736_2 None

monuoha avatar Apr 04 '24 01:04 monuoha

Also, another issue that I encountered when using cornac is that my kernel on Jupyter Notebook would always die whenever I try to train the BPR model.

monuoha avatar Apr 04 '24 01:04 monuoha