我目前正在尝试在网络驱动器上使用miniconda + jupyter(与pip一起安装)的组合,但是出现以下错误:
pywintypes.error:(50,“ GetFileSecurity”,“不支持该请求。”)
我目前正在公司环境中工作,因此我们在访问权限方面存在一些限制。不幸的是,我只能在网络驱动器上尝试jupyter,更改本地硬盘驱动器需要我没有的管理员权限。
完整的错误输出:
Traceback (most recent call last):
File "c:\programs\miniconda3_64\lib\site-packages\tornado\web.py", line 1699, in _execute
result = await result
File "c:\programs\miniconda3_64\lib\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "c:\programs\miniconda3_64\lib\site-packages\notebook\services\sessions\handlers.py", line 72, in post
type=mtype))
File "c:\programs\miniconda3_64\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "c:\programs\miniconda3_64\lib\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "c:\programs\miniconda3_64\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 88, in create_session
kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
File "c:\programs\miniconda3_64\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "c:\programs\miniconda3_64\lib\site-packages\tornado\gen.py", line 742, in run
yielded = self.gen.throw(*exc_info) # type: ignore
File "c:\programs\miniconda3_64\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 101, in start_kernel_for_session
self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
File "c:\programs\miniconda3_64\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "c:\programs\miniconda3_64\lib\site-packages\tornado\gen.py", line 209, in wrapper
yielded = next(result)
File "c:\programs\miniconda3_64\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 168, in start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs)
File "c:\programs\miniconda3_64\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
km.start_kernel(**kwargs)
File "c:\programs\miniconda3_64\lib\site-packages\jupyter_client\manager.py", line 240, in start_kernel
self.write_connection_file()
File "c:\programs\miniconda3_64\lib\site-packages\jupyter_client\connect.py", line 547, in write_connection_file
kernel_name=self.kernel_name
File "c:\programs\miniconda3_64\lib\site-packages\jupyter_client\connect.py", line 212, in write_connection_file
with secure_write(fname) as f:
File "c:\programs\miniconda3_64\lib\contextlib.py", line 82, in __enter__
return next(self.gen)
File "c:\programs\miniconda3_64\lib\site-packages\jupyter_client\connect.py", line 100, in secure_write
win32_restrict_file_to_user(fname)
File "c:\programs\miniconda3_64\lib\site-packages\jupyter_client\connect.py", line 61, in win32_restrict_file_to_user
sd = win32security.GetFileSecurity(fname, win32security.DACL_SECURITY_INFORMATION)
ywintypes.error: (50, 'GetFileSecurity', 'The request is not supported.')
您对这种错误有任何想法或经验吗?
答案 0 :(得分:5)
对于任何有此问题的人,这似乎是由于更新了jupyter笔记本或任何其他可以更新它的软件包所致。
解决此问题的步骤如下,
pip install jupyter
pip install jupyter-client==5.3.1
python -m ipykernel install --user
答案 1 :(得分:1)
您遇到的问题可能是由于我刚刚发现的浏览器以及jupyter实验室的运行权限所致。
我的原始答案可以在这里找到:https://github.com/jupyter/jupyter_client/issues/481
但是对于其他想要继续使用最新的Jupyter Lab / Notebook版本的人来说,这是我的故事:
(我运行预先安装有Jupyter的Anconda):
1-使用以下命令检查环境路径时: jupyter --paths 我得到两个漫游位置,一个用于运行时,另一个用于数据!这是因为我使用的是公司笔记本电脑,并且Windows已设置为将用户数据文件存储在网络上的漫游位置!
(base) C:\>jupyter --paths
config:
C:\Users\user_x\.jupyter
C:\ProgramData\Anaconda3\etc\jupyter
C:\ProgramData\jupyter
data:
\\A-FILEDATA-P\Profile\use_x\AppData\Roaming\jupyter
C:\ProgramData\Anaconda3\share\jupyter
C:\ProgramData\jupyter
runtime:
\\A-FILEDATA-P\Profile\use_x\AppData\Roaming\jupyter\runtime
(base) C:\>
2-因此,我尝试通过添加来修改C:\ Users \ user_xxx.jupyter \ jupyter_notebook_config.py
JUPYTER_RUNTIME_DIR = 'C:\Users\user_x\AppData\Roaming\jupyter\runtime'
但这没用!
2-但是,这里要注意一点:我注意到jupyter lab命令会触发我在可移动USB硬盘上拥有的“独立” Chrome!在企业Windows设置下,该计算机无权写入笔记本电脑上的其他文件夹位置,因此出现安全错误!
3-解决方案是在我的USB磁盘上设置两个文件夹,在这些文件夹中可以找到独立的Chrome,并设置环境变量以指向如下所示的位置:
set JUPYTER_RUNTIME_DIR=D:\jupyter\runtime
set JUPYTER_DATA_DIR=D:\jupyter
4-唯一要注意的是,您必须在每个新会话的开始时执行这两个命令,因为重新启动Jupyter Lab时,它们不会持续存在!正如@Shongololo指出的那样,您只能从命令行运行其他程序,例如Spyder,才能读取正确的设置!
还有待发现如何永久解决。