4

I'm using miniconda on Windows 10 (see Edit 2 below for the output of conda info). I would like to use the PyPI package pypolymake. Therefore, I tried to follow the instructions given here to build a conda package using conda skeleton. Before I started, I successfully ran conda install git conda-build as suggested in the prerequisites.

When running the command conda skeleton pypi pypolymake in my Anaconda Prompt, I obtain the following error:

(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),

So, my question is: Where does this error come from and how do I avoid it?

And I also have a second question: Does it matter in which conda environment I execute the commands conda skeleton pypi pypolymake and conda-build pypolymake? Should I do this in base (since I possibly would like to use pypolymake in different conda environments eventually)? Or should I do this in one of the environments where I want to use pypolymake? Or do I have to build the package in every environment I want to use it?

Thanks in advance for your help and advice!

Edit: As suggested in the comments, I've tried the command conda skeleton pypi --extra-specs patch pypolymake, but I obtained a different error message:

(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'}

Edit 2: Here is the output of 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

Edit 3: After installing m2-patch, I obtained the following error:

(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
Chris
  • 41
  • 4
  • 1
    Does this answer your question? [Conda skeleton pypi: ModuleNotFoundError: No module named 'numpy'](https://stackoverflow.com/questions/59649808/conda-skeleton-pypi-modulenotfounderror-no-module-named-numpy). E.g., in your case add an `--extra-specs patch` flag. – merv Jul 01 '20 at 02:21
  • 1
    @merv Thanks for your comment. Unfortunately, this does not help, see edited question. However, if I understand the post you've linked to correctly, this means that it really does not matter in which environment I (try to) build packages, right? – Chris Jul 01 '20 at 08:38
  • 1
    correct, it creates a new temp environment for the build. – merv Jul 01 '20 at 13:38
  • I think `patch` is on Conda Forge channel, so try `--extra-specs conda-forge::patch` or add it as a searchable channel. – merv Jul 01 '20 at 14:07
  • @merv Thanks again! I tried `conda skeleton pypi --extra-specs conda-forge::patch pypolymake`, resulting in almost the same error as before (instead of failing to find `patch`, it now fails to find `conda-forge::patch`). – Chris Jul 01 '20 at 14:16
  • 1
    Not sure then. I still tend to believe the general solution is the same, just that we need to track down what package needs to be provided to the `--extra-specs` flag. Try searching Anaconda Cloud for `"patch"` - there are several variants (e.g., `patch-ng`), one of which may be what provides the functionality for your specific platform. I suppose another thing to try is `--extra-specs git`, though it seems like it finds `git` already, but not `patch`. Also, the output of `conda info` might be useful to add to the question, so we explicitly have the platform and channels info. – merv Jul 02 '20 at 17:18
  • @merv I've added the output of `conda info` to the post. I tried to add `--extra-specs git`, but this resulted in the same error message as without it (confirming your guess that the problem is patch and not git). I have the feeling that it really is a platform problem: The packages `patch` and `patch-ng` both seem to be not available for win-64. But how can I circumvent this? It somehow must be possible to build packages on Windows ... – Chris Jul 03 '20 at 09:51
  • I've installed `m2-patch` and then ran `conda skeleton pypi pypolymake` again. I obtain a new error, see Edit 3. – Chris Jul 03 '20 at 10:11

0 Answers0