3

Using setuptools version 26.1.1 via anaconda. I'm unable to execute any of my command line scripts I'm including with my package.

Here is what my setup.py looks like:

from setuptools import setup

config = {
    'description': 'Tools to extract information from web links',
    'author': 'Tailwind',
    'author_email': 'grantdelozier@gmail.com',
    'version': '0.1',
    'install_requires': ['nose'],
    'packages': ['ContentAnalysis'],
    'package_data': {
        'ContentAnalysis': ['data/*/*/*.txt']
    },
    'scripts': ['bin/content_analysis'],
    'name':'ContentAnalysis',
    'include_package_data':True
}

setup(**config)

After running python setup.py install, my script is placed in /opt/anaconda2/bin but the content is replaced with:

#!/opt/anaconda2/bin/python
# EASY-INSTALL-SCRIPT: 'ContentAnalysis==0.1','content_analysis'
__requires__ = 'ContentAnalysis==0.1'
__import__('pkg_resources').run_script('ContentAnalysis==0.1', 'content_analysis')

which fails with the following error:

grant@DevBox2:/opt/content-analysis$ content_analysis -l 'http://101beauty.org/how-to-use-baking-soda-to-reduce-dark-circles-and-bags-under-the-eyes/'
Traceback (most recent call last):
  File "/opt/anaconda2/bin/content_analysis", line 4, in <module>
    __import__('pkg_resources').run_script('ContentAnalysis==0.1', 'content_analysis')
  File "/opt/anaconda2/lib/python2.7/site-packages/setuptools-26.1.1-py2.7.egg/pkg_resources/__init__.py", line 744, in run_script
  File "/opt/anaconda2/lib/python2.7/site-packages/setuptools-26.1.1-py2.7.egg/pkg_resources/__init__.py", line 1491, in run_script
pkg_resources.ResolutionError: No script named 'content_analysis'
GrantD71
  • 1,787
  • 3
  • 19
  • 27
  • 1
    That's probably because you don't have it included in your `MANIFEST.in` file. Also, I'd use the [entry points](https://chriswarrick.com/blog/2014/09/15/python-apps-the-right-way-entry_points-and-scripts/) option – Wayne Werner Aug 31 '16 at 20:24
  • Why is it neccesary to include the script in a MANIFEST.in file? I would like for setuptools to stick the content_analysis script into the directory it is putting it, just leave the content of the script untouched. In older versions of setuptools, this was possible – GrantD71 Aug 31 '16 at 21:11
  • For reference, I'm attempting to add a script in the [first method described here](http://python-packaging.readthedocs.io/en/latest/command-line-scripts.html) – GrantD71 Aug 31 '16 at 21:17
  • Were you ever able to resolve this? I'm having the same problem running `conda` 4.0.5 and `setuptools` 27.2.0 on Linux. Strangely, there is no problem installing the same package on Mac with `conda` 4.2.9 and `setuptools` 27.2.0. As far as I can tell, the wrapper scripts around the executables are the same. – kadrlica Jan 07 '17 at 18:39
  • It was a setuptools issue and not a conda issue, see [this link](http://stackoverflow.com/questions/39280326/python-entry-point-console-scripts-not-found). I also had another [non-setuptools related issue](http://stackoverflow.com/questions/39255544/conda-setuptools-install-changes-shebangs-to-default-python-install) that contributed to the error – GrantD71 Jan 07 '17 at 21:38

0 Answers0