首页 > 解决方案 > 为 pypolymake 构建 conda 包时出错

问题描述

我在 Windows 10 上使用 miniconda(有关 的输出,请参见下面的编辑 2 conda info)。我想使用 PyPI 包pypolymake。因此,我尝试按照此处给出的说明使用 conda 骨架构建 conda 包。在开始之前,我conda install git conda-build按照先决条件中的建议成功运行。

在我的 Anaconda Prompt 中运行命令conda skeleton pypi pypolymake时,我收到以下错误:

(base) C:\Users\Christoph>conda skeleton pypi pypolymake
Warning, the following versions were found for pypolymake
0.1.beta1
0.1.beta2
0.1.beta3
0.1b4
0.1b5
0.1b6
0.1b7
Using 0.1b7
Use --version to specify a different version.
Using url https://files.pythonhosted.org/packages/0e/d8/ea0989a21a5a8dd0d97f01a379348c3b3b389aabec91124186b94ec69a12/pypolymake-0.1b7.tar.gz (113 KB) for pypolymake.
Downloading pypolymake
PyPI URL:  https://files.pythonhosted.org/packages/0e/d8/ea0989a21a5a8dd0d97f01a379348c3b3b389aabec91124186b94ec69a12/pypolymake-0.1b7.tar.gz
Using cached download
Unpacking pypolymake...
done
working in C:\Users\CHRIST~1\AppData\Local\Temp\tmpt_ibntj_conda_skeleton_pypolymake-0.1b7.tar.gz
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... done

## Package Plan ##

  environment location: C:\Users\Christoph\Miniconda3\conda-bld\skeleton_1593517973688\_h_env


The following NEW packages will be INSTALLED:

    ca-certificates: 2020.6.24-0
    certifi:         2020.6.20-py37_0
    openssl:         1.1.1g-he774522_0
    pip:             20.1.1-py37_1
    python:          3.7.7-h81c818b_4
    pyyaml:          5.3.1-py37he774522_1
    setuptools:      47.3.1-py37_0
    sqlite:          3.32.3-h2a8f88b_0
    vc:              14.1-h0510ff6_4
    vs2015_runtime:  14.16.27012-hf0eaf9b_2
    wheel:           0.34.2-py37_0
    wincertstore:    0.2-py37_0
    yaml:            0.2.5-he774522_0
    zlib:            1.2.11-h62dcd97_4

Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
Applying patch: 'C:\\Users\\CHRIST~1\\AppData\\Local\\Temp\\tmpt_ibntj_conda_skeleton_pypolymake-0.1b7.tar.gz\\pypi-distutils.patch'

Leaving build/test directories:
  Work:
 C:\Users\Christoph\Miniconda3\conda-bld\skeleton_1593517973688\work
  Test:
 C:\Users\Christoph\Miniconda3\conda-bld\skeleton_1593517973688\test_tmp
Leaving build/test environments:
  Test:
source activate  C:\Users\Christoph\Miniconda3\conda-bld\skeleton_1593517973688\_test_env
  Build:
