Anaconda Python Conda pipbuild失败,出现WindowsError找不到文件 [英] Anaconda Python Conda pipbuild failed with WindowsError cannot find file

查看:124
本文介绍了Anaconda Python Conda pipbuild失败,出现WindowsError找不到文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近切换到了Anaconda Python发行版,并且我试图弄清一切.我想安装与yaml相关的软件包,我已经尝试过了,没有康达配方

conda pipbuild layered-yaml-attrdict-config

这将导致以下输出(我删除了系统路径中不相关的条目):

C:\Anaconda>conda install layered-yaml-attrdict-config
Fetching package metadata: ..
Error: No packages found matching: layered-yaml-attrdict-config

C:\Anaconda>conda pipbuild layered-yaml-attrdict-config
Fetching package metadata: ..
Creating standard recipe for layered-yaml-attrdict-config-14.06.7
Using url https://pypi.python.org/packages/source/l/layered-yaml-attrdict-config
/layered-yaml-attrdict-config-14.06.7.tar.gz (6147) for layered-yaml-attrdict-co
nfig.
Downloading layered-yaml-attrdict-config (use --no-download to skip this step)
Unpacking layered-yaml-attrdict-config...
done
working in c:\users\bnables\appdata\local\temp\1\tmp07kkdbconda_skeleton_layered
-yaml-attrdict-config
Fetching package metadata: ...
Solving package specifications: .
The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    python-2.7.7               |                2        17.1 MB

The following packages will be linked:

    package                    |            build
    ---------------------------|-----------------
    python-2.7.7               |                2   hard-link
    pyyaml-3.11                |           py27_0   hard-link
    setuptools-3.6             |           py27_0   hard-link

Fetching packages ...
python-2.7.7-2 100% |###############################| Time: 0:00:08   2.00 MB/s
Extracting packages ...
[      COMPLETE      ] |#################################################| 100%
Linking packages ...
[      COMPLETE      ] |#################################################| 100%
Applying patch: u'c:\\users\\bnables\\appdata\\local\\temp\\1\\tmp07kkdbconda_sk
eleton_layered-yaml-attrdict-config\\pypi-distutils.patch'
Error:
    Did not find 'patch' in: C:\Anaconda\envs\_build\Scripts;C:\Anaconda\Scripts
;C:\Anaconda;C:\Anaconda\Scripts

    You can install 'patch' using apt-get, yum (Linux), Xcode (MacOSX),
    or conda, cygwin (Windows),


conda create -n _pipbuild_ --yes python pip
Fetching package metadata: ..
Solving package specifications: .
Package plan for installation in environment C:\Anaconda\envs\_pipbuild_:

The following packages will be linked:

    package                    |            build
    ---------------------------|-----------------
    pip-1.5.6                  |           py27_0   hard-link
    python-2.7.7               |                2   hard-link
    setuptools-3.6             |           py27_0   hard-link

WARNING: the process C:\Anaconda\python.exe C:\Anaconda\Scripts\conda-script.py
pipbuild layered-yaml-attrdict-config (7712) is running
WARNING: the process C:\Anaconda\Scripts\conda-pipbuild.exe layered-yaml-attrdic
t-config (4596) is running
WARNING: the process C:\Anaconda\python.exe C:\Anaconda\Scripts\conda-pipbuild-s
cript.py layered-yaml-attrdict-config (7208) is running
WARNING: Continuing installation while the above processes are running is
not recommended.  Please, close all Anaconda programs before installing or
updating things with conda.

Extracting packages ...
[      COMPLETE      ] |#################################################| 100%
Linking packages ...
[      COMPLETE      ] |#################################################| 100%
#
# To activate this environment, use:
# > activate _pipbuild_
#
C:\Anaconda\envs\_pipbuild_/bin/pip install layered-yaml-attrdict-config==14.06.
7
Traceback (most recent call last):
  File "C:\Anaconda\Scripts\conda-pipbuild-script.py", line 4, in <module>
    sys.exit(main())
  File "C:\Anaconda\lib\site-packages\conda_build\main_pipbuild.py", line 76, in
 main
    args.func(args, p)
  File "C:\Anaconda\lib\site-packages\conda_build\main_pipbuild.py", line 347, i
