Creating a virtual environment
A virtual environment in Python is an isolated setup that ensures the reproducibility of dependencies, which are external libraries our project depends on.
For example, consider the following code:
import pandas as pd
df = pd.read_csv('df.csv')
df.to_markdown()
Here, we depend on Pandas, a third-party and open-source library available at: https://github.com/pandas-dev/pandas. Pandas provides the read_csv function, which returns a DataFrame. Since version 1.0.0, which can only run on Python 3.6.1 or higher, the DataFrame class also includes the to_markdown method. If we use earlier versions of Python or Pandas, this code may not run.
Generally, developers specify their required dependencies in a file named requirements.txt. In this book’s repository, you will find a specification of the external libraries that we use in requirements.txt, as shown in Figure 3:

Figure 3: Requirements.txt file for this book
...