source activate  C:\Users\Christoph\Miniconda3\conda-bld\skeleton_1593517973688\_build_env


        Error:
            Cannot use 'git' (not a git repo and/or patch) and did not find 'patch' in: C:\Users\Christoph\Miniconda3\conda-bld\skeleton_1593517973688\_build_env\Scripts;C:\Users\Christoph\Miniconda3\conda-bld\skeleton_1593517973688\_build_env\Library\mingw-w64\bin;C:\Users\Christoph\Miniconda3\conda-bld\skeleton_1593517973688\_build_env\Library\usr\bin;C:\Users\Christoph\Miniconda3\conda-bld\skeleton_1593517973688\_build_env\Library\bin;C:\Users\Christoph\Miniconda3\Scripts;C:\Users\Christoph\Miniconda3\Library\mingw-w64\bin;C:\Users\Christoph\Miniconda3\Library\usr\bin;C:\Users\Christoph\Miniconda3\Library\bin;C:\Users\Christoph\Miniconda3;C:\Users\Christoph\Miniconda3\Library\mingw-w64\bin;C:\Users\Christoph\Miniconda3\Library\usr\bin;C:\Users\Christoph\Miniconda3\Library\bin;C:\Users\Christoph\Miniconda3\Scripts;C:\Users\Christoph\Miniconda3\bin;C:\Users\Christoph\Miniconda3;C:\Users\Christoph\Miniconda3\Library\mingw-w64\bin;C:\Users\Christoph\Miniconda3\Library\usr\bin;C:\Users\Christoph\Miniconda3\Library\bin;C:\Users\Christoph\Miniconda3\Scripts;C:\Users\Christoph\Miniconda3\bin;C:\Users\Christoph\Miniconda3\condabin;C:\gurobi901\win64\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\OpenSSH\bin;C:\Program Files\PuTTY;C:\Program Files\Git\cmd;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\MiKTeX 2.9\miktex\bin\x64;C:\Program Files (x86)\GnuPG\bin;C:\Program Files (x86)\Wolfram Research\WolframScript;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Users\Christoph\AppData\Local\Microsoft\WindowsApps;C:\windows\system32;.
            You can install 'patch' using apt-get, yum (Linux), Xcode (MacOSX),
            or conda, m2-patch (Windows),

所以,我的问题是:这个错误来自哪里,我该如何避免它?

我还有第二个问题:我在哪个 conda 环境中执行命令重要conda skeleton pypi pypolymakeconda-build pypolymake?我应该这样做吗base(因为我最终可能想在不同的 conda 环境中使用 pypolymake)?或者我应该在我想使用 pypolymake 的环境之一中执行此操作?还是我必须在我想使用的每个环境中构建包?

提前感谢您的帮助和建议!

编辑:正如评论中所建议的,我已经尝试了 command conda skeleton pypi --extra-specs patch pypolymake,但我得到了不同的错误信息:

(base) C:\Users\Christoph>conda skeleton pypi --extra-specs patch pypolymake
Warning, the following versions were found for pypolymake
0.1.beta1
0.1.beta2
0.1.beta3
0.1b4
0.1b5
0.1b6
0.1b7
Using 0.1b7
Use --version to specify a different version.
Using url https://files.pythonhosted.org/packages/0e/d8/ea0989a21a5a8dd0d97f01a379348c3b3b389aabec91124186b94ec69a12/pypolymake-0.1b7.tar.gz (113 KB) for pypolymake.
Downloading pypolymake
PyPI URL:  https://files.pythonhosted.org/packages/0e/d8/ea0989a21a5a8dd0d97f01a379348c3b3b389aabec91124186b94ec69a12/pypolymake-0.1b7.tar.gz
Using cached download
Unpacking pypolymake...
done
working in C:\Users\CHRIST~1\AppData\Local\Temp\tmp954c3kj6conda_skeleton_pypolymake-0.1b7.tar.gz
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... failed

Leaving build/test directories:
  Work:
 C:\Users\Christoph\Miniconda3\conda-bld\skeleton_1593592312695\work
  Test:
 C:\Users\Christoph\Miniconda3\conda-bld\skeleton_1593592312695\test_tmp
Leaving build/test environments:
  Test:
source activate  C:\Users\Christoph\Miniconda3\conda-bld\skeleton_1593592312695\_test_env
  Build:
source activate  C:\Users\Christoph\Miniconda3\conda-bld\skeleton_1593592312695\_build_env


