title: crontab error "ImportError: No module named request" python runs OK in terminal - fails in crontab
body: <p>I am having difficulty in a running python script that calls module &quot;requests&quot; in crontab. This was fine a few days ago and then I had to change my authentication for Google (to send emails), then &quot;requests&quot; stopped working in crontab. The python script runs fine in a terminal but will not execute in crontab. &quot;requests&quot; is available and when I type &quot;pip3 show requests&quot; the following is displayed (note I replaced my user name with &quot;user&quot;):</p>
  <pre><code>$pip3 show requests
  
  Name: requests
  Version: 2.27.1
  Summary: Python HTTP for Humans.
  Home-page: https://requests.readthedocs.io
  Author: Kenneth Reitz
  Author-email: me@kennethreitz.org
  License: Apache 2.0
  Location: /home/user/.local/lib/python3.6/site-packages
  Requires: certifi, idna, urllib3, charset-normalizer
  </code></pre>
  <p>A simplified version of the python file I would like to execute in crontab is:</p>
  <pre><code>#!/usr/bin/env python...
  # -*- coding: utf-8 -*-
  import requests
  print ('End of code')
  </code></pre>
  <p>The file <em><strong>test_request.py</strong></em> executes fine in a terminal.</p>
  <p>I created a bash script called <em><strong>test_request.sh</strong></em> based on directions from this stack overflow page:</p>
  <p><a href="https://stackoverflow.com/questions/58984276/importerror-no-module-named-requests-in-crontab-python-script">&quot;ImportError: No module named requests&quot; in crontab Python script</a></p>
  <p>That bash script is this:</p>
  <pre><code>#!/bin/bash
  echo test_request.sh called: `date`
  HOME=/home/user/
  PYTHONPATH=/home/user/.local/lib/python3.6/site-packages
  cd /home/user/Documents/bjg_code/
  python ./test_request.py  2&gt;&amp;1 1&gt;/dev/null 
  
  </code></pre>
  <p>When I try to run the bash script in a terminal or in crontab I receive this error:</p>
  <pre><code>$bash test_request.sh 
  
  test_request.sh called: Sat Jun 11 14:18:46 EDT 2022
  Traceback (most recent call last):
    File &quot;./test_request.py&quot;, line 4, in &lt;module&gt;
      import requests
  ImportError: No module named requests
  </code></pre>
  <p>Any advice would be welcomed and appreciated.</p>
  <p>Thank you in advance.</p>