Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 756
ronakg Avatar asked Feb 11 '17 23:02

ronakg


1 Answers

Two options I can think of, first,check that pip is pointing in the right place. So try:

which python

mine says:

/usr/bin/python

yours will be different, change the path accordingly to then make sure the PATH is properly set, so:

export PATH=/usr/bin/python:${PATH}

Reinstall pip and try again. Failing that, a workaround might be to not use pip in this instance and try:

python setup.py install

which will use your default python path (not pip) and should install to:

/usr/local/bin 
like image 75
Nick H Avatar answered Sep 28 '22 08:09

Nick H