Traceback (most recent call last):
  File "C:\Users\Christoph\Miniconda3\lib\site-packages\conda_build\environ.py", line 757, in get_install_actions
    actions = install_actions(prefix, index, specs, force=True)
  File "C:\Users\Christoph\Miniconda3\lib\site-packages\conda\common\io.py", line 88, in decorated
    return f(*args, **kwds)
  File "C:\Users\Christoph\Miniconda3\lib\site-packages\conda\plan.py", line 474, in install_actions
    txn = solver.solve_for_transaction(prune=prune, ignore_pinned=not pinned)
  File "C:\Users\Christoph\Miniconda3\lib\site-packages\conda\core\solve.py", line 117, in solve_for_transaction
    should_retry_solve)
  File "C:\Users\Christoph\Miniconda3\lib\site-packages\conda\core\solve.py", line 158, in solve_for_diff
    force_remove, should_retry_solve)
  File "C:\Users\Christoph\Miniconda3\lib\site-packages\conda\core\solve.py", line 275, in solve_final_state
    ssc = self._add_specs(ssc)
  File "C:\Users\Christoph\Miniconda3\lib\site-packages\conda\core\solve.py", line 555, in _add_specs
    explicit_pool = ssc.r._get_package_pool(self.specs_to_add)
  File "C:\Users\Christoph\Miniconda3\lib\site-packages\conda\resolve.py", line 553, in _get_package_pool
    pool = self.get_reduced_index(specs)
  File "C:\Users\Christoph\Miniconda3\lib\site-packages\conda\common\io.py", line 88, in decorated
    return f(*args, **kwds)
  File "C:\Users\Christoph\Miniconda3\lib\site-packages\conda\resolve.py", line 574, in get_reduced_index
    explicit_specs, features = self.verify_specs(explicit_specs)
  File "C:\Users\Christoph\Miniconda3\lib\site-packages\conda\resolve.py", line 288, in verify_specs
    raise ResolvePackageNotFound(bad_deps)
conda.exceptions.ResolvePackageNotFound:
  - patch

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Christoph\Miniconda3\Scripts\conda-skeleton-script.py", line 10, in <module>
    sys.exit(main())
  File "C:\Users\Christoph\Miniconda3\lib\site-packages\conda_build\cli\main_skeleton.py", line 65, in main
    return execute(sys.argv[1:])
  File "C:\Users\Christoph\Miniconda3\lib\site-packages\conda_build\cli\main_skeleton.py", line 61, in execute
    version=args.version, config=config)
  File "C:\Users\Christoph\Miniconda3\lib\site-packages\conda_build\api.py", line 290, in skeletonize
    recursive=recursive, config=config, **kwargs)
  File "C:\Users\Christoph\Miniconda3\lib\site-packages\conda_build\skeletons\pypi.py", line 319, in skeletonize
    setup_options=setup_options)
  File "C:\Users\Christoph\Miniconda3\lib\site-packages\conda_build\skeletons\pypi.py", line 726, in get_package_metadata
    config=config)
  File "C:\Users\Christoph\Miniconda3\lib\site-packages\conda_build\skeletons\pypi.py", line 1127, in get_pkginfo
    setup_options=setup_options)
  File "C:\Users\Christoph\Miniconda3\lib\site-packages\conda_build\skeletons\pypi.py", line 1164, in run_setuppy
    subdir=config.host_subdir, clear_cache=False, config=config)
  File "C:\Users\Christoph\Miniconda3\lib\site-packages\conda_build\environ.py", line 850, in create_env
    channel_urls=tuple(config.channel_urls))
  File "C:\Users\Christoph\Miniconda3\lib\site-packages\conda_build\environ.py", line 759, in get_install_actions
    raise DependencyNeedsBuildingError(exc, subdir=subdir)
conda_build.exceptions.DependencyNeedsBuildingError: Unsatisfiable dependencies for platform win-64: {'patch'}

编辑2:这是输出conda info

(base) C:\Users\Christoph>conda info

     active environment : base
    active env location : C:\Users\Christoph\Miniconda3
            shell level : 1
       user config file : C:\Users\Christoph\.condarc
 populated config files : C:\Users\Christoph\.condarc
          conda version : 4.8.3
    conda-build version : 3.18.11
         python version : 3.7.7.final.0
       virtual packages :
       base environment : C:\Users\Christoph\Miniconda3  (writable)
           channel URLs : http://conda.anaconda.org/gurobi/win-64
                          http://conda.anaconda.org/gurobi/noarch
                          https://conda.anaconda.org/anaconda-fusion/win-64
                          https://conda.anaconda.org/anaconda-fusion/noarch
                          https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\Users\Christoph\Miniconda3\pkgs
                          C:\Users\Christoph\.conda\pkgs
                          C:\Users\Christoph\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\Christoph\Miniconda3\envs
                          C:\Users\Christoph\.conda\envs
                          C:\Users\Christoph\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.8.3 requests/2.24.0 CPython/3.7.7 Windows/10 Windows/10.0.19041
          administrator : False
             netrc file : None
           offline mode : False

