pythonpipsetuptoolsdistutils

Why do I keep getting this message when installing, saying EntryPoint must be in 'name=module:attrs [extras]


I am on OSx Mavericks, using Python 2.7, pip version 6.0.8 and Setuptools version 12.2.

When I try to install my project, I get warning messages but it installs successfully.

$ python setup.py install --user

If I use distutils, I get the message below which probably means its setup doesn't have kwarg entry_points.

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:
267: UserWarning: Unknown distribution option: 'entry_points'
warnings.warn(msg)

But when I try to install using pip the following way, I get the error messages below and the install doesn't continue:

$ pip install --user --editable .

If I use pip even if I have distutils setup imported, I get the below error message.

Obtaining file:///Users/Me/Development/pyclones/git-maildiff
error in maildiff setup command: ("EntryPoint must be in 'name=module:attrs [extras]' format", 'git-maildiff=scripts.git-maildiff')
Complete output from command python setup.py egg_info:
error in maildiff setup command: ("EntryPoint must be in 'name=module:attrs [extras]' format", 'git-maildiff=scripts.git-maildiff')
    
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /Users/Me/Development/pyclones/git-maildiff

Whilst I have a call to setup like this:

setup(
    name='maildiff',
    version=VERSION,
    author='Sanjeev Kumar',
    author_email='myemail@gmail.com',
    packages=['emaildiff', 'emaildiff/mail',],
    py_modules=['maildiff_cmd', 'version', 'send'],
    data_files = ['VERSION'],
    scripts=['scripts/git-maildiff'],
    license='LICENSE',
    description='Package to email color git diff',
    long_description=open('README.md').read(),
    entry_points={
    'console_scripts':
        ['git-maildiff=scripts.git-maildiff']
                }
)

Can anyone help me understand why I am getting this? I prefer to go with pip because I can use pip to uninstall it later, and I don't think there are any commands like setup.py uninstall or remove.


Solution

  • The entry point you define in these two lines:

    'console_scripts':
            ['git-maildiff=scripts.git-maildiff']
    

    has a - in it, I'm not sure if that's supported (git-maildiff is not a valid Python module name). Further, it misses the function name to call: main.

    You could first try adding main:

    'console_scripts':
            ['git-maildiff=scripts.git-maildiff:main']
    

    If that doesn't work, rename your script to remove the -. I think you can still leave git-maildiff as the entry-point name and just rename the module:

    'console_scripts':
            ['git-maildiff=scripts.git_maildiff:main']
    

    This should give you a git-maildiff script that calls the git_maildiff module. You'll have to rename your module file itself too.