wan*_*nik 8 python psutil pyspark
我正在使用PySpark 1.5.2.我UserWarning Please install psutil to have better support with spilling发出命令后得到了.collect()
为什么会出现此警告?
我该如何安装psutil?
Cas*_*law 14
pip install psutil
Run Code Online (Sandbox Code Playgroud)
如果你需要专门为python 2或3安装,请尝试使用pip2或pip3; 它适用于两个主要版本.这是psutil的PyPI包.
您可以在以下链接中克隆或下载 psutil 项目: https: //github.com/giampaolo/psutil.git
然后运行setup.py来安装psutil
在'spark/python/pyspark/shuffle.py'中可以看到以下代码:
def get_used_memory():
""" Return the used memory in MB """
if platform.system() == 'Linux':
for line in open('/proc/self/status'):
if line.startswith('VmRSS:'):
return int(line.split()[1]) >> 10
else:
warnings.warn("Please install psutil to have better "
"support with spilling")**
if platform.system() == "Darwin":
import resource
rss = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
return rss >> 20
# TODO: support windows
return 0
Run Code Online (Sandbox Code Playgroud)
所以我想如果你的操作系统不是Linux,那么建议使用psutil。