Conda build fails with “TypeError: create_function()” error

I am running conda build using a recipe that downloads the tar.gz file from PyPi.

This fails with the following error message:

TypeError: create_function() got an unexpected keyword argument 'narg'

I have simplified the recipe file and reproduced the error. The contents are as follows:

package:
  name: binda
  version: 1.0.9

source:
  url: https://pypi.io/packages/source/b/binda/binda-1.0.9.tar.gz
  sha256: 86c1eef6c48ee520f244aac2ebcc8cd62f2e0c0ec97d88b9c1a5ea8719c40e82

requirements:
  host:
    - python >=3.6
    - hatchling
    - hatch-vcs
    - pip
  run:
    - python >=3.6
    - pandas
    - numpy

I have checked the link to the package and confirmed the checksum.

I have also tried recreating the environments, testing on standard Python, Miniforge and Anaconda environments. All three fail with the same error.

The full error message with environment settings and stack trace are included below:


(binda) C:\Users\jlcas\PythonProjects\binda>conda build binda 
WARNING: No numpy version specified in conda_build_config.yaml. 
Falling back to default numpy value of 1.22 Adding in variants from
internal_defaults Attempting to finalize metadata for binda

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda_index\index\convert_cache.py",
line 158, in remove_prefix
        conn.create_function("migrate_basename", narg=1, func=basename, deterministic=True)
      File "C:\ProgramData\mambaforge-pypy3\Lib\_sqlite3.py", line 324, in wrapper
        return func(self, *args, **kwargs)
      File "C:\ProgramData\mambaforge-pypy3\Lib\_sqlite3.py", line 305, in wrapper
        return func(self, *args, **kwargs)
    TypeError: create_function() got an unexpected keyword argument 'narg'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda\exception_handler.py",
