On the general topic of Python performance, just importing needed modules can take a few seconds. The output of the code
import time
start = time.time()
import os
import numpy as np
import pandas as pd
import xgboost as xgb
from sklearn.metrics import mean_squared_error
from scipy.stats import pearsonr
import matplotlib.pyplot as plt
print("time elapsed (s):", "%0.3f"%(time.time() - start))
on my Windows machine istime elapsed (s): 2.630