简体   繁体   English

在Python中使用PySpark:WindowsError:[错误5]访问被拒绝

[英]Using PySpark in Python: WindowsError: [Error 5] Access is denied

I'm trying to run PySpark unit tests using PyBuilder under Windows 10 我正在尝试在Windows 10下使用PyBuilder运行PySpark单元测试

pyb_ clean install

All the necessary libraries are included into PYTHONPATH and they are available. 所有必需的库都包含在PYTHONPATH中,并且它们可用。

But when running I get the following error: 但是在运行时出现以下错误:

..\..\src\unittest\python\client_tests.py:11: in <module>
    from ut_setting import spark
..\..\src\unittest\python\ut_setting.py:75: in <module>
    spark = SparkSession.builder.master("local[4]").getOrCreate()
..\python\pyspark\sql\session.py:169: in getOrCreate
    sc = SparkContext.getOrCreate(sparkConf)
..\python\pyspark\context.py:307: in getOrCreate
    SparkContext(conf=conf or SparkConf())
..\python\pyspark\context.py:115: in __init__
    SparkContext._ensure_initialized(self, gateway=gateway, conf=conf)
..\python\pyspark\context.py:256: in _ensure_initialized
    SparkContext._gateway = gateway or launch_gateway(conf)
..\python\pyspark\java_gateway.py:82: in launch_gateway
    proc = Popen(['spark-submit.cmd', "-f"])
D:\Python27\Lib\subprocess.py:672: in __init__
    errread, errwrite)
D:\Python27\Lib\subprocess.py:882: in _execute_child
    startupinfo)
E   WindowsError: [Error 5] Access is denied

I've also tried to use different approaches: running using admin permissions, moving to another drive and etc. 我还尝试使用不同的方法:使用管理员权限运行,移动到其他驱动器等。

If I do the same on Linux, it works fine without any tuning. 如果我在Linux上执行相同操作,则无需任何调整即可正常工作。

Do you have any thoughts? 你有什么想法吗?

Thanks! 谢谢!

Try this: 尝试这个:

  1. Right click the Start button and click "Command Line (Admin)" (or "PowerShell (Admin)") 右键单击“开始”按钮,然后单击“命令行(管理员)”(或“ PowerShell(管理员)”)
  2. Run the installation command. 运行安装命令。
  3. ... ...
  4. PROFIT! 利润!

Thank you guys! 感谢大伙们!

I've managed to solve the issue. 我设法解决了这个问题。

The main reason was that I've tried to set admin permissions to the single processes, while I need to set the permissions to the whole pyspark directory. 主要原因是我尝试为单个进程设置管理员权限,而我需要为整个pyspark目录设置权限。

Right click on the directory -> Properties -> Security tab I've set "Full control" for "Everyone" and enabled inheritance. 右键单击目录->属性->安全选项卡,我为“所有人”设置了“完全控制”并启用了继承。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM