NOTE: As of Sep. 4th, 2015, I can no longer reproduce this problem, using current versions of python and setuptools/distutils, in either python 2 or 3.
NOTE: I've answered this question myself and will be accepting the answer as soon as the system lets me, but this would appear to be the only instance of an English-language reference to the problem on the internet (according to google), so I thought I'd post both in hopes this can be useful.
I ran into a problem that I found impossible to debug when installing a python package of my own. It's a very simple package, with a flat structure (no subdirectories), and a few data files I need copied over at installation. With a few deletions for brevity, I have this:
spherical_functions
├── MANIFEST.in
├── __init__.py
├── spherical_functions.py
├── ladder_operator_coefficients.npy
└── setup.py
When installing from my source directory, I have no problems. But when I either switched to setuptools
or installed with pip
(which is needed for distribution), I get the error
can't copy 'ANIFEST.in': doesn't exist or not a regular file
Note the missing M
at the beginning of that file name. I hacked into distutils
a bit to verify that it was actually trying to copy ANIFEST.in
, rather than just misreporting the name. Unfortunately, the trail ends there, because the rest of the setuptools code is hidden in some egg I don't understand.
A similar problem arises without a MANIFEST.in
file, using just the package_data
option to the setup
function, where it misses the first letter of the data file, as in
error: can't copy 'adder_operator_coefficients.npy': doesn't exist or not a regular file
With a hint from this thread, I realized that I was making the mistake; I didn't really understand all the options to the setup
function in setup.py
. I had
package_dir={'spherical_functions': ''},
when I should have had
package_dir={'spherical_functions': '.'},
(Note the extra dot.) After including this, it seems to work just fine.
I might suggest that the resulting behavior is wrong in any case, suggesting a bug in setuptools and/or distutils. Or at least there could be a check to ensure that the user didn't do something stupid like I did...