Skip to content

[BUG] Version 2.3.0 not working on Google Colab #655

Open

Description

@aymenkhs

Description

Import fails in Colab in latest version

In which platform does it happen?

Google Colab

How do we replicate the issue?

Install Cornac 2.3.0 using !pip install cornac==2.3.0 and import any part of the library.

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
[<ipython-input-2-2713bf83a8d2>](https://localhost:8080/#) in <cell line: 1>()
----> 1 import cornac

6 frames
[/usr/local/lib/python3.10/dist-packages/cornac/models/bpr/__init__.py](https://localhost:8080/#) in <module>
     14 # ============================================================================
     15 
---> 16 from .recom_bpr import BPR
     17 from .recom_wbpr import WBPR

ImportError: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.32' not found (required by /usr/local/lib/python3.10/dist-packages/cornac/models/bpr/recom_bpr.cpython-310-x86_64-linux-gnu.so)

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------

Expected behavior

The import should work normally

Other Comments

The following notebook shows the error : Notebook link

Activity

  1. qtuantruong commented on Dec 28, 2024

    @qtuantruong
    Member

    This is very tricky because some models of Cornac complied using gcc13 where Google Colab env doesn't have required libs installed. So, the solution is as follows:

    1. Run the following to install latest libstdc++6:
    !sudo add-apt-repository ppa:ubuntu-toolchain-r/test
    !sudo apt-get update
    !sudo apt-get install --only-upgrade libstdc++6
    1. Run the following and make sure you see GLIBCXX_3.4.32 in the output:
    !strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
    1. Restart Colab (Runtime -> restart session)
    2. Try import cornac again and see if it works
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions