conda / conda-build

Commands and tools for building conda packages
https://docs.conda.io/projects/conda-build/
Other
383 stars 423 forks source link

Strange error on Windows 8 build... #267

Closed joelvbernier closed 2 years ago

joelvbernier commented 9 years ago

Trying to build a package that successfully builds on mac and unix on Windows 8 (praxes/hexrd) and I get the following error:

C:\Users\Diwakar\Documents\GitHub\hexrd>conda build conda.recipe An unexpected error has occurred, please consider sending the following traceback to the conda GitHub issue tracker at:

https://github.com/conda/conda-build/issues

Include the output of the command 'conda info' in your report.

Traceback (most recent call last): File "C:\Users\Diwakar\Anaconda\Scripts\conda-build-script.py", line 4, in sys.exit(main()) File "C:\Users\Diwakar\Anaconda\lib\site-packages\conda_build\main_build.py", line 110, in main args_func(args, p) File "C:\Users\Diwakar\Anaconda\lib\site-packages\conda_build\main_build.py", line 312, in args_func args.func(args, p) File "C:\Users\Diwakar\Anaconda\lib\site-packages\conda_build\main_build.py", line 244, in execute m = MetaData(recipe_dir) File "C:\Users\Diwakar\Anaconda\lib\site-packages\conda_build\metadata.py", line 250, in init self.parse_again() File "C:\Users\Diwakar\Anaconda\lib\site-packages\conda_build\metadata.py", line 258, in parse_again self.meta = parse(get_contents(self.meta_path)) File "C:\Users\Diwakar\Anaconda\lib\site-packages\conda_build\metadata.py", line 230, in get_contents env.globals.update(context_processor()) File "C:\Users\Diwakar\Anaconda\lib\site-packages\conda_build\jinja_context.py", line 45, in context_processor ctx = get_environ() File "C:\Users\Diwakar\Anaconda\lib\site-packages\conda_build\environ.py", line 91, in get_dict d.update(get_git_build_info(d['SRC_DIR'])) File "C:\Users\Diwakar\Anaconda\lib\site-packages\conda_build\environ.py", line 43, in get_git_build_info env=env) File "C:\Users\Diwakar\Anaconda\lib\subprocess.py", line 710, in init** errread, errwrite) File "C:\Users\Diwakar\Anaconda\lib\subprocess.py", line 958, in _execute_child startupinfo) WindowsError: [Error 2] The system cannot find the file specified

Here's the environment for reference:

C:\Users\Diwakar\Documents\GitHub\hexrd>conda list

packages in environment at C:\Users\Diwakar\Anaconda:

