Nixpkgs: Python: collisions with backports namespace package

Created on 31 Jan 2017  Â·  10Comments  Â·  Source: NixOS/nixpkgs

Issue description

collision between `/nix/store/qr9rrhalxbi1x914xj0hh9y73sfn1p3l-python2.7-backports.ssl_match_hostname-3.5.0.1/lib/python2.7/site-packages/backports/__init__.py' and `/nix/store/lazj5zfz9ysbadlrjwnzj4aa1znff7ff-python2.7-backports.shutil_get_terminal_size-1.0.0/lib/python2.7/site-packages/backports/__init__.py'

Steps to reproduce

Technical details

  • System: (NixOS: nixos-version, Ubuntu/Fedora: lsb_release -a, ...)
  • Nix version: (run nix-env --version)
  • Nixpkgs version: (run nix-instantiate --eval '<nixpkgs>' -A lib.nixpkgsVersion)
wontfix python

Most helpful comment

Indeed, you're right.

I don't see any other solution than using python.buildEnv.override and passing ignoreCollisions = true;.
What we're seeing here is exactly the reason PEP 420 exists.

All 10 comments

What caused this to happen? Can you provide steps to reproduce the issue, and version details, as in the issue template?

Looks to be a similar issue as https://github.com/NixOS/nixpkgs/issues/22311 so I am closing this. As @lheckemann said you need to give more details.

@FRidh the issue is different - the problem is setuptools namespace packages generating namespace declaring __init__.py files - now if you merge the file tree of 2 of those, both will have a __init__.py with the same content

$ nix-build -E '((import <nixpkgs> {}).python.withPackages (ps: [ps.backports_ssl_match_hostname ps.backports_shutil_get_terminal_size]))'
these derivations will be built:
  /nix/store/cp5p81j8mk94jhjy55q6aip67vld3qxi-python-2.7.13-env.drv
building path(s) ‘/nix/store/wdh53zgsjfcw9zscy6mw9iq01cgwcgsb-python-2.7.13-env’
collision between `/nix/store/qr9rrhalxbi1x914xj0hh9y73sfn1p3l-python2.7-backports.ssl_match_hostname-3.5.0.1/lib/python2.7/site-packages/backports/__init__.py' and `/nix/store/lazj5zfz9ysbadlrjwnzj4aa1znff7ff-python2.7-backports.shutil_get_terminal_size-1.0.0/lib/python2.7/site-packages/backports/__init__.py'
builder for ‘/nix/store/cp5p81j8mk94jhjy55q6aip67vld3qxi-python-2.7.13-env.drv’ failed with exit code 25
error: build of ‘/nix/store/cp5p81j8mk94jhjy55q6aip67vld3qxi-python-2.7.13-env.drv’ failed

According to PEP 420 namespace packages shouldn't have an __init__.py

The __init__.py refers to PEP 382 which was rejected and was eventually replaced by PEP 420. Therefore, this is an upstream issue.

Even so, we could have a look at how to fix it for now.

@FRidh pep420 doesn't apply to python2.7 - this is setuptools namespaces that need the file

Indeed, you're right.

I don't see any other solution than using python.buildEnv.override and passing ignoreCollisions = true;.
What we're seeing here is exactly the reason PEP 420 exists.

Closing because there isn't much else we can do here.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rzetterberg picture rzetterberg  Â·  3Comments

langston-barrett picture langston-barrett  Â·  3Comments

ob7 picture ob7  Â·  3Comments

ghost picture ghost  Â·  3Comments

vaibhavsagar picture vaibhavsagar  Â·  3Comments