title: How to fix "Error loading psycopg2 module: No module named 'psycopg2"
body: <p>I deployed my django application with <code>sqlite3</code>, <code>uwsgi emperor mode</code> and <code>python v3.6.7</code> on <code>ubuntu 18.04</code>
  Now I changed database to <code>postgresql</code>, every thing worked fine in my local machine, but in the server when I run <code>uwsgi server.ini</code> (for testing purpose) I get this error:</p>
  
  <pre><code>django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: No module named 'psycopg2'
  </code></pre>
  
  <p>and application just shows "Internal Server Error" in the browser.</p>
  
  <ul>
  <li><strong>I can import <code>psycopg2</code> in the python shell without any error</strong></li>
  <li><code>psycopg2</code> is installed in my virtualenv</li>
  <li>I installed <code>python-psycopg2</code> using apt-get too</li>
  <li>django will run without any problem using <code>python manage.py runserver</code></li>
  <li>I did not use <code>sudo</code> with <code>pip</code> to install <code>psycopg2</code> </li>
  <li>django <code>settings.py</code> configs are right, because I performed migrations</li>
  </ul>
  
  <p>I read all similar problems and tried their answers, nothing worked :(</p>