Custom module not found error on google colab

Question:

I am trying to run a pytorch code in google colab. The github repository is:

GitHub – BrightXiaoHan/FaceDetector: A re-implementation of mtcnn. Joint training, tutorial and deployment together.

There is a custom module in google colab notebook. To build the module I have run python setup.py build_ext --inplace

My folder structure:

ls /content/drive/MyDrive/FaceDetector

doc  mtcnn  output  README.md  scripts  setup.py  tests  tutorial

I have also added in sys path

import sys
sys.path.append('/content/drive/MyDrive/FaceDetector')

So when I try to import it

import mtcnn

I am getting an error:

ModuleNotFoundError                       
Traceback (most recent call last)

[<ipython-input-61-eb80d650f81e>](https://localhost:8080/#) in <module>
----> 1 import mtcnn

---

2 frames

---

[/content/drive/MyDrive/FaceDetector/mtcnn/deploy/detect.py](https://localhost:8080/#) in <module>
      4 import time
      5 ----> 6 import mtcnn.utils.functional as func
      7       8 def _no_grad(func):

ModuleNotFoundError: No module named 'mtcnn.utils.functional'

Google Colab Notebook Link:
https://colab.research.google.com/drive/1KQRF-HmZA7EU13acnwIX0dFayRMIuQ-B?usp=sharing

Asked By: desertSniper87

||

Answers:

I needed to set my PYTHONPATH environment variable.

!PYTHONPATH=/content/drive/My Drive/FaceDetector python scripts/gen_pnet_train.py
Answered By: desertSniper87