# pip freeze creating long list of dependencies

**URL:** <https://forum.djangoproject.com/t/pip-freeze-creating-long-list-of-dependencies/35003>\
**Category:** Using Django\
**Created:** [September 22, 2024, 12:51pm UTC](https://forum.djangoproject.com/t/pip-freeze-creating-long-list-of-dependencies/35003 "2024-09-22T12:51:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jlc1978](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/jlc1978/32/23432_2.png) [@jlc1978](https://forum.djangoproject.com/u/jlc1978)\
**Post date:** [September 22, 2024, 12:51pm UTC](https://forum.djangoproject.com/t/pip-freeze-creating-long-list-of-dependencies/35003/1 "2024-09-22T12:51:37Z")

</div>

So this really isn’t django, but it is causing issues deploying to Heroku.

My requirements.ini and .txt work fine deploying with just:

```auto
requirements.txt

asgiref==3.8.1
    # via django
django==5.1
    # via -r requirements.in
gunicorn==23.0.0
    # via -r requirements.in
packaging==24.1
    # via gunicorn
sqlparse==0.5.1
    # via django
whitenoise==6.07

requirements.ini

django
gunicorn
asgire
packaging
sqlparse
whitenoise

```

If I do pip freeze I get a much longer list:

```auto
anaconda-anon-usage @ file:///private/var/folders/k1/30mswbxs7r1g6zwn8y4fyt500000gp/T/abs_3eler6mjxh/croot/anaconda-anon-usage_1710965076906/work
appnope==0.1.4
archspec @ file:///croot/archspec_1709217642129/work
asgiref==3.8.1
asttokens==2.4.1
attrs==24.2.0
backcall==0.2.0
beautifulsoup4==4.12.3
bleach==6.1.0
boltons @ file:///Users/builder/cbouss/perseverance-python-buildout/croot/boltons_1699240838368/work
Brotli @ file:///private/var/folders/k1/30mswbxs7r1g6zwn8y4fyt500000gp/T/abs_27zk0eqdh0/croot/brotli-split_1714483157007/work
certifi @ file:///private/var/folders/k1/30mswbxs7r1g6zwn8y4fyt500000gp/T/abs_3bzbkiv4h_/croot/certifi_1707229182618/work/certifi
cffi @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_7a9c7wyorr/croot/cffi_1714483157752/work
charset-normalizer @ file:///tmp/build/80754af9/charset-normalizer_1630003229654/work
conda @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_7f1grzzulv/croot/conda_1714403043044/work
conda-content-trust @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_9fusbfzixa/croot/conda-content-trust_1714483157715/work
conda-libmamba-solver @ file:///croot/conda-libmamba-solver_1706733287605/work/src
conda-package-handling @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_5flg8a9vpv/croot/conda-package-handling_1714483157736/work
conda_package_streaming @ file:///Users/builder/cbouss/perseverance-python-buildout/croot/conda-package-streaming_1699238858289/work
cryptography @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_31zgxm62w8/croot/cryptography_1714660690857/work
decorator==5.1.1
defusedxml==0.7.1
distro @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_ddkyz0575y/croot/distro_1714488254309/work
Django==5.0.7
docopt==0.6.2
executing==2.1.0
fastjsonschema==2.20.0
gunicorn==23.0.0
idna @ file:///private/var/folders/k1/30mswbxs7r1g6zwn8y4fyt500000gp/T/abs_a12xpo84t2/croot/idna_1714398852854/work
ipython==8.12.3
jedi==0.19.1
Jinja2==3.1.4
jsonpatch @ file:///private/var/folders/k1/30mswbxs7r1g6zwn8y4fyt500000gp/T/abs_3ajyoz8zoj/croot/jsonpatch_1714483362270/work
jsonpointer==2.1
jsonschema==4.23.0
jsonschema-specifications==2023.12.1
jupyter_client==8.6.2
jupyter_core==5.7.2
jupyterlab_pygments==0.3.0
libmambapy @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_8b8wjifot8/croot/mamba-split_1714483537242/work/libmambapy
MarkupSafe==2.1.5
matplotlib-inline==0.1.7
menuinst @ file:///private/var/folders/k1/30mswbxs7r1g6zwn8y4fyt500000gp/T/abs_f09hp0bknw/croot/menuinst_1714510665223/work
mistune==3.0.2
nbclient==0.10.0
nbconvert==7.16.4
nbformat==5.10.4
Nuitka==2.3.11
ordered-set==4.1.0
packaging @ file:///private/var/folders/k1/30mswbxs7r1g6zwn8y4fyt500000gp/T/abs_a6lqg7at4g/croot/packaging_1710807410750/work
pandocfilters==1.5.1
parso==0.8.4
pexpect==4.9.0
pickleshare==0.7.5
pipreqs==0.5.0
pipreqsnb==0.2.4
platformdirs @ file:///Users/builder/cbouss/perseverance-python-buildout/croot/platformdirs_1701803010714/work
pluggy @ file:///Users/builder/cbouss/perseverance-python-buildout/croot/pluggy_1699237243543/work
prompt_toolkit==3.0.47
ptyprocess==0.7.0
pure_eval==0.2.3
pycosat @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_19qelmdbl6/croot/pycosat_1714510743067/work
pycparser @ file:///tmp/build/80754af9/pycparser_1636541352034/work
Pygments==2.18.0
PySocks @ file:///Users/builder/cbouss/perseverance-python-buildout/croot/pysocks_1699237568675/work
python-dateutil==2.9.0.post0
pyzmq==26.2.0
referencing==0.35.1
requests @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_b3tnputioh/croot/requests_1707355573919/work
rpds-py==0.20.0
ruamel.yaml @ file:///Users/builder/cbouss/perseverance-python-buildout/croot/ruamel.yaml_1699241608430/work
setuptools==69.5.1
six==1.16.0
soupsieve==2.6
sqlparse==0.5.1
stack-data==0.6.3
tinycss2==1.3.0
tornado==6.4.1
tqdm @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_72w005t9uu/croot/tqdm_1714567716531/work
traitlets==5.14.3
truststore @ file:///Users/builder/cbouss/perseverance-python-buildout/croot/truststore_1701805928787/work
urllib3 @ file:///private/var/folders/k1/30mswbxs7r1g6zwn8y4fyt500000gp/T/abs_aff2m3lasf/croot/urllib3_1707770561896/work
wcwidth==0.2.13
webencodings==0.5.1
wheel==0.43.0
whitenoise==6.7.0
yarg==0.1.9
zstandard @ file:///private/var/folders/k1/30mswbxs7r1g6zwn8y4fyt500000gp/T/abs_054juzz3it/croot/zstandard_1714677666952/work

```

that results in Heroku errors such as:

```auto
       ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/private/var/folders/k1/30mswbxs7r1g6zwn8y4fyt500000gp/T/abs_3eler6mjxh/croot/anaconda-anon-usage_1710965076906/work'
       
 ! Push rejected, failed to compile Python app.
 ! Push failed

```

As far as I can tell, I am not using anaconda, for example.

To add insult to injury, VS Code, when it auto generates requirements.text, replaces all of them with

```auto
django=5.07

```

---

<div class="post-metadata">

**Author:** ![FuzzyParrabellum](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/fuzzyparrabellum/32/23837_2.png) [@FuzzyParrabellum](https://forum.djangoproject.com/u/FuzzyParrabellum)\
**Post date:** [September 22, 2024, 2:56pm UTC](https://forum.djangoproject.com/t/pip-freeze-creating-long-list-of-dependencies/35003/2 "2024-09-22T14:56:52Z")

</div>

It may be a basic question but did you or all the people that worked on your project use a virtual environment ? ([Python Virtual Environments: A Primer – Real Python](https://realpython.com/python-virtual-environments-a-primer/) ).  
I already encountered a very long list of dependencies on another project when the project creator didn’t use a virtual environment and downloaded every package directly on its machine for years. When you use pip freeze outside of a virtual environment, it will list all python packages on your machine, not just all the packages you installed for a particular project. That would be a good explanation of why you would find anaconda packages in your project when you didn’t install them recently.

Your requirements files are also a bit weird because when you install django, django will also install all other libraries / dependencies that it needs to function and there is a lot (maybe two dozens, including Pillow, Jinja2 etc.) and they don’t appear in your requirements.txt file.  
You can test that by creating a virtual environment in an empty folder on your local machine, activating it, installing django with pip, and then using pip freeze.

---

<div class="post-metadata">

**Author:** ![jlc1978](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/jlc1978/32/23432_2.png) [@jlc1978](https://forum.djangoproject.com/u/jlc1978)\
**Post date:** [September 22, 2024, 5:00pm UTC](https://forum.djangoproject.com/t/pip-freeze-creating-long-list-of-dependencies/35003/3 "2024-09-22T17:00:57Z")

</div>

That’s probably it - while I am the only one working on it, I wasn’t running it in a venv in VS Code. Will start doing that.

The odd list was simply because, the than white noise, which I added, were hat appeared early on and work just fine in Heroku; so I decided not to mess with what worked even if it is an odd bunch. I break enough things by accident to not need to possibly break something on purpose.

Thanks

---

<div class="post-metadata">

**Author:** ![philgyford](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/philgyford/32/14295_2.png) [@philgyford](https://forum.djangoproject.com/u/philgyford)\
**Post date:** [September 22, 2024, 6:19pm UTC](https://forum.djangoproject.com/t/pip-freeze-creating-long-list-of-dependencies/35003/4 "2024-09-22T18:19:27Z")

</div>

> [@FuzzyParrabellum](#):
>
> Your requirements files are also a bit weird because when you install django, django will also install all other libraries / dependencies that it needs to function and there is a lot (maybe two dozens, including Pillow, Jinja2 etc.) and they don’t appear in your requirements.txt file.

No, Django’s only dependencies are asgiref, sqlparse, and maybe tzdata (see its [`pyproject.toml`](https://github.com/django/django/blob/main/pyproject.toml#L10)).

If you want to use Jinja2 [you have to install it](https://docs.djangoproject.com/en/5.1/topics/templates/#django.template.backends.jinja2.Jinja2).

Similarly, you have to install Pillow if you want to use [`ImageField`](https://docs.djangoproject.com/en/5.1/ref/models/fields/#imagefield).

---

<div class="post-metadata">

**Author:** ![FuzzyParrabellum](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/fuzzyparrabellum/32/23837_2.png) [@FuzzyParrabellum](https://forum.djangoproject.com/u/FuzzyParrabellum)\
**Post date:** [September 22, 2024, 7:21pm UTC](https://forum.djangoproject.com/t/pip-freeze-creating-long-list-of-dependencies/35003/5 "2024-09-22T19:21:21Z")

</div>

True, sorry for publishing wrong info.

I recently followed the tutorial for contributing to Django and downloaded the packages necessary for its test suite, this is what I used to compare with a pip freeze. Now I know that reading the source code and the pyproject.toml file is a better idea 👍

---

<div class="post-metadata">

**Author:** ![jlc1978](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/jlc1978/32/23432_2.png) [@jlc1978](https://forum.djangoproject.com/u/jlc1978)\
**Post date:** [September 22, 2024, 7:28pm UTC](https://forum.djangoproject.com/t/pip-freeze-creating-long-list-of-dependencies/35003/6 "2024-09-22T19:28:46Z")

</div>

Thanks to both of you. I appreciate the help
