Search code examples
pythonpipgoogle-colaboratory

Having an error while using diffcse for sentence embedding


I'm trying to use DiffCSE for sentence embedding in a Colab notebook provided by the community, but I'm encountering an error while installing the dependencies.

Building wheel for transformers (pyproject.toml) ... done
  Created wheel for transformers: filename=transformers-4.2.1-py3-none-any.whl size=1735899 sha256=1879670726df6662bb8f05f4491995ec7cce61e91df347d23cacbd0445338c74
  Stored in directory: /root/.cache/pip/wheels/21/30/b8/6fabc5bdee11ab94071e1f2763cdae4ff641c285160031fe6e
  error: subprocess-exited-with-error
  
  × Building wheel for tokenizers (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  Building wheel for tokenizers (pyproject.toml) ... error
  ERROR: Failed building wheel for tokenizers

what could be the reason and the solution of this problem.


Solution

  • The problem is in the version of the python that colab is using try downgrading the python to 3.8 version

    step 1:

        !apt-get update -y
    

    Step 2: install Python-3.8

        apt-get install python3.8 python3.8-distutils
    

    Step 3:

        !update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
    

    Step 4:

        !update-alternatives --config python3
    

    Step 5:

       !apt-get install python3-pip
       !python3 -m pip install --upgrade pip --user