Error importing requests module

I wrote a script that uses the requests module:

import requests

import json
import logging
import time

r = requests.get('https://api.github.com/events')
print(r.text)

If I do:

python3 test.py

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

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

Proxy server listening at http://0.0.0.0:8080

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!