enthought/chaco

conda build failing under Windows 10, due to unresolved version.

Closed this issue · 5 comments

Problem Description

When trying to conda build chaco under Windows 10, I'm getting the following error:

RuntimeError: Unable to determine package version. No local Git clone detected, and no version file found at C:\Users\capnf\AppData\Local\Temp\pip-req-build-825e1krg\chaco\_version.py.

Reproduction Steps:

Checkout "5.0.0" and attempt a conda build, using the following recipe (i.e. - meta.yaml):

{% set name = "chaco" %}
{% set version = "5.0.0" %}

package:
  name: "{{ name|lower }}"
  version: "{{ version }}"

source:
  path: ../../chaco/

build:
  number: 1
  script: "{{ PYTHON }} -m pip install . --no-deps --ignore-installed -vv "

requirements:
  build:
    - vs2019_win-64
  
  host:
    - python
    - enable
    - Cython

  run:
    - python
    - enable
# Code to reproduce issue here

Expected behavior:

I expect the conda build to succeed.

OS, Python version: [Enter OS name and Python version]

Windows 10
Python 3.7

Chaco and other ETS packages use the git tag to determine the version number as part of the setup.py. Assuming a git checkout, you need to have git installed in your build environment.

A better solution is that the 5.0.0 source release on PyPI should include version information and be able to be built without any need for git (if it doesn't that's a bug in the release).

I would recommend getting release sources from PyPI rather than Github for your builds, as that is the actual intended stand-alone source release.

Thanks, @corranwebster !

So, do you mean to suggest that if I use: git checkout 5.0.0, for instance, then my build should work (because I used a tag to perform the checkout)? I tried that and it didn't work. I do have git included in the build section of the requirements section of my meta.yaml file:

requirements:
  build:
    - setuptools
    - git
    - cmake

Yes, you should be able to check out a tag like that, and run the setup.py to generate the correct version information (which pip install . should do).

You are triggering this error here:

chaco/setup.py

Lines 279 to 282 in 84122ae

raise RuntimeError(
"Unable to determine package version. No local Git clone "
"detected, and no version file found at {}.".format(VERSION_FILE)
)

To avoid this, you need to have:

  • git available to run from a subprocess in python and the .git directory is in its usual place; or
  • be using a source distribution, as you would get from PyPI;
  • or have a chaco/_version.py otherwise generated.

I don't know anything about the Conda build process, so I can't diagnose further. However the git tags aren't the "official" release of any ETS library packages. You really should be sourcing those from PyPI, and that should avoid all issues with git being present or not.

I was able to resolve this, by using a Git URL in the source: section of my meta.yaml file.