Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setuptools doesn't install data_files correctly #460

Closed
ghost opened this issue Nov 10, 2015 · 13 comments
Closed

setuptools doesn't install data_files correctly #460

ghost opened this issue Nov 10, 2015 · 13 comments

Comments

@ghost
Copy link

ghost commented Nov 10, 2015

Originally reported by: jdemeyer (Bitbucket: jdemeyer, GitHub: jdemeyer)


NOTE 1: I have read the docs and know this is documented as a feature, but I think it's a bug anyway.

NOTE2: This might be related to #130, but I didn't quite understand what that bug is about.

When using

#!python

setup(...
    data_files=("some/relative/path", ["file1", ...])
)

and running ./setup.py install, these data_files are installed in the egg, which makes them inaccessible to other programs. I think that setuptools should just do what distutils does here, which is to install the files in sys.prefix/some/relative/path. The egg might still be the correct location for package_data, I'm not arguing with that.

Wheel also installs data files in sys.prefix. It's annoying to have a package which works correctly when installed as a wheel, but which doesn't install correctly when using ./setup.py install with setuptools.

The documentation http://pythonhosted.org/setuptools/setuptools.html#including-data-files starts with "the most common use case for data files distributed with a package is for use by the package, usually by including the data files in the package directory". This may be right, but it's not the only use case and the use case where data_files are needed by something else (which might not even be Python) isn't covered.

My particular use case is installing kernel.json files for Jupyter.


@ghost
Copy link
Author

ghost commented Nov 15, 2015

Original comment by iElectric (Bitbucket: iElectric, GitHub: Unknown):


I've already described that in https://bitbucket.org/pypa/setuptools/issues/130/install_data-doesnt-respect-prefix

@ghost
Copy link
Author

ghost commented Nov 17, 2015

Original comment by pombredanne (Bitbucket: pombredanne, GitHub: pombredanne):


and there is a related bug at https://bitbucket.org/pypa/wheel/issues/120/bdist_wheel-creates-a-wheel-that-installs FWIW

@ghost
Copy link
Author

ghost commented Nov 17, 2015

Original comment by pombredanne (Bitbucket: pombredanne, GitHub: pombredanne):


IMHO data_files are evil and should be deprecated entirely

@ghost
Copy link
Author

ghost commented Nov 17, 2015

Original comment by jdemeyer (Bitbucket: jdemeyer, GitHub: jdemeyer):


IMHO data_files are evil and should be deprecated entirely

Can you at least justify why you think that?

How would you install data files in such a way that

  1. the data files are publicly accessible, i.e. also outside of the installed package, possibly even by non-Python programs.
  2. the data files are installed correctly as wheel?

The fact that this simply cannot be done with setuptools is a very serious problem.

@ghost
Copy link
Author

ghost commented Nov 17, 2015

Original comment by jdemeyer (Bitbucket: jdemeyer, GitHub: jdemeyer):


@pombredanne: maybe you are confusing the data_files with absolute path (allowing to install to arbitrary locations on the file system) and data_files with relative path (relative to sys.prefix). I agree that the former is fishy (and not supported by wheel either), but relative paths are useful.

@ghost
Copy link
Author

ghost commented Nov 18, 2015

Original comment by pombredanne (Bitbucket: pombredanne, GitHub: pombredanne):


well I guess I jumped the gun, they are not entirely evil... and likely a needed evil for non-library packages... I guess the thing that is needed is consistency, clarity and convergence across setuptools, pip and wheel. There has been some extensive comments in this pip thread: pypa/pip#2874 (comment)

@ghost
Copy link
Author

ghost commented Nov 18, 2015

Original comment by jdemeyer (Bitbucket: jdemeyer, GitHub: jdemeyer):


I guess the thing that is needed is consistency, clarity and convergence across setuptools, pip and wheel.

Absolutely. I find this one of the most confusing parts of the Python system: we have distutils, setuptools, pip, wheel and they all do things in a slightly different way.

@ghost
Copy link
Author

ghost commented Nov 18, 2015

Original comment by pombredanne (Bitbucket: pombredanne, GitHub: pombredanne):


we have distutils, setuptools, pip, wheel and they all do things in a slightly different way.

True but things are changing fast for the better and we call all help to make it so.

@ghost
Copy link
Author

ghost commented Dec 2, 2015

Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco):


Duplicate of #130.

@ghost
Copy link
Author

ghost commented Dec 2, 2015

Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco):


I welcome suggestions on how to implement this proposed change. Please continue the discussion in #130.

@ghost
Copy link
Author

ghost commented Dec 2, 2015

Original comment by jdemeyer (Bitbucket: jdemeyer, GitHub: jdemeyer):


Like I said on this ticket and on #130, I don't really understand what #130 is about. While they are both about installing data files, they don't really look like duplicates.

@ghost
Copy link
Author

ghost commented Dec 2, 2015

Original comment by iElectric (Bitbucket: iElectric, GitHub: Unknown):


It's the same issue, but I've expressed myself in unclear way, sorry.

Currently: data_files are installed relative to root

Expected: data_files are installed relative to prefix (which also should respect root)

@ghost ghost added major bug labels Mar 29, 2016
@ghost ghost closed this as completed Mar 29, 2016
awood added a commit to candlepin/subscription-manager that referenced this issue May 5, 2016
Files under 'usr' are installed with setup.py.  Files outside of 'usr'
are installed using the makefile.  Apparently attempting to install
files outside of the "prefix" with setuptools is a fool's errand.  See
pypa/setuptools#460
awood added a commit to candlepin/subscription-manager that referenced this issue May 10, 2016
Files under 'usr' are installed with setup.py.  Files outside of 'usr'
are installed using the makefile.  Apparently attempting to install
files outside of the "prefix" with setuptools is a fool's errand.  See
pypa/setuptools#460
@a1an77
Copy link

a1an77 commented Sep 30, 2016

Duplicate of #130

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant