Search code examples
pythonpypi

Is there any specific option on pip to hide the installation logs?


Actually I am trying to make A small script!!
Here i have configure function, so according to the function using
os, it will install all the requirements, what i wanna know is, is there any option to
hide the logs of pip install logs...

def configure():
    finished_event = threading.Event()
    progress_bar_thread = threading.Thread(target=run_progress_bar, args=(finished_event,))
    progress_bar_thread.start()
    logger.warn('Starting Configuration')
    logger.info('Installing Dependencies')
    os.system('pip3 install -r install.txt')
    #os.system("bash system_setup.sh")
    logger.info('Dependencies Installed')
    finished_event.set()
    progress_bar_thread.join()
    return True

So in my output log, i don't wanna see this requirement already satisfied, instead i wanna see only the progress of my function..

Progress: -2022-06-19 22:29:32.980663 [INFO] Installing Dependencies
Progres: /Requirement already satisfied: colorama in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from -r install.txt (line 1)) (0.4.4)
Requirement already satisfied: flask in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from -r install.txt (line 2)) (2.1.2)
Requirement already satisfied: selenium in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from -r install.txt (line 3)) (4.2.0)
Requirement already satisfied: rotate-screen in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from -r install.txt (line 4)) (0.1.0)
Requirement already satisfied: importlib-metadata>=3.6.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from flask->-r install.txt (line 2)) (4.11.4)
Requirement already satisfied: click>=8.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from flask->-r install.txt (line 2)) (8.1.3)
Requirement already satisfied: Werkzeug>=2.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from flask->-r install.txt (line 2)) (2.1.2)
Requirement already satisfied: itsdangerous>=2.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from flask->-r install.txt (line 2)) (2.1.2)
Requirement already satisfied: Jinja2>=3.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from flask->-r install.txt (line 2)) (3.1.2)
Requirement already satisfied: trio-websocket~=0.9 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from selenium->-r install.txt (line 3)) (0.9.2)
Requirement already satisfied: trio~=0.17 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from selenium->-r install.txt (line 3)) (0.21.0)
Requirement already satisfied: urllib3[secure,socks]~=1.26 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from selenium->-r install.txt (line 3)) (1.26.9)
Requirement already satisfied: zipp>=0.5 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from importlib-metadata>=3.6.0->flask->-r install.txt (line 2)) (3.8.0)
Requirement already satisfied: MarkupSafe>=2.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from Jinja2>=3.0->flask->-r install.txt (line 2)) (2.1.1)
Requirement already satisfied: outcome in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from trio~=0.17->selenium->-r install.txt (line 3)) (1.1.0)
Requirement already satisfied: async-generator>=1.9 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from trio~=0.17->selenium->-r install.txt (line 3)) (1.10)
Requirement already satisfied: attrs>=19.2.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from trio~=0.17->selenium->-r install.txt (line 3)) (21.4.0)
Requirement already satisfied: sortedcontainers in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from trio~=0.17->selenium->-r install.txt (line 3)) (2.4.0)
Requirement already satisfied: sniffio in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from trio~=0.17->selenium->-r install.txt (line 3)) (1.2.0)
Requirement already satisfied: idna in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from trio~=0.17->selenium->-r install.txt (line 3)) (3.3)
Requirement already satisfied: wsproto>=0.14 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from trio-websocket~=0.9->selenium->-r install.txt (line 3)) (1.1.0)
Requirement already satisfied: certifi in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from urllib3[secure,socks]~=1.26->selenium->-r install.txt (line 3)) (2022.5.18.1)
Requirement already satisfied: pyOpenSSL>=0.14 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from urllib3[secure,socks]~=1.26->selenium->-r install.txt (line 3)) (22.0.0)
Requirement already satisfied: cryptography>=1.3.4 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from urllib3[secure,socks]~=1.26->selenium->-r install.txt (line 3)) (37.0.2)
Requirement already satisfied: PySocks!=1.5.7,<2.0,>=1.5.6 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from urllib3[secure,socks]~=1.26->selenium->-r install.txt (line 3)) (1.7.1)
Progrees: -Requirement already satisfied: cffi>=1.12 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from cryptography>=1.3.4->urllib3[secure,socks]~=1.26->selenium->-r install.txt (line 3)) (1.15.0)
Requirement already satisfied: h11<1,>=0.9.0 in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from wsproto>=0.14->trio-websocket~=0.9->selenium->-r install.txt (line 3)) (0.13.0)
Requirement already satisfied: pycparser in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (from cffi>=1.12->cryptography>=1.3.4->urllib3[secure,socks]~=1.26->selenium->-r install.txt (line 3)) (2.21)
Progress: /2022-06-19 22:29:34.338922 [INFO] Dependencies Installed

So if you anyways to hide pip install -r install.txt
Logs, let me know, Thanks


Solution

  • So actually i found an inbuilt method to do it,

    its jus pip3 -q install -r install.txt

    Thats it, the q stands for quiet in the place

    ref: https://github.com/pypa/pip/issues/271

    Thanks a lot