Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

安装 PaddleX3 报错:FileNotFoundError: [WinError 2] 系统找不到指定的文件 #1954

Open
TommysLee opened this issue Aug 28, 2024 · 2 comments
Assignees

Comments

@TommysLee
Copy link

描述问题

在执行 paddlex --install 时,报错如下

Now download and update the repos: ['PaddleOCR', 'PaddleSeg', 'PaddleNLP', 'PaddleDetection', 'PaddleClas', 'PaddleTS'].
Traceback (most recent call last):
  File "\\?\C:\DevTools\miniconda\envs\px3\Scripts\paddlex-script.py", line 33, in <module>
    sys.exit(load_entry_point('paddlex', 'console_scripts', 'paddlex')())
  File "c:\users\easygrid\desktop\temp\paddlex\paddlex\paddlex_cli.py", line 109, in main
    install(args)
  File "c:\users\easygrid\desktop\temp\paddlex\paddlex\paddlex_cli.py", line 85, in install
    setup(
  File "c:\users\easygrid\desktop\temp\paddlex\paddlex\repo_manager\core.py", line 183, in setup
    getter.get(force=True, platform=platform)
  File "c:\users\easygrid\desktop\temp\paddlex\paddlex\repo_manager\repo.py", line 386, in get
    self.remove()
  File "c:\users\easygrid\desktop\temp\paddlex\paddlex\repo_manager\repo.py", line 394, in remove
    repo.remove()
  File "c:\users\easygrid\desktop\temp\paddlex\paddlex\repo_manager\repo.py", line 152, in remove
    remove_repo_using_rm(self.name)
  File "c:\users\easygrid\desktop\temp\paddlex\paddlex\repo_manager\utils.py", line 104, in remove_repo_using_rm
    return _check_call(['rm', '-rf', name])
  File "c:\users\easygrid\desktop\temp\paddlex\paddlex\repo_manager\utils.py", line 25, in _check_call
    return subprocess.check_call(*args, **kwargs)
  File "C:\DevTools\miniconda\envs\px3\lib\subprocess.py", line 364, in check_call
    retcode = call(*popenargs, **kwargs)
  File "C:\DevTools\miniconda\envs\px3\lib\subprocess.py", line 345, in call
    with Popen(*popenargs, **kwargs) as p:
  File "C:\DevTools\miniconda\envs\px3\lib\subprocess.py", line 966, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\DevTools\miniconda\envs\px3\lib\subprocess.py", line 1435, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] 系统找不到指定的文件。

环境

  • PaddleX3-beta
  • PaddlePaddle 3.0-beta
  • Windows 10 2024.8月更新版

注:Linux是否存在此问题,暂未测试

解决方案

修改文件:PaddleX/paddlex/repo_manager/core.py

183行force=True 修改为 force=False”

修改后core.py源码如下:

if len(repos_to_get) > 0:
    logging.info(
        f"Now download and update the repos: {list(repo.name for repo in repos_to_get)}."
    )
    getter.get(force=False, platform=platform) # Line 183
    logging.info("All repos are existing.")

问题定位

引发此问题的Code在:PaddleX/paddlex/repo_manager/repo.py 行386

# PaddleX/paddlex/repo_manager/repo.py 部分源码
class RepositoryGroupGetter(object):
    """ RepositoryGroupGetter """

    def __init__(self, repos):
        super().__init__()
        self.repos = repos

    def get(self, force=False, platform=None):
        """ clone """
        if force:
            self.remove()  # Line386 错误从此抛出
        for repo in self.repos:
            repo.download()
            repo.update(platform=platform)

    def remove(self):
        """ remove """
        for repo in self.repos:
            repo.remove()

其它

请飞桨的童鞋,评估下此问题是否为Bug
此问题 Win10 近期出现频率颇高

@TommysLee
Copy link
Author

此问题应该是没有充分考虑 Windows 系统,在 Windows 上 执行了 Linux 命令,导致报错。

Code Paddlex/paddlex/repo_manager/repo.py 行 149 代码块

def remove(self):
    """ remove """
    with switch_working_dir(self.repo_parent_dir):
        remove_repo_using_rm(self.name)  # Bug:这里应该根据不同OS 调用不同的方法

且看 remove_repo_using_rm 函数实现

源码 在 paddlex/repo_manager/utils.py 行 102 代码块

def remove_repo_using_rm(name):
    """ remove_repo_using_rm """
    return _check_call(['rm', '-rf', name])  # Linux Shell 命令

@Bobholamovic
Copy link
Member

感谢反馈! @TingquanGao 这个问题之前好像反馈过,建议是不是用shutil.rmtree代替rm呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants