Search code examples
pythonbashpipsetup.py

pip not installing entry_points as executables


I'm trying to create a package of my own. The package is very simple, it has one python module and one bash script. I wan both of them to be installed under /usr/local/bin so that they can be directly executed.

Here's my setup.py file:

from setuptools import setup

setup(
    name='deploy',
    .
    .
    .
    install_requires=['pyyaml', 'cot', 'jsonschema'],
    entry_points={
        'console_scripts': [
            'cloud_config = cloud_config:main',
        ],
    },
    scripts=['deploy.sh'],
)

Here's excerpt from output of pip install ...:

running install_scripts
    copying build/scripts-2.7/deploy.sh -> /usr/local/lib/python2.7.10/bin
    changing mode of /usr/local/lib/python2.7.10/bin/deploy.sh to 755
    Installing cloud_config script to /usr/local/lib/python2.7.10/bin

With this, I'm not able to invoke either the python or the bash script directly.

Any ideas?

Edit: I'm running the pip on Ubuntu 16.04.1 machine. Just tried to install the same package on a Ubuntu 14.04 machine and behavior is as expected. cloud_config.py and deploy.sh both get installed to /usr/local/bin and I can invoke both from anywhere on the system.


Solution

  • Finally I got it to work. I had to remove the pip package that was installed by apt.

    sudo apt remove python-pip
    

    And then install pip again according to instructions on their website - https://pip.pypa.io/en/stable/installing/.

    wget https://bootstrap.pypa.io/get-pip.py
    sudo python get-pip.py
    

    Looks like pip from Ubuntu's default repository is not same as one distributed by pypi.