n execute
    build_package(package, version)
  File "C:\Anaconda\lib\site-packages\conda_build\main_pipbuild.py", line 300, i
n build_package
    directory, dependencies = make_recipe(package, version)
  File "C:\Anaconda\lib\site-packages\conda_build\main_pipbuild.py", line 244, i
n make_recipe
    depends = get_all_dependencies(package, version)
  File "C:\Anaconda\lib\site-packages\conda_build\main_pipbuild.py", line 214, i
n get_all_dependencies
    ret = subprocess.Popen(cmd2.split()).wait()
  File "C:\Anaconda\lib\subprocess.py", line 710, in __init__
    errread, errwrite)
  File "C:\Anaconda\lib\subprocess.py", line 958, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

C:\Anaconda>

我不确定发生了什么,因为我不知道它在寻找什么文件,而且我对conda食谱一无所知,除非它们被认为是很棒的,并且不会出现此类错误./p>

我希望通过conda进行安装,以便所有内容都可以由conda管理,而不是由pip管理.

挖入main_pipbuild.py源代码,似乎正在尝试运行C:\Anaconda\envs\_pipbuild_\bin\pip install package==version(具有适当的软件包和版本).当我查看C:\ Anaconda \ envs_pipbuild_时,没有bin文件夹,因此我猜测pip没有正确安装到 pipbuild 环境中.先前关于没有补丁"的警告也可能是一个问题...

conda install patch安装patch后,我再次尝试了以下结果:

C:\Anaconda>conda pipbuild layered-yaml-attrdict-config
Fetching package metadata: ..
Creating standard recipe for layered-yaml-attrdict-config-14.06.7
Using url https://pypi.python.org/packages/source/l/layered-yaml-attrdict-config/layered-yaml-attrdict-config-14.06.7.ta
r.gz (6147) for layered-yaml-attrdict-config.
Downloading layered-yaml-attrdict-config (use --no-download to skip this step)
Unpacking layered-yaml-attrdict-config...
done
working in c:\users\bnables\appdata\local\temp\1\tmp7cuibgconda_skeleton_layered-yaml-attrdict-config
Fetching package metadata: ...
Solving package specifications: .69 unparsed bytes left at the end of stream
file 1/1:        core.py
 hunk no.1 doesn't match source file at line 165
  expected:
  actual  :                 raise SystemExit, "error: " + str(msg)
source file is different - core.py

Applying patch: u'c:\\users\\bnables\\appdata\\local\\temp\\1\\tmp7cuibgconda_skeleton_layered-yaml-attrdict-config\\pyp
i-distutils.patch'
Traceback (most recent call last):
  File "C:\Anaconda\Scripts\conda-skeleton-script.py", line 4, in <module>
    sys.exit(main())
  File "C:\Anaconda\lib\site-packages\conda_build\main_skeleton.py", line 124, in main
    args.func(args, p)
  File "C:\Anaconda\lib\site-packages\conda_build\main_skeleton.py", line 135, in execute
    pypi.main(args, parser)
  File "C:\Anaconda\lib\site-packages\conda_build\pypi.py", line 314, in main
    run_setuppy(src_dir, tempdir, args)
  File "C:\Anaconda\lib\site-packages\conda_build\pypi.py", line 485, in run_setuppy
    apply_patch(join(stdlib_dir, 'distutils'), patch)
  File "C:\Anaconda\lib\site-packages\conda_build\source.py", line 202, in apply_patch
    check_call([patch, '-p0', '-i', path], cwd=src_dir)
  File "C:\Anaconda\lib\subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '[u'C:\\Anaconda\\Scripts\\patch.bat', u'-p0', u'-i', u'c:\\users\\bnables\\appda
ta\\local\\temp\\1\\tmp7cuibgconda_skeleton_layered-yaml-attrdict-config\\pypi-distutils.patch']' returned non-zero exit
 status -1