编辑3:安装后m2-patch,我得到以下错误:

(base) C:\Users\Christoph>conda skeleton pypi pypolymake
Warning, the following versions were found for pypolymake
0.1.beta1
0.1.beta2
0.1.beta3
0.1b4
0.1b5
0.1b6
0.1b7
Using 0.1b7
Use --version to specify a different version.
Using url https://files.pythonhosted.org/packages/0e/d8/ea0989a21a5a8dd0d97f01a379348c3b3b389aabec91124186b94ec69a12/pypolymake-0.1b7.tar.gz (113 KB) for pypolymake.
Downloading pypolymake
PyPI URL:  https://files.pythonhosted.org/packages/0e/d8/ea0989a21a5a8dd0d97f01a379348c3b3b389aabec91124186b94ec69a12/pypolymake-0.1b7.tar.gz
Using cached download
Unpacking pypolymake...
done
working in C:\Users\CHRIST~1\AppData\Local\Temp\tmp28apwx5pconda_skeleton_pypolymake-0.1b7.tar.gz
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... done

## Package Plan ##

  environment location: C:\Users\Christoph\Miniconda3\conda-bld\skeleton_1593771046228\_h_env


The following NEW packages will be INSTALLED:

    ca-certificates: 2020.6.24-0
    certifi:         2020.6.20-py37_0
    openssl:         1.1.1g-he774522_0
    pip:             20.1.1-py37_1
    python:          3.7.7-h81c818b_4
    pyyaml:          5.3.1-py37he774522_1
    setuptools:      47.3.1-py37_0
    sqlite:          3.32.3-h2a8f88b_0
    vc:              14.1-h0510ff6_4
    vs2015_runtime:  14.16.27012-hf0eaf9b_2
    wheel:           0.34.2-py37_0
    wincertstore:    0.2-py37_0
    yaml:            0.2.5-he774522_0
    zlib:            1.2.11-h62dcd97_4

Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
Applying patch: 'C:\\Users\\CHRIST~1\\AppData\\Local\\Temp\\tmp28apwx5pconda_skeleton_pypolymake-0.1b7.tar.gz\\pypi-distutils.patch'
Trying to apply patch as-is
INFO:conda_build.source:Trying to apply patch as-is
INFO conda_build.source:apply_patch(596): Trying to apply patch as-is
(Stripping trailing CRs from patch; use --binary to disable.)
patching file core.py
Hunk #1 succeeded at 167 with fuzz 2 (offset 1 line).
Traceback (most recent call last):
  File "setup.py", line 27, in <module>
    cfg_vars['CFLAGS'] = cfg_vars['CFLAGS'].replace("-Wstrict-prototypes", "")
KeyError: 'CFLAGS'
$PYTHONPATH = C:\Users\CHRIST~1\AppData\Local\Temp\tmp28apwx5pconda_skeleton_pypolymake-0.1b7.tar.gz\pypolymake-0.1b7

Leaving build/test directories:
  Work:
 C:\Users\Christoph\Miniconda3\conda-bld\skeleton_1593771046228\work
  Test:
 C:\Users\Christoph\Miniconda3\conda-bld\skeleton_1593771046228\test_tmp
Leaving build/test environments:
  Test:
source activate  C:\Users\Christoph\Miniconda3\conda-bld\skeleton_1593771046228\_test_env
  Build:
source activate  C:\Users\Christoph\Miniconda3\conda-bld\skeleton_1593771046228\_build_env


Error: command failed: C:\Users\Christoph\Miniconda3\conda-bld\skeleton_1593771046228\_h_env\python.exe setup.py install

标签: pythonwindowscondapypiconda-build

解决方案


推荐阅读