Lab : Python Deply Flask App Q 7

hi

Lab : Python Deply Flask App Q 7 there is question and hint provided as below

========================================================

Now stop previously running app and run app.py with Gunicorn

Check

  • info_outline Hint

Run sudo pip install gunicorn; gunicorn app:app

  • Check gunicorn running

=====================================================================

But I get error at this step as below

Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-O56TXp/setuptools/
You are using pip version 8.1.2, however version 20.3.3 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.


thor@host01 /opt$ ls -al
total 12
drwxr-xr-x 1 root root 4096 Jan 19 16:22 .drwxr-xr-x 1 root root 4096 Jan 19 16:21 ..
drwxr-xr-x 3 root root 4096 Jan 19 16:23 simple-webapp-flask
thor@host01 /opt$
thor@host01 /opt$ cd simple-webapp-flask/thor@host01 /opt/simple-webapp-flask$
thor@host01 /opt/simple-webapp-flask$
thor@host01 /opt/simple-webapp-flask$ ls -al
total 32
drwxr-xr-x 3 root root 4096 Jan 19 16:23 .
drwxr-xr-x 1 root root 4096 Jan 19 16:22 ..
-rw-r--r-- 1 root root  254 Jan 19 16:23 app.py
-rw-r--r-- 1 root root  187 Jan 19 16:22 Dockerfile
drwxr-xr-x 8 root root 4096 Jan 19 16:22 .git
-rw-r--r-- 1 root root 1075 Jan 19 16:22 LICENSE
-rw-r--r-- 1 root root 1081 Jan 19 16:22 README.md
-rw-r--r-- 1 root root    6 Jan 19 16:22 requirements.txt
thor@host01 /opt/simple-webapp-flask$
thor@host01 /opt/simple-webapp-flask$ sudo pip install gunicorn
Collecting gunicorn
  Using cached https://files.pythonhosted.org/packages/69/ca/926f7cd3a2014b16870086b2d0fdc84a9e49473c68a8dff8b57f7c156f43/gunicorn-20.0.4-py2.py3-none-any.whl
Collecting setuptools>=3.0 (from gunicorn)
  Using cached https://files.pythonhosted.org/packages/96/66/1138b7ec901e86139c07900ce906c2f1e5c3400ee1cfd1e7ab3c776248c9/setuptools-51.3.3.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):      File "<string>", line 1, in <module>
      File "setuptools/__init__.py", line 16, in <module>
        import setuptools.version
      File "setuptools/version.py", line 1, in <module>
        import pkg_resources
      File "pkg_resources/__init__.py", line 1367
        raise SyntaxError(e) from e
                                ^
    SyntaxError: invalid syntax

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-O56TXp/setuptools/
You are using pip version 8.1.2, however version 20.3.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
thor@host01 /opt/simple-webapp-flask$
thor@host01 /opt/simple-webapp-flask$ pwd
/opt/simple-webapp-flask
thor@host01 /opt/simple-webapp-flask$
thor@host01 /opt/simple-webapp-flask$ date
Tue Jan 19 16:37:24 UTC 2021
thor@host01 /opt/simple-webapp-flask$
thor@host01 /opt/simple-webapp-flask$ history
    1  pwd
    2   cd /opt
    3  clear
    4  alias c=clear
    5  c
    6  sudo git clone https://github.com/mmumshad/simple-webapp-flask
    7  c
    8  pwd
    9  ls -al
   10  cd simple-webapp-flask/
   11  ls -al
   12  pip install -r requirements.txt
   13  c
   14  cat app.py
   15  sudo sed -i 's/8080/5000' app.py
   16  sudo sed -i 's/8080/5000/g' app.py
   17  nohup python app.py
   18  ps -ef | grep python
   19  ps -ef | grep app
   20  ps -ef | grep app.py
   21  c
   22  nohup python app.py &
   23  kill -9 152
   24  nohup python app.py &
   25  cat app.py
   26  ps -ef | grep app.py
   27  kill -9 166
   28  c
   29  ps -ef | grep app.py
   30  kill -9 180
   31  c
   32  sudo yum install gunicorn
   33  sudo yum update -y
   34  sudo yum install -y
   35  sudo yum upgrade -y
   36  c
   37  sudo yum update gunicorn
   38  sudo yum install gunicorn
   39  sudo pip install gunicorn
   40  c
   41  gunicorn app:app
   42  sudo gunicorn app:app
   43  clear
   44  pwd
   45  ls -al
   46  cat app.py
   47  ps -ef | grep app
   48  ps -ef | grep python
   49  kill -9 47 616
   50  cd /opt
   51  clear
   52  ls -al
   53  cd simple-webapp-flask/
   54  ls -al
   55  sudo pip install gunicorn
   56  pwd
   57  date
   58  history
thor@host01 /opt/simple-webapp-flask$

hor@host01 /opt/simple-webapp-flask$ pip install --upgrade pip
Cache entry deserialization failed, entry ignored
Collecting pip
  Downloading https://files.pythonhosted.org/packages/54/eb/4a3642e971f404d69d4f6fa3885559d67562801b99d7592487f1ecc4e017/pip-20.3.3-py2.py3-none-any.whl (1.5MB)
    100% |████████████████████████████████| 1.5MB 840kB/s
Installing collected packages: pip
  Found existing installation: pip 8.1.2
    Uninstalling pip-8.1.2:
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/site-packages/pip/commands/install.py", line 326, in run
    strip_file_prefix=options.strip_file_prefix,
  File "/usr/lib/python2.7/site-packages/pip/req/req_set.py", line 736, in install
    requirement.uninstall(auto_confirm=True)
  File "/usr/lib/python2.7/site-packages/pip/req/req_install.py", line 742, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/usr/lib/python2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/usr/lib/python2.7/site-packages/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/usr/lib64/python2.7/shutil.py", line 302, in move
    os.unlink(src)
OSError: [Errno 13] Permission denied: '/usr/bin/pip'
You are using pip version 8.1.2, however version 20.3.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
thor@host01 /opt/simple-webapp-flask$
thor@host01 /opt/simple-webapp-flask$





Hi @ppnehe, I could see that Gunicorn is running…

hi

I have given output of my history as well .
Is it possible for you to inspect and suggest what is causing this ?

with best regards
Pradeep Nehe