conda create -n _pipbuild_ --yes python pip
Error: prefix already exists: C:\Anaconda\envs\_pipbuild_
C:\Anaconda\envs\_pipbuild_/bin/pip install layered-yaml-attrdict-config==14.06.7
Traceback (most recent call last):
  File "C:\Anaconda\Scripts\conda-pipbuild-script.py", line 4, in <module>
    sys.exit(main())
  File "C:\Anaconda\lib\site-packages\conda_build\main_pipbuild.py", line 76, in main
    args.func(args, p)
  File "C:\Anaconda\lib\site-packages\conda_build\main_pipbuild.py", line 347, in execute
    build_package(package, version)
  File "C:\Anaconda\lib\site-packages\conda_build\main_pipbuild.py", line 300, in build_package
    directory, dependencies = make_recipe(package, version)
  File "C:\Anaconda\lib\site-packages\conda_build\main_pipbuild.py", line 244, in make_recipe
    depends = get_all_dependencies(package, version)
  File "C:\Anaconda\lib\site-packages\conda_build\main_pipbuild.py", line 214, in get_all_dependencies
    ret = subprocess.Popen(cmd2.split()).wait()
  File "C:\Anaconda\lib\subprocess.py", line 710, in __init__
    errread, errwrite)
  File "C:\Anaconda\lib\subprocess.py", line 958, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

因此,它可能在Solving package specifications: .69 unparsed bytes left at the end of stream处发现了某种包装问题.然后,它执行此修补程序操作,该操作显然失败了.然后,它尝试执行pip install并再次在 pipbuild 环境中找不到bin/pip目录.

是否应该在C:\Anaconda\envs\_pipbuild_\Scripts\pip.exe上寻找点子?因为那确实存在.

如果这是一个错误,请在此处进行报告: https://github.com/conda/conda-build/issues .我将等待反馈,然后再执行其他操作.

任何帮助都会很棒!

解决方案

在Python 3上,this yaml-related package and since there isn't already a conda recipe for it, I tried

conda pipbuild layered-yaml-attrdict-config

which resulted in the following output (I removed non-relevant entries of my system path):

C:\Anaconda>conda install layered-yaml-attrdict-config
Fetching package metadata: ..
Error: No packages found matching: layered-yaml-attrdict-config

C:\Anaconda>conda pipbuild layered-yaml-attrdict-config
Fetching package metadata: ..
Creating standard recipe for layered-yaml-attrdict-config-14.06.7
Using url https://pypi.python.org/packages/source/l/layered-yaml-attrdict-config
/layered-yaml-attrdict-config-14.06.7.tar.gz (6147) for layered-yaml-attrdict-co
nfig.
Downloading layered-yaml-attrdict-config (use --no-download to skip this step)
Unpacking layered-yaml-attrdict-config...
done
working in c:\users\bnables\appdata\local\temp\1\tmp07kkdbconda_skeleton_layered
-yaml-attrdict-config
Fetching package metadata: ...
Solving package specifications: .
The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    python-2.7.7               |                2        17.1 MB

The following packages will be linked:

    package                    |            build
    ---------------------------|-----------------
    python-2.7.7               |                2   hard-link
    pyyaml-3.11                |           py27_0   hard-link
    setuptools-3.6             |           py27_0   hard-link

Fetching packages ...
python-2.7.7-2 100% |###############################| Time: 0:00:08   2.00 MB/s
Extracting packages ...
[      COMPLETE      ] |#################################################| 100%
Linking packages ...
[      COMPLETE      ] |#################################################| 100%
Applying patch: u'c:\\users\\bnables\\appdata\\local\\temp\\1\\tmp07kkdbconda_sk
eleton_layered-yaml-attrdict-config\\pypi-distutils.patch'
Error:
    Did not find 'patch' in: C:\Anaconda\envs\_build\Scripts;C:\Anaconda\Scripts
;C:\Anaconda;C:\Anaconda\Scripts

    You can install 'patch' using apt-get, yum (Linux), Xcode (MacOSX),
    or conda, cygwin (Windows),