line 17, in __call__
        return func(*args, **kwargs)
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda\cli\main.py",
line 64, in main_subshell
        exit_code = do_call(args, parser)
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda\cli\conda_argparse.py",
line 143, in do_call
        result = plugin_subcommand.action(getattr(args, "_args", args))
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda_build\plugin.py",
line 10, in build
        execute(*args, **kwargs)
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda_build\cli\main_build.py",
line 568, in execute
        outputs = api.build(
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda_build\api.py",
line 253, in build
        return build_tree(
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda_build\build.py",
line 3804, in build_tree
        packages_from_this = build(
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda_build\build.py",
line 2474, in build
        output_metas = expand_outputs([(m, need_source_download, need_reparse_in_env)])
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda_build\render.py",
line 923, in expand_outputs
        for output_dict, m in deepcopy(_m).get_output_metadata_set(
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda_build\metadata.py",
line 2574, in get_output_metadata_set
        conda_packages = finalize_outputs_pass(
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda_build\metadata.py",
line 934, in finalize_outputs_pass
        fm = finalize_metadata(
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda_build\render.py",
line 637, in finalize_metadata
        build_unsat, host_unsat = add_upstream_pins(
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda_build\render.py",
line 452, in add_upstream_pins
        build_deps, build_unsat, extra_run_specs_from_build = _read_upstream_pin_files(
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda_build\render.py",
line 431, in _read_upstream_pin_files
        deps, actions, unsat = get_env_dependencies(
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda_build\render.py",
line 151, in get_env_dependencies
        actions = environ.get_install_actions(
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda_build\environ.py",
line 869, in get_install_actions
        index, index_ts, _ = get_build_index(
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda_build\index.py",
line 203, in get_build_index
        _delegated_update_index(output_folder, verbose=debug)
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda_build\index.py",
line 315, in _delegated_update_index
        return _update_index(
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda_index\index\__init__.py",
line 159, in update_index
        channel_index.index(
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda_index\index\__init__.py",
line 562, in index
        futures = [
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda_index\index\__init__.py",
line 562, in <listcomp>
        futures = [
      File "C:\ProgramData\mambaforge-pypy3\Lib\concurrent\futures\_base.py",
line 609, in result_iterator
        yield fs.pop().result()
      File "C:\ProgramData\mambaforge-pypy3\Lib\concurrent\futures\_base.py",
line 446, in result
        return self.__get_result()
      File "C:\ProgramData\mambaforge-pypy3\Lib\concurrent\futures\_base.py",
line 391, in __get_result
        raise self._exception
      File "C:\ProgramData\mambaforge-pypy3\Lib\concurrent\futures\thread.py",
line 58, in run
        result = self.fn(*self.args, **self.kwargs)
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda_index\index\__init__.py",
line 550, in extract_wrapper
        return self.extract_subdir_to_cache(
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda_index\index\__init__.py",
line 757, in extract_subdir_to_cache
        cache.save_fs_state(subdir_path)
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda_index\index\sqlitecache.py",
line 451, in save_fs_state
        with self.db:
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda_index\index\sqlitecache.py",
line 76, in __get__
        value = self.wrapped(inst)
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda_index\index\sqlitecache.py",
line 122, in db
        convert_cache.migrate(conn)
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda_index\index\convert_cache.py",
line 135, in migrate
        remove_prefix(conn)
      File "C:\ProgramData\mambaforge-pypy3\lib\site-packages\conda_index\index\convert_cache.py",
line 160, in remove_prefix
        conn.create_function("migrate_basename", narg=1, func=basename)
      File "C:\ProgramData\mambaforge-pypy3\Lib\_sqlite3.py", line 324, in wrapper
        return func(self, *args, **kwargs)
      File "C:\ProgramData\mambaforge-pypy3\Lib\_sqlite3.py", line 305, in wrapper
        return func(self, *args, **kwargs)
    TypeError: create_function() got an unexpected keyword argument 'narg'

`$ C:\ProgramData\mambaforge-pypy3\Scripts\conda-script.py build
binda`

  environment variables:
                 CIO_TEST=<not set>
    CONDA_ALLOW_SOFTLINKS=false
        CONDA_DEFAULT_ENV=binda
                CONDA_EXE=C:\ProgramData\mambaforge-pypy3\condabin\..\Scripts\conda.exe
               CONDA_EXES="C:\ProgramData\mambaforge-pypy3\condabin\..\Scripts\conda.exe"
             CONDA_PREFIX=C:\Users\jlcas\anaconda3\envs\binda
           CONDA_PREFIX_1=C:\ProgramData\mambaforge-pypy3
    CONDA_PROMPT_MODIFIER=(binda)
         CONDA_PYTHON_EXE=C:\ProgramData\mambaforge-pypy3\python.exe
               CONDA_ROOT=C:\ProgramData\mambaforge-pypy3
              CONDA_SHLVL=2
           CURL_CA_BUNDLE=<not set>
                 HOMEPATH=\Users\jlcas
               LD_PRELOAD=<not set>
                     PATH=C:\Users\jlcas\anaconda3\envs\binda;C:\Users\jlcas\anaconda3\envs\bind
                          a\Library\mingw-w64\bin;C:\Users\jlcas\anaconda3\envs\binda\Library\us
                          r\bin;C:\Users\jlcas\anaconda3\envs\binda\Library\bin;C:\Users\jlcas\a
                          naconda3\envs\binda\Scripts;C:\Users\jlcas\anaconda3\envs\binda\bin;C:
                          \ProgramData\mambaforge-pypy3\condabin;C:\ProgramData\mambaforge-
                          pypy3;C:\ProgramData\mambaforge-
                          pypy3\Library\mingw-w64\bin;C:\ProgramData\mambaforge-
                          pypy3\Library\usr\bin;C:\ProgramData\mambaforge-
                          pypy3\Library\bin;C:\ProgramData\mambaforge-pypy3\Scripts;C:\WINDOWS\s
                          ystem32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\Window
                          sPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program
                          Files\Git\cmd;C:\Program Files\010 Editor;C:\Program Files\dotnet;C:\U
                          sers\jlcas\AppData\Local\Microsoft\WindowsApps;.;C:\sdk\flutter\bin;C:
                          \Program Files\Android\Android
                          Studio\jbr\bin;C:\Users\jlcas\AppData\Roaming\TinyTeX\bin\windows
             PSMODULEPATH=C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\Windows
                          PowerShell\v1.0\Modules
               PYTHONPATH={PYTHONPATH};./src;./tests;../src;
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=C:\Users\jlcas\anaconda3\envs\binda\Library\ssl\cacert.pem

     active environment : C:\Users\jlcas\anaconda3\envs\binda
    active env location : C:\Users\jlcas\anaconda3\envs\binda
            shell level : 2
       user config file : C:\Users\jlcas\.condarc  populated config files : C:\ProgramData\mambaforge-pypy3\.condarc
                          C:\Users\jlcas\.condarc
          conda version : 23.7.4
    conda-build version : 3.26.1
         python version : 3.9.17.final.0
       virtual packages : __archspec=1=x86_64
                          __cuda=11.2=0
                          __win=0=0
       base environment : C:\ProgramData\mambaforge-pypy3  (writable)
      conda av data dir : C:\ProgramData\mambaforge-pypy3\etc\conda   conda av metadata url : None
           channel URLs : 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
                          https://conda.anaconda.org/conda-forge/win-64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : C:\ProgramData\mambaforge-pypy3\pkgs
                          C:\Users\jlcas\.conda\pkgs
                          C:\Users\jlcas\AppData\Local\conda\conda\pkgs
       envs directories : C:\ProgramData\mambaforge-pypy3\envs
                          C:\Users\jlcas\.conda\envs
                          C:\Users\jlcas\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/23.7.4 requests/2.31.0 PyPy/3.9.17 Windows/10 Windows/10.0.22621
          administrator : False
             netrc file : None
           offline mode : False


An unexpected error has occurred. Conda has prepared the above report.
If you suspect this error is being caused by a malfunctioning plugin,
consider using the --no-plugins option to turn off plugins.

Example: conda --no-plugins install <package>

Alternatively, you can set the CONDA_NO_PLUGINS environment variable
on the command line to run the command without plugins enabled.

Example: CONDA_NO_PLUGINS=true conda install <package>

  • Seems to complain about the index. Does flushing the index cache help? I.e., try conda clean -i. Also, it is weird to be running conda-build in anything but base. That is the only environment where conda, conda-build, mamba, boa, etc. should be installed. So, maybe try deactivating out of the binda environment.

    – 

  • As a side note, if this is production-ready (as the 1.x implies) and on PyPI, I’d simply send it along to Conda Forge. No reason to be cluttering your repository with infrastructure to build a Conda version when Conda Forge will handle all that downstream from your PyPI releases.

    – 




Leave a Comment