Error importing requests module


I wrote a script that uses the requests module:

import requests

import json
import logging
import time

r = requests.get('')

If I do:


It works, I get the intended output. If I run it with mitm:

# mitmdump -s 
Loading script:
Script error: Traceback (most recent call last):
  File "", line 4, in <module>
    import requests
ImportError: No module named 'requests'

Proxy server listening at

Some infos:

# mitmproxy --version
mitmproxy 1.0.2
# pip3 --version
pip 9.0.1 from /usr/local/lib/python3.5/dist-packages (python 3.5)
# python3 --version
Python 3.5.2


This was with the downloaded the binaries.

Install with pip3 solved the issue


The precompiled binaries bring their own Python environment - sorry for the confusion. Not sure if there’s any good reliable way to cover cases such as yours, I’d be happy to integrate that if there is!