_license 1.1 py27_0 anaconda 2.1.0 np19py27_0 argcomplete 0.8.1 py27_0 astropy 0.4.2 np19py27_0 atom 0.3.9 py27_0 backports.ssl-match-hostname 3.4.0.2 <p beautiful-soup 4.3.2 py27_0 beautifulsoup4 4.3.2 binstar 0.9.5 py27_0 bitarray 0.8.1 py27_1 blaze 0.6.3 np19py27_0 blz 0.6.2 np19py27_0 bokeh 0.6.1 np19py27_0 boto 2.32.1 py27_0 casuarius 1.1 py27_0 cdecimal 2.3 py27_1 cffi 0.8.6 py27_0 chaco 4.4.1 np19py27_0 clyent 0.3.2 py27_0 colorama 0.3.1 py27_0 conda 3.7.3 py27_0 conda-build 1.9.1 py27_0 configobj 5.0.6 py27_0 cryptography 0.5.4 py27_0 cython 0.21 py27_0 cytoolz 0.7.0 py27_0 datashape 0.3.0 np19py27_1 dateutil 2.1 py27_2 decorator 3.4.0 py27_0 docutils 0.12 py27_0 dynd-python 0.6.5 np19py27_0 enable 4.3.0 np19py27_2 enaml 0.9.8 py27_0 flask 0.10.1 py27_1 future 0.13.1 py27_0 futures 2.1.6 py27_0 gevent 1.0.1 py27_0 gevent-websocket 0.9.3 py27_0 greenlet 0.4.4 py27_0 grin 1.2.1 py27_2 h5py 2.3.1 np19py27_0 hexrd unknown ipython 2.2.0 py27_0 ipython-notebook 2.2.0 py27_0 ipython-qtconsole 2.2.0 py27_0 itsdangerous 0.24 py27_0 jdcal 1.0 py27_0 jinja2 2.7.3 py27_1 kiwisolver 0.1.3 py27_0 launcher 1.0.0 1 libpython 1.0 py27_1 llvmpy 0.12.7 py27_0 lxml 3.4.0 py27_0 markupsafe 0.23 py27_0 matplotlib 1.4.2 np19py27_0 menuinst 1.0.4 py27_0 mingw 4.7 1 mock 1.0.1 py27_0 multipledispatch 0.4.7 py27_0 networkx 1.9.1 py27_0 nltk 3.0.0 np19py27_0 node-webkit 0.10.1 0 nose 1.3.4 py27_0 numba 0.14.0 np19py27_0 numexpr 2.3.1 np19py27_0 numpy 1.9.1 py27_0 openpyxl 1.8.5 py27_0 pandas 0.14.1 np19py27_0 patsy 0.3.0 np19py27_0 pep8 1.5.7 py27_0 pil 1.1.7 py27_0 pip 1.5.6 py27_0 ply 3.4 py27_0 psutil 2.1.1 py27_0 py 1.4.25 py27_0 pycosat 0.6.1 py27_0 pycparser 2.10 py27_0 pycrypto 2.6.1 py27_2 pyface 4.4.0 py27_0 pyflakes 0.8.1 py27_0 pygments 1.6 py27_0 pyopenssl 0.14 py27_0 pyparsing 2.0.1 py27_0 pyqt 4.10.4 py27_0 pyreadline 2.0 py27_0 pytables 3.1.1 np19py27_1 pytest 2.6.3 py27_0 python 2.7.8 0 python-dateutil 1.5 pytz 2014.9 py27_0 pywin32 219 py27_0 pyyaml 3.11 py27_0 pyzmq 14.3.1 py27_0 requests 2.5.0 py27_0 rope 0.9.4 py27_1 runipy 0.1.1 py27_0 scikit-image 0.10.1 np19py27_0 scikit-learn 0.15.2 np19py27_0 scipy 0.14.0 np19py27_0 setuptools 7.0 py27_0 six 1.8.0 py27_0 sockjs-tornado 1.0.1 py27_0 sphinx 1.2.3 py27_0 spyder 2.3.1 py27_0 spyder-app 2.3.1 py27_0 sqlalchemy 0.9.7 py27_0 ssl_match_hostname 3.4.0.2 py27_0 statsmodels 0.5.0 np19py27_2 sympy 0.7.5 py27_0 tables 3.1.1 toolz 0.7.0 py27_0 tornado 4.0.2 py27_0 traits 4.4.0 py27_0 traitsui 4.4.0 py27_0 ujson 1.33 py27_0 unicodecsv 0.9.4 py27_0 werkzeug 0.9.6 py27_1 wsgiref 0.1.2 wxpython 3.0 py27_0 xlrd 0.9.3 py27_0 xlsxwriter 0.5.7 py27_0 xlwings 0.2.2 py27_0 xlwt 0.7.5 py27_0

wulmer commented 6 years ago

I have seen this error multiple times when I didn't have git on my %PATH%.

msarahan commented 6 years ago

Yes, we need a better error message here. Thanks for re-raising this issue.

msarahan commented 6 years ago

@wulmer what version of conda-build? It seems from the code that it should always tell you something reasonable, or just not use git:

https://github.com/conda/conda-build/blob/master/conda_build/environ.py#L388 https://github.com/conda/conda-build/blob/master/conda_build/source.py#L292 https://github.com/conda/conda-build/blob/master/conda_build/source.py#L324

The warning I added in #2586 was much too constraining, and ended up requiring git or hg to always be present. I'm going to revert it.

wulmer commented 6 years ago

Ok, the problem I had was a bit more specific... I tried with the latest conda-build (3.1.6) and I have the same issue, but in my case, git exists (as git.bat), but git.exe doesn't. This leads to the described error (just in a different version of the stacktrace due to a newer conda version):

