Search code examples
pythoninstallationsetuptoolsentry-point

Python entry point commandline script not found when installing with --user flag


I recently wrote a package which comes with a command line tool. The setup.py looks something like this

from setuptools import setup

setup(...
      entry_points = {
            'console_scripts': [
                    'cmdname = modulename.binary:main',
                ],
          },
      ...)

everything is fine when I install it without the --user flag via

$ sudo python setup.py install
$ cmdname
Yes, I'm here! Give me a command!

however, installing it without root access gives

$ python setup.py install --user
$ cmdname
-bash: cmdname: command not found

I guess there should be a directory where user scripts are linked to that should be exported to the PATH? How can I achieve that setuptools links to the entry point anyway? Or is that not possible?


Solution

  • The binary was installed to ~/.local/bin/. Hence, adding export PATH=~/.local/bin:$PATH to ~/.bash_profile and

    $ source ~/.bash_profile
    

    solved the issue.