title: Django ModuleNotFoundError: No module named 'asgiref'
body: <p>I have a Django service we are trying to schedule in conjunction with the main application that runs periodically to send automated emails via a batch script.</p>
  <p>The Django application itself starts up fine, but when I try running the batch script, I get the following traceback:</p>
  <pre><code>Traceback (most recent call last):                                                                                        
  File &quot;C:\Program Files\compuweather\compuweather\webapp\management\commands\send_all_clients.py&quot;, 
  line 2, in &lt;module&gt;     from django.core.management.base import BaseCommand                                                                   
  File &quot;C:\ProgramData\Anaconda3\lib\site-packages\django-3.2- 
  py3.8.egg\django\core\management\__init__.py&quot;, line 13, in &lt;module&gt;                                                                                                                   
  from django.apps import apps                                                                                          
  File &quot;C:\ProgramData\Anaconda3\lib\site-packages\django-3.2-py3.8.egg\django\apps\__init__.py&quot;, line 
  1, in &lt;module&gt;       from .config import AppConfig                                                                                         
  File &quot;C:\ProgramData\Anaconda3\lib\site-packages\django-3.2-py3.8.egg\django\apps\config.py&quot;, line 7, 
  in &lt;module&gt;         from django.utils.deprecation import RemovedInDjango41Warning                                                         
  File &quot;C:\ProgramData\Anaconda3\lib\site-packages\django-3.2-py3.8.egg\django\utils\deprecation.py&quot;, 
  line 5, in &lt;module&gt;                                                                                                                           
  from asgiref.sync import sync_to_async                                                                              
  ModuleNotFoundError: No module named asgiref
  </code></pre>
  <p>I find that odd considering I have the batch file set to run from an anaconda environment that has Asgiref installed. I can verify this with pip freeze. Here are the versions of the packages I'm using:</p>
  <p>asgiref==3.3.1<br />
  Django==3.1.6</p>
  <p>I saw a similar issue <a href="https://stackoverflow.com/questions/49245396/django-channels-no-module-named-asgiref-sync">here</a>, that was due to the Django and asgiref packages being outdated. I've tried updating both asgiref and Django to the latest versions (those listed), but that also didn't help.</p>
  <p>My best guess after looking through the traceback is either something is trying to use a deprecated package (hence the use of deprecation.py) or a path needs to be appended somewhere. If the former, is there an alternative I should be using?</p>
  <p>For reference, here is the batch file I am trying to use:</p>
  <pre><code>call C:\ProgramData\Anaconda3\Scripts\activate.bat C:\ProgramData\Anaconda3 
  call activate test
  &quot;C:\ProgramData\Anaconda3\Python.exe&quot; &quot;C:\Program Files\compuweather\compuweather\webapp\management\commands\send_all_clients.py&quot;
  </code></pre>