0

So I have a little package in pip and I want to install it. Let's call it noty. The issue is that if I install it with sudo pip3 install noty the program will run but if I install it using pip3 install noty every time I will try typing noty into the terminal it just won't work. Any solution? Thanks in advance. I am also including some lines of my setup.py file, if that somehow helps.

entry_points='''
        [console_scripts]
        noty=noty.noty:cli
    ''',
0

2 Answers 2

1

I suggest to create a virtual environment (for this, I suggest pew https://github.com/berdario/pew) and to install the desired package in it. Entry points are supported in virtual environments.

A possible alternative is to rely on pipx: https://github.com/pipxproject/pipx

Last but not least, you can install packages with pip in "user mode": the packages will be installed in your user directory (e.g. pip install noty --user). Unfortunately, nearly none of the "common distributions" supports entry points that way (because they are installed in "~/.local/bin") unless you add this folder to the PATH:

export PATH=~/.local/bin:$PATH

This line can be added to "~/.bash_profile" so it is automatically loaded on startup (and if you don't want to wait until the next startup, simply do source ~/.bash_profile).

1

Sudo is needed, otherwise those directories (e.g. /usr/lib/python/site-packages/) are not writeable.

Not the answer you're looking for? Browse other questions tagged or ask your own question.