title: install and run fairseq in google colab (ModuleNotFoundError: No module named 'fairseq')
body: <p>Until yesterday, we installed fairseq normally and executed it.</p>
  <p>An error called &quot;ModuleNotFoundError: No module named 'fairseq'&quot; suddenly occurred today.</p>
  <p>Does anyone know how to solve this?</p>
  <p>install fairseq...</p>
  <pre><code>!git clone https://private_information.../fairseq.git
  %cd /content/fairseq/fairseq-master/
  !git reset --hard dafault
  !pip install --editable ./
  %cd /content
  </code></pre>
  <p>install log...</p>
  <pre><code>Cloning into 'fairseq'...
  remote: Enumerating objects: 669, done.
  remote: Counting objects: 100% (669/669), done.
  remote: Compressing objects: 100% (520/520), done.
  remote: Total 669 (delta 164), reused 635 (delta 130), pack-reused 0
  Receiving objects: 100% (669/669), 2.95 MiB | 16.17 MiB/s, done.
  Resolving deltas: 100% (164/164), done.
  /content/fairseq/fairseq-master
  HEAD is now at 16bea6e default
  Obtaining file:///content/fairseq/fairseq-master
    Installing build dependencies ... done
    Getting requirements to build wheel ... done
    Installing backend dependencies ... done
      Preparing wheel metadata ... done
  Collecting sacrebleu
    Downloading https://files.pythonhosted.org/packages/23/d3/be980ad7cda7c4bbfa97ee3de062fb3014fc1a34d6dd5b82d7b92f8d6522/sacrebleu-1.4.13-py3-none-any.whl (43kB)
       |████████████████████████████████| 51kB 2.0MB/s 
  Requirement already satisfied: cffi in /usr/local/lib/python3.6/dist-packages (from fairseq==0.9.0) (1.14.2)
  Requirement already satisfied: tqdm in /usr/local/lib/python3.6/dist-packages (from fairseq==0.9.0) (4.41.1)
  Requirement already satisfied: numpy in /usr/local/lib/python3.6/dist-packages (from fairseq==0.9.0) (1.18.5)
  Requirement already satisfied: torch in /usr/local/lib/python3.6/dist-packages (from fairseq==0.9.0) (1.6.0+cu101)
  Requirement already satisfied: regex in /usr/local/lib/python3.6/dist-packages (from fairseq==0.9.0) (2019.12.20)
  Requirement already satisfied: cython in /usr/local/lib/python3.6/dist-packages (from fairseq==0.9.0) (0.29.21)
  Collecting portalocker
    Downloading https://files.pythonhosted.org/packages/89/a6/3814b7107e0788040870e8825eebf214d72166adf656ba7d4bf14759a06a/portalocker-2.0.0-py2.py3-none-any.whl
  Requirement already satisfied: pycparser in /usr/local/lib/python3.6/dist-packages (from cffi-&gt;fairseq==0.9.0) (2.20)
  Requirement already satisfied: future in /usr/local/lib/python3.6/dist-packages (from torch-&gt;fairseq==0.9.0) (0.16.0)
  Installing collected packages: portalocker, sacrebleu, fairseq
    Running setup.py develop for fairseq
  Successfully installed fairseq portalocker-2.0.0 sacrebleu-1.4.13
  /content
  </code></pre>
  <p>run...</p>
  <pre><code>!python /content/fairseq/fairseq-master/fairseq_cli/train.py \
      /data_dir \
      --arch transformer_align --share-all-embeddings \
      --optimizer adam --adam-betas '(0.9, 0.98)' --clip-norm 0.0 --activation-fn relu\
      --lr 0.0007 --lr-scheduler inverse_sqrt --warmup-updates 4000 --warmup-init-lr 1e-07 \
      --dropout 0.3 --attention-dropout 0.1 --weight-decay 0.0\
      --max-tokens 3500 --label-smoothing 0.1 \
      --save-dir /save_dir/ --log-interval 200 --max-epoch 20 \
      --keep-interval-updates -1 --save-interval-updates 0 --criterion label_smoothed_cross_entropy \
      --update-freq 8 \
     
  </code></pre>
  <p>run log...</p>
  <pre><code>Traceback (most recent call last):
    File &quot;/content/fairseq/fairseq-master/fairseq_cli/train.py&quot;, line 20, in &lt;module&gt;
      from fairseq import (
  ModuleNotFoundError: No module named 'fairseq'
  </code></pre>