conda create -n _pipbuild_ --yes python pip
Fetching package metadata: ..
Solving package specifications: .
Package plan for installation in environment C:\Anaconda\envs\_pipbuild_:

The following packages will be linked:

    package                    |            build
    ---------------------------|-----------------
    pip-1.5.6                  |           py27_0   hard-link
    python-2.7.7               |                2   hard-link
    setuptools-3.6             |           py27_0   hard-link

WARNING: the process C:\Anaconda\python.exe C:\Anaconda\Scripts\conda-script.py
pipbuild layered-yaml-attrdict-config (7712) is running
WARNING: the process C:\Anaconda\Scripts\conda-pipbuild.exe layered-yaml-attrdic
t-config (4596) is running
WARNING: the process C:\Anaconda\python.exe C:\Anaconda\Scripts\conda-pipbuild-s
cript.py layered-yaml-attrdict-config (7208) is running
WARNING: Continuing installation while the above processes are running is
not recommended.  Please, close all Anaconda programs before installing or
updating things with conda.

Extracting packages ...
[      COMPLETE      ] |#################################################| 100%
Linking packages ...
[      COMPLETE      ] |#################################################| 100%
#
# To activate this environment, use:
# > activate _pipbuild_
#
C:\Anaconda\envs\_pipbuild_/bin/pip install layered-yaml-attrdict-config==14.06.
7
Traceback (most recent call last):
  File "C:\Anaconda\Scripts\conda-pipbuild-script.py", line 4, in <module>
    sys.exit(main())
  File "C:\Anaconda\lib\site-packages\conda_build\main_pipbuild.py", line 76, in
 main
    args.func(args, p)
  File "C:\Anaconda\lib\site-packages\conda_build\main_pipbuild.py", line 347, i
n execute
    build_package(package, version)
  File "C:\Anaconda\lib\site-packages\conda_build\main_pipbuild.py", line 300, i
n build_package
    directory, dependencies = make_recipe(package, version)
  File "C:\Anaconda\lib\site-packages\conda_build\main_pipbuild.py", line 244, i
n make_recipe
    depends = get_all_dependencies(package, version)
  File "C:\Anaconda\lib\site-packages\conda_build\main_pipbuild.py", line 214, i
n get_all_dependencies
    ret = subprocess.Popen(cmd2.split()).wait()
  File "C:\Anaconda\lib\subprocess.py", line 710, in __init__
    errread, errwrite)
  File "C:\Anaconda\lib\subprocess.py", line 958, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

C:\Anaconda>

I'm not sure what happened since I don't know what file it was looking for and I don't yet know anything about conda recipes except they're supposed to be awesome and not give these kinda of errors.

I was hoping to install through conda so that everything could be managed by conda instead of some stuff being managed by pip.

Digging into the main_pipbuild.py source it looks like it's trying to run C:\Anaconda\envs\_pipbuild_\bin\pip install package==version (with the appropriate package and version). When I look at my C:\Anaconda\envs_pipbuild_ there is no bin folder, so I'm guessing pip didn't get installed into the pipbuild environment correctly. The previous warnings about not having "patch" may also be a problem...

After installing patch with conda install patch I tried again with the following results:

C:\Anaconda>conda pipbuild layered-yaml-attrdict-config
Fetching package metadata: ..
Creating standard recipe for layered-yaml-attrdict-config-14.06.7
Using url https://pypi.python.org/packages/source/l/layered-yaml-attrdict-config/layered-yaml-attrdict-config-14.06.7.ta
r.gz (6147) for layered-yaml-attrdict-config.
Downloading layered-yaml-attrdict-config (use --no-download to skip this step)
Unpacking layered-yaml-attrdict-config...
done
working in c:\users\bnables\appdata\local\temp\1\tmp7cuibgconda_skeleton_layered-yaml-attrdict-config
Fetching package metadata: ...
Solving package specifications: .69 unparsed bytes left at the end of stream
file 1/1:        core.py
 hunk no.1 doesn't match source file at line 165
  expected:
  actual  :                 raise SystemExit, "error: " + str(msg)