Traceback (most recent call last):
  File "C:\Users\someuser\AppData\Local\Continuum\Miniconda3\Scripts\conda-build-script.py", line 10, in <module>
    sys.exit(main())
  File "C:\Users\someuser\AppData\Local\Continuum\Miniconda3\lib\site-packages\conda_build\cli\main_build.py", line 393, in main
    execute(sys.argv[1:])
  File "C:\Users\someuser\AppData\Local\Continuum\Miniconda3\lib\site-packages\conda_build\cli\main_build.py", line 384, in execute
    verify=args.verify)
  File "C:\Users\someuser\AppData\Local\Continuum\Miniconda3\lib\site-packages\conda_build\api.py", line 186, in build
    need_source_download=need_source_download, config=config, variants=variants)
  File "C:\Users\someuser\AppData\Local\Continuum\Miniconda3\lib\site-packages\conda_build\build.py", line 1851, in build_tree
    notest=notest,
  File "C:\Users\someuser\AppData\Local\Continuum\Miniconda3\lib\site-packages\conda_build\build.py", line 1071, in build
    try_download(m, no_download_source=False, raise_error=True)
  File "C:\Users\someuser\AppData\Local\Continuum\Miniconda3\lib\site-packages\conda_build\render.py", line 458, in try_download
    source.provide(metadata)
  File "C:\Users\someuser\AppData\Local\Continuum\Miniconda3\lib\site-packages\conda_build\source.py", line 628, in provide
    verbose=metadata.config.verbose)
  File "C:\Users\someuser\AppData\Local\Continuum\Miniconda3\lib\site-packages\conda_build\source.py", line 313, in git_source
    git_depth=git_depth, is_top_level=True, verbose=verbose)
  File "C:\Users\someuser\AppData\Local\Continuum\Miniconda3\lib\site-packages\conda_build\source.py", line 280, in git_mirror_checkout_recursive
    git_info(checkout_dir, verbose=verbose)
  File "C:\Users\someuser\AppData\Local\Continuum\Miniconda3\lib\site-packages\conda_build\source.py", line 343, in git_info
    stdout = check_output_env(cmd.split(), stderr=stderr, cwd=src_dir, env=env)
  File "C:\Users\someuser\AppData\Local\Continuum\Miniconda3\lib\site-packages\conda_build\utils.py", line 681, in check_output_env
    return _func_defaulting_env_to_os_environ(subprocess.check_output, *popenargs, **kwargs)\
  File "C:\Users\someuser\AppData\Local\Continuum\Miniconda3\lib\site-packages\conda_build\utils.py", line 673, in _func_defaulting_env_to_os_environ
    return func(_args, **kwargs)
  File "C:\Users\someuser\AppData\Local\Continuum\Miniconda3\lib\subprocess.py", line 626, in check_output
    **kwargs).stdout
  File "C:\Users\someuser\AppData\Local\Continuum\Miniconda3\lib\subprocess.py", line 693, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Users\someuser\AppData\Local\Continuum\Miniconda3\lib\subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "C:\Users\someuser\AppData\Local\Continuum\Miniconda3\lib\subprocess.py", line 1224, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
An error occurred (1)

Background: On Windows, the %PATH% length is very limited, so I try to keep my path short and use a single app folder (which is on the path) and which contains .bat scripts which act as a kind of redirect to the actual installed applications. So I have a git.bat script which simply calls the git.exe in its real location. With this method, I can have many development tools in my %PATH% while only having one directory for them all listed in the %PATH% variable.

The described problem only appears if there exists a git.bat but no git.exe in my PATH. It works correctly if there is neither git.bat nor git.exe in the PATH (Error: git is not installed in your root environment.) and it works of course if there is git.exe on the PATH.

msarahan commented 6 years ago

can you please submit a PR that reproduces the behavior? This is the bit that I think should be working: https://github.com/conda/conda-build/blob/master/conda_build/os_utils/external.py#L33

but debugging it will really require a reproduction test case.

github-actions[bot] commented 2 years ago

Hi there, thank you for your contribution to conda-build!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed automatically if no further activity occurs.

If you would like this issue to remain open please:

  1. Verify that you can still reproduce the issue in the latest version of conda-build

  2. Comment that the issue is still reproducible and include:

    • What version of conda-build you reproduced the issue on
    • What OS and version you reproduced the issue on
    • What steps you followed to reproduce the issue
  3. It would also be helpful to have the output of the following commands available:

    • conda info
    • conda config --show-sources
    • conda list --show-channel-urls

NOTE: If this issue was closed prematurely, please leave a comment and we will gladly reopen the issue.

In case this issue was originally about a project that is covered by the Anaconda issue tracker (e.g. Anaconda, Miniconda, packages built by Anaconda, Inc. like Anaconda Navigator etc), please reopen the issue there again.

Thanks!

github-actions[bot] commented 2 years ago

Hi again!

This issue has been closed since it has not had recent activity.

NOTE: If this issue was closed prematurely, please leave a comment.

Thanks!