Conda build fails with `Aborting implicit building of eggs.` message

Question:

I am trying to build a new conda package based on an old one. The repo and code is available for Theme Material Darcula. Theme-material-darcula Jupyter labextension builds and install perfectly fine on my system. But the conda build . command fails for me on Aborting implicit building of eggs. Use pip install. to install from source.

The traceback is here:

 cmdclass = create_cmdclass(
/home/adhadse/anaconda3/conda-bld/theme-material-darcula_1657766513713/work/setup.py:50: DeprecatedWarning: install_npm is deprecated as of 0.8 and will be removed in 1.0. Use `npm_builder` and `wrap_installers`
  install_npm(HERE, build_cmd="build:prod", npm=["jlpm"]),
running install
/home/adhadse/anaconda3/conda-bld/theme-material-darcula_1657766513713/_build_env/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/home/adhadse/anaconda3/conda-bld/theme-material-darcula_1657766513713/_build_env/lib/python3.9/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
running bdist_egg
Aborting implicit building of eggs. Use `pip install .`  to install from source.
Traceback (most recent call last):
  File "/home/adhadse/anaconda3/bin/conda-build", line 11, in <module>
    sys.exit(main())
  File "/home/adhadse/anaconda3/lib/python3.9/site-packages/conda_build/cli/main_build.py", line 488, in main
    execute(sys.argv[1:])
  File "/home/adhadse/anaconda3/lib/python3.9/site-packages/conda_build/cli/main_build.py", line 477, in execute
    outputs = api.build(args.recipe, post=args.post, test_run_post=args.test_run_post,
  File "/home/adhadse/anaconda3/lib/python3.9/site-packages/conda_build/api.py", line 186, in build
    return build_tree(
  File "/home/adhadse/anaconda3/lib/python3.9/site-packages/conda_build/build.py", line 3088, in build_tree
    packages_from_this = build(metadata, stats,
  File "/home/adhadse/anaconda3/lib/python3.9/site-packages/conda_build/build.py", line 2211, in build
    utils.check_call_env(cmd, env=env, rewrite_stdout_env=rewrite_env,
  File "/home/adhadse/anaconda3/lib/python3.9/site-packages/conda_build/utils.py", line 411, in check_call_env
    return _func_defaulting_env_to_os_environ('call', *popenargs, **kwargs)
  File "/home/adhadse/anaconda3/lib/python3.9/site-packages/conda_build/utils.py", line 391, in _func_defaulting_env_to_os_environ
    raise subprocess.CalledProcessError(proc.returncode, _args)
subprocess.CalledProcessError: Command '['/bin/bash', '-o', 'errexit', '/home/adhadse/anaconda3/conda-bld/theme-material-darcula_1657766513713/work/conda_build.sh']' returned non-zero exit status 1.

My Conda recipe (meta.yaml) is as follows:

package:
  name: "theme-material-darcula"
  version: "3.2.0"

source:
  path: .
  git_rev: v3.2.0
  git_url: https://github.com/adhadse/theme-material-darcula

build:
    script: python setup.py install -f

requirements:
  host:
    - python
  build:
    - python
    - setuptools
    - wheel
    - jupyter-packaging
  run:
    - python
    - jupyterlab>=3.0.0

about:
  home: https://github.com/adhadse/theme-material-darcula
  license: BSD
  license_family: BSD
  license_file: LICENSE
  summary: "Darcula theme for JupyterLab with Material Design. Modelled after the classic Intellij theme."

extra:
  recipe-maintainers:
    - adhadse

What am I doing wrong?

Asked By: Anurag Dhadse

||

Answers:

I’ll answer my own question.

I’m building the package the wrong way. The package is supposed to be built using python setuptools via:

python3 setup.py sdist

which will create tarball file dist directory.

This file is supposed to be published to PyPI. A bash script will make the job a whole lot easier (do make sure to create an account on TestPyPI and PyPI):

# Adapted from https://github.com/jupyter-lsp/jupyterlab-lsp/blob/master/scripts/publish_pypi.sh

rm dist/*
python3 setup.py sdist
twine upload dist/* -r testpypi
echo "Published to testpypi"
while true; do
    read -p "Do you wish to publish to pypi?" yn
    case $yn in
        [Yy]* ) twine upload dist/*; break;;
        [Nn]* ) exit;;
        * ) echo "Please answer yes or no.";;
    esac
done

The script will first create tarball file and then first publish it to TestPyPI, if all looks fine, continue with publishing on PyPI.

Publishing to Conda

The same python package can be published to Conda via anaconda-client:

conda activate <enironment-name>
conda install anaconda-client
anaconda login

Then upload it:

anaconda upload dist/*
Answered By: Anurag Dhadse