title: ImportError: No module named 'Adafruit_DHT' in flask application
body: <p>I am developing a weather station. I use a Raspberry Pi 2 as well as a DHT22 sensor. I use Adafruit to read the sensor's data. I installed it like described in their <a href="https://github.com/adafruit/Adafruit_Python_DHT" rel="nofollow noreferrer">Readme</a>. I tried both ways but unfortunately non of them worked.</p>
  
  <p>Reading the data works sometimes, but it does never work when I try to read it in my Flask application</p>
  
  <p>Here is my code:</p>
  
  <pre><code>import Adafruit_DHT
  app = Flask(__name__)
  
  sensor = Adafruit_DHT.DHT22
  gpio = 4
  
  
  @app.route('/')
  def index():
      return "This is the index page"
  
  @app.route('/humidity', methods=['GET'])
  def get_humidity():
      humidity, temperature = Adafruit_DHT.read_retry(sensor, gpio)
      return humidity
  
  @app.route('/temperature', methods=['GET'])
  def get_humidity():
      humidity, temperature = Adafruit_DHT.read_retry(sensor, gpio)
      return temperature
  
  @app.route('/all', methods=['GET'])
  def get_humidity():
      humidity, temperature = Adafruit_DHT.read_retry(sensor, gpio)
      return 'humidity='+humidity+';temperature='+temperature
  
  
  
  if __name__ == 'main':
      app.run()
  </code></pre>
  
  <p>Additionally, I had a look at the following answers on Stackoverflow.com:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/26246239/dht22-sensor-import-adafruit-dht-error">DHT22 Sensor import Adafruit_DHT error</a></li>
  <li><a href="https://stackoverflow.com/questions/26246239/dht22-sensor-import-adafruit-dht-error/26251405">DHT22 Sensor import Adafruit_DHT error</a></li>
  </ul>
  
  <p>I appreciate your help!</p>
  
  <p><strong>Update</strong>
  Adafruit works well if I disable the virtual environment</p>