Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python3 requirements.txt file shows unwanted packages

I created a virtual environment using : python3 -m venv . I then used the command pip freeze requirements.txt to get the list of packages.

Below is the content of the file requirements.txt

apsw==3.16.2.post1
asn1crypto==0.24.0
beautifulsoup4==4.6.0
chardet==3.0.4
CherryPy==8.9.1
configparser==3.5.0
cryptography==2.1.4
cssselect==1.0.3
cssutils==1.0.2
dnspython==1.15.0
enum34==1.1.6
feedparser==5.2.1
flake8==3.5.0
html5-parser==0.4.4
html5lib==0.999999999
idna==2.6
ipaddress==1.0.17
jedi==0.11.1
keyring==10.6.0
keyrings.alt==3.0
lxml==4.2.1
Markdown==2.6.9
mccabe==0.6.1
mechanize==0.2.5
msgpack==0.5.6
mysql-connector-python==8.0.6
mysql-utilities==1.6.4
netifaces==0.10.4
numpy==1.14.5
olefile==0.45.1
paramiko==2.0.0
parso==0.1.1
pep8==1.7.1
pexpect==4.2.1
Pillow==5.1.0
pyasn1==0.4.2
pycodestyle==2.3.1
pycrypto==2.6.1
pyflakes==1.6.0
Pygments==2.2.0
pygobject==3.26.1
pyodbc==4.0.17
pyOpenSSL==17.5.0
pyparsing==2.2.0
pysqlite==2.7.0
python-dateutil==2.6.1
pyxdg==0.25
PyYAML==3.12
regex==2017.12.12
repoze.lru==0.7
Routes==2.4.1
SecretStorage==2.3.1
simplejson==3.13.2
six==1.11.0
unity-lens-photos==1.0
uTidylib==0.3
virtualenv==15.2.0
webencodings==0.5
WebOb==1.7.3

I am not sure which packages are required for the project. Much of the packages seem not required for the project. Why is the requirements.txt showing so many packages? How to fix this so that requirements.txt shows a list of packages required for a particular project?(I could manually remove them but why are they shown in requirements.txt in the first place ?)

Note : Previously I used to install packages by sudo apt-get install python3-package-name. Has this caused a permanent install of the packages and is duplicated in the virtual environment created via python -m venv .? Or are these default and mandatory packages?

OS : ubuntu 18.04, python version : 3.6.5, pip version : 9.0.1

like image 745
Hemal Mamtora Avatar asked Nov 30 '25 01:11

Hemal Mamtora


1 Answers

we can list only locally installed packages using '-l' argument. $ pip freeze -l

Reference: https://pip.pypa.io/en/stable/reference/pip_freeze/

like image 152
Sai Kishore Avatar answered Dec 07 '25 10:12

Sai Kishore



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!