Reputation: 13859
I'm building a local python package
cd <source dir>
python ./setup.py sdist
When I try and install it with pip, it attempts to delete a file that's not present, and fails.
pip install --verbose dist/pl_zenoss_handler-0.1.1.tar.gz
Unpacking ./dist/pl_zenoss_handler-0.1.1.tar.gz
Running setup.py (path:/tmp/pip-QohNov-build/setup.py) egg_info for package from file:///Users/travis.bear/p4/depot/service/python/_pl_zenoss_handler/dist/pl_zenoss_handler-0.1.1.tar.gz
running egg_info
creating pip-egg-info/pl_zenoss_handler.egg-info
writing pip-egg-info/pl_zenoss_handler.egg-info/PKG-INFO
writing top-level names to pip-egg-info/pl_zenoss_handler.egg-info/top_level.txt
<... much output deleted for brevity ... >
creating build/scripts-2.7
error: file '/private/tmp/pip-QohNov-build/bin/zen_handler' does not exist
----------------------------------------
Cleaning up...
Command /Users/travis.bear/venv/zenoss/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-QohNov-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-uIoyIG-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/travis.bear/venv/zenoss/include/site/python2.7 failed with error code 1 in /tmp/pip-QohNov-build
Exception information:
Traceback (most recent call last):
File "/Users/travis.bear/venv/zenoss/lib/python2.7/site-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/Users/travis.bear/venv/zenoss/lib/python2.7/site-packages/pip/commands/install.py", line 279, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/Users/travis.bear/venv/zenoss/lib/python2.7/site-packages/pip/req.py", line 1380, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/Users/travis.bear/venv/zenoss/lib/python2.7/site-packages/pip/req.py", line 699, in install
cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
File "/Users/travis.bear/venv/zenoss/lib/python2.7/site-packages/pip/util.py", line 697, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command /Users/travis.bear/venv/zenoss/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-QohNov-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-uIoyIG-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/travis.bear/venv/zenoss/include/site/python2.7 failed with error code 1 in /tmp/pip-QohNov-build
Storing debug log for failure in /Users/travis.bear/.pip/pip.log
Here is the setup.py file:
from setuptools import setup
readme = open('README.rst').read()
history = open('HISTORY.rst').read().replace('.. :changelog:', '')
setup(
name='pl_zenoss_handler',
version='0.1.1',
description='Sensu handler for Zenoss',
long_description=readme + '\n\n' + history,
author='Travis Bear',
author_email='<snip>',
url='<snip>',
packages=[
'zen_handler',
],
scripts=['bin/zen_handler'],
install_requires=[
],
license="BSD",
keywords='zenoss sensu'
)
Upvotes: 2
Views: 2322
Reputation: 44112
bin/zen_handler
file missing in distribution packageThe problem is, that your setup.py
is asking for use of file in bin/zen_handler
and in your distribution gz file it is missing.
bin/zen_handler
in your source treesetup.py
defines conditions for creating distribution packagebin/zen_handler
and fails.You shall check, if gz
file contains the bin/zen_handler
. I will assume, it is not present.
The reason is, that as it is not part of python package zen_handler
itself, it is not packaged into distribution.
Find the option for setup.py, which will declare even the bin/zen_handler
as part of the distribution package. This will probably mean editing MANIFEST.in
file (adding that file there) and/or using parameter include_package_data
.
entry_points
Instead of using paremater scripts
, use entry_point
as described in Automatic Script Creation. As this is using purely package python source code, it does not require existence of files outside.
I recommend this solution, even though it requires little modification in your code.
Upvotes: 1