I am in a virtualenv and trying to run through pip installs. I know the code works because outside the virtualenv this code has worked. I am running on a Windows 10 machine.
You should install python-dotenv
pip3 install python-dotenv
or
pip install python-dotenv
i.e
C:\Users\USER>pip3 install python-dotenv
Collecting python-dotenv
Downloading python_dotenv-0.8.2-py2.py3-none-any.whl
Installing collected packages: python-dotenv
Successfully installed python-dotenv-0.8.2
Refer this issue