conda / conda-build

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

Build fails if using namespace packages #649

Closed remram44 closed 2 years ago

remram44 commented 9 years ago

I have two libs that share a namespace package, and one of them depends on the other.

When building the one that has the dependency, the build fails with "OSError: File exists: <path to the namespace directory>". It looks like you are not handling the fact that the directory will already have been created while installing the first package.

Traceback (most recent call last):
  File "/Users/remirampin/anaconda/bin/conda-build", line 5, in <module>
    sys.exit(main())
  File "/Users/remirampin/anaconda/lib/python2.7/site-packages/conda_build/main_build.py", line 190, in main
    args_func(args, p)
  File "/Users/remirampin/anaconda/lib/python2.7/site-packages/conda_build/main_build.py", line 468, in args_func
    args.func(args, p)
  File "/Users/remirampin/anaconda/lib/python2.7/site-packages/conda_build/main_build.py", line 391, in execute
    override_channels=args.override_channels, include_recipe=args.include_recipe)
  File "/Users/remirampin/anaconda/lib/python2.7/site-packages/conda_build/build.py", line 455, in build
    post_process(sorted(files2 - files1), preserve_egg_dir=bool(m.get_value('build/preserve_egg_dir')))
  File "/Users/remirampin/anaconda/lib/python2.7/site-packages/conda_build/post.py", line 148, in post_process
    remove_easy_install_pth(files, preserve_egg_dir=preserve_egg_dir)
  File "/Users/remirampin/anaconda/lib/python2.7/site-packages/conda_build/post.py", line 105, in remove_easy_install_pth
    utils.copy_into(join(egg_path, fn), join(sp_dir, fn))
  File "/Users/remirampin/anaconda/lib/python2.7/site-packages/conda_build/utils.py", line 34, in copy_into
    shutil.copytree(srcname, dstname)
  File "/Users/remirampin/anaconda/lib/python2.7/shutil.py", line 177, in copytree
    os.makedirs(dst)
  File "/Users/remirampin/anaconda/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 17] File exists: '/Users/remirampin/anaconda/envs/_build/lib/python2.7/site-packages/reprounzip/unpackers'
remram44 commented 8 years ago

Bump. Please look into this, still happening, super annoying.

kalefranz commented 8 years ago

The python community has abandoned namespace packages. Because getting them to work is super annoying.

Honestly, the user experience here has always been broken. And it's not conda's place--being a language-agnostic package manager--to fix it for the PyPA. (Nor do we even have the authority to.)

Rant over. You have a point. Conda can do better. And this issue should stay open as a bug until we can address it further.

remram44 commented 8 years ago

Well, at least installing such packages work with other tools (e.g. pip).

Here's my workaround (commit): remove build dependencies in the conda recipe (since conda will break if installing them) and pass --single-version-externally-managed to setup.py

ivan-kalev commented 8 years ago

@remram44 adding preserve_egg_dir: yes to your recipe should do the trick. On Python 3 you can now use native PEP420 namespace packages (once #1090 is released).

github-actions[bot] commented 2 years ago

Hi there, thank you for your contribution!

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 at hand
  2. Comment that the issue is still reproducible and include:
    • What OS and version you reproduced the issue on
    • What steps you followed to reproduce the issue

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

Thanks!