title: Get and install requirements.txt for python file into virtualenv
body: <p>I have the following packages I need to install into my virtual environment for an app deployment. This is how they read at the top of my app's file:</p>
  <pre><code>import dash
  import dash_core_components as dcc
  import dash_html_components as html
  import dash_bootstrap_components as dbc
  from dash.dependencies import Input, Output
  
  import pandas as pd
  import numpy as np
  import matplotlib.pyplot as plt
  from datetime import datetime, timedelta, date
  from dateutil.relativedelta import relativedelta
  from sklearn.linear_model import LinearRegression
  from sklearn.model_selection import train_test_split
  from scipy import stats
  from sklearn import metrics
  import plotly.express as px
  import plotly.graph_objects as go
  import plotly.figure_factory as ff
  import statsmodels.api as sm
  </code></pre>
  <p>I'm not sure how to install the ones that say &quot;from x import y, z&quot;. I'd also much prefer to do something more global(?) than install each thing one by one into the virtualenv.</p>
  <p>As I understand it, the pip freeze &gt; requirements.txt command only generates a requirements file based on what's manually been installed into the virtualenv. I'd rather get something together that looks at my app file and generates a requirements.txt based on that, and then install the contents of the requirements.txt into the virtualenv directly, as opposed to installing each package one by one.</p>