1

I am working on an application that needs installation for airnotifier, I have followed the installation instruction in the following link:

https://github.com/dcai/airnotifier/wiki/Installation-3.x

on the last command of running app.py I got the following error

airnotifier@airnotifier:~/airnotifier$ pipenv run python app.py
app.py:73: DeprecationWarning: The 'warn' function is deprecated, use 'warning' instead
  logging.warn("Sentry dsn is not set")
[W 220718 20:08:43 app:73] Sentry dsn is not set
[I 220718 20:08:43 routes:73] init route: controllers.auth
[I 220718 20:08:43 routes:73] init route: controllers.base
[I 220718 20:08:43 routes:73] init route: controllers.broadcast
[I 220718 20:08:43 routes:73] init route: controllers.keys
[I 220718 20:08:43 routes:73] init route: controllers.newapp
[I 220718 20:08:43 routes:73] init route: controllers.settings
[I 220718 20:08:43 routes:73] init route: controllers.tokens
[I 220718 20:08:43 routes:73] init route: api.accesskeys
[I 220718 20:08:43 routes:73] init route: api.broadcast
[I 220718 20:08:43 routes:73] init route: api.push
[I 220718 20:08:43 routes:73] init route: api.tokens
Traceback (most recent call last):
  File "app.py", line 95, in <module>
    WebApplication(container).main()
  File "/home/airnotifier/airnotifier/web.py", line 146, in main
    http_server.listen(options.port)
  File "/home/airnotifier/.local/share/virtualenvs/airnotifier-dIcrTSca/lib/python3.8/site-packages/tornado/tcpserver.py", line 151, in listen
    sockets = bind_sockets(port, address=address)
  File "/home/airnotifier/.local/share/virtualenvs/airnotifier-dIcrTSca/lib/python3.8/site-packages/tornado/netutil.py", line 174, in bind_sockets
    sock.bind(sockaddr)
PermissionError: [Errno 13] Permission denied
airnotifier@airnotifier:~/airnotifier$

I checked the permissions of the files and searched a lot but couldn't find a way to solve this problem

Amira Elsayed Ismail
  • 9,216
  • 30
  • 92
  • 175
  • looks like the permission errors might be with ports/socket not files. Did you run with `sudo`? what port is it trying to use? – Esther Jul 18 '22 at 20:27
  • @Esther when I use sudo I got the following error sudo: pipenv: command not found – Amira Elsayed Ismail Jul 18 '22 at 20:34
  • https://stackoverflow.com/questions/24001147/python-bind-socket-error-errno-13-permission-denied – Esther Jul 18 '22 at 20:34
  • yes, I am not sure why the instructions say to install `pipenv` only for `--user` but then use with `sudo` (as root). Perhaps you need to install pipenv for root as well, if you need to use it as root. – Esther Jul 18 '22 at 20:37
  • @Esther OK I will try install it again, Thanks a lot for your help – Amira Elsayed Ismail Jul 18 '22 at 20:37
  • @Esther this command fix the issue of sudo not found : sudo -H pip install -U pipenv but now I am facing another problem ModuleNotFoundError: No module named 'tornado' – Amira Elsayed Ismail Jul 18 '22 at 20:49

2 Answers2

2

You need to run with sudo, as stated in the installation instructions you linked. As you see, the error comes from trying to bind a socket to a port. Most probably it's trying to use a privileged port (<1024), which can only be done with elevated permissions (ie sudo).

Esther
  • 450
  • 3
  • 9
0

If you are facing these issues:

error: <class 'PermissionError'>, [Errno 13] Permission denied: file: /usr/lib/python3/dist-packages/supervisor/xmlrpc.py

you need to use sudo like restart celery then sudo supervisorctl restart all

greybeard
  • 2,249
  • 8
  • 30
  • 66
  • If you are facing these issues "error: , [Errno 13] Permission denied: file: /usr/lib/python3/dist-packages/supervisor/xmlrpc.py line: 560" – Jay Maurya Jun 28 '23 at 05:53
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 29 '23 at 20:49