source file is different - core.py

Applying patch: u'c:\\users\\bnables\\appdata\\local\\temp\\1\\tmp7cuibgconda_skeleton_layered-yaml-attrdict-config\\pyp
i-distutils.patch'
Traceback (most recent call last):
  File "C:\Anaconda\Scripts\conda-skeleton-script.py", line 4, in <module>
    sys.exit(main())
  File "C:\Anaconda\lib\site-packages\conda_build\main_skeleton.py", line 124, in main
    args.func(args, p)
  File "C:\Anaconda\lib\site-packages\conda_build\main_skeleton.py", line 135, in execute
    pypi.main(args, parser)
  File "C:\Anaconda\lib\site-packages\conda_build\pypi.py", line 314, in main
    run_setuppy(src_dir, tempdir, args)
  File "C:\Anaconda\lib\site-packages\conda_build\pypi.py", line 485, in run_setuppy
    apply_patch(join(stdlib_dir, 'distutils'), patch)
  File "C:\Anaconda\lib\site-packages\conda_build\source.py", line 202, in apply_patch
    check_call([patch, '-p0', '-i', path], cwd=src_dir)
  File "C:\Anaconda\lib\subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '[u'C:\\Anaconda\\Scripts\\patch.bat', u'-p0', u'-i', u'c:\\users\\bnables\\appda
ta\\local\\temp\\1\\tmp7cuibgconda_skeleton_layered-yaml-attrdict-config\\pypi-distutils.patch']' returned non-zero exit
 status -1

conda create -n _pipbuild_ --yes python pip
Error: prefix already exists: C:\Anaconda\envs\_pipbuild_
C:\Anaconda\envs\_pipbuild_/bin/pip install layered-yaml-attrdict-config==14.06.7
Traceback (most recent call last):
  File "C:\Anaconda\Scripts\conda-pipbuild-script.py", line 4, in <module>
    sys.exit(main())
  File "C:\Anaconda\lib\site-packages\conda_build\main_pipbuild.py", line 76, in main
    args.func(args, p)
  File "C:\Anaconda\lib\site-packages\conda_build\main_pipbuild.py", line 347, in execute
    build_package(package, version)
  File "C:\Anaconda\lib\site-packages\conda_build\main_pipbuild.py", line 300, in build_package
    directory, dependencies = make_recipe(package, version)
  File "C:\Anaconda\lib\site-packages\conda_build\main_pipbuild.py", line 244, in make_recipe
    depends = get_all_dependencies(package, version)
  File "C:\Anaconda\lib\site-packages\conda_build\main_pipbuild.py", line 214, in get_all_dependencies
    ret = subprocess.Popen(cmd2.split()).wait()
  File "C:\Anaconda\lib\subprocess.py", line 710, in __init__
    errread, errwrite)
  File "C:\Anaconda\lib\subprocess.py", line 958, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

So it finds some kind of problem with the package perhaps at Solving package specifications: .69 unparsed bytes left at the end of stream. Then it does this patch thing which apparently fails. Then it tries to do pip install and again can't find the bin/pip directory in the pipbuild environment.

Should it be looking for pip at C:\Anaconda\envs\_pipbuild_\Scripts\pip.exe? Because that does exist.

If this is a bug, here's where to report it: https://github.com/conda/conda-build/issues. I'll wait for feedback before doing any more.

Any help would be great!

解决方案

There is a fix for the same issue on Python 3 at https://groups.google.com/a/continuum.io/d/msg/anaconda/6_reeaIjx5c/fhRjbA4AdQkJ. It involves editing the distutils\cygwinccompiler.py file in the Python standard library.

I think you can do the same thing in Python 2, though it may require some translation, as the Python 2 version of cygwinccompiler uses os.popen instead of subprocess.check_output. Assumedly you can just use subprocess.check_output(['gcc', '-dumpmachine'], shell=True) in the relevant place in the file and it will fix the issue.

这篇关于Anaconda Python Conda pipbuild失败,出现WindowsError找不到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