skip to Main Content

I have defined many pip packages in a requirements.txt, but I have not define the "futures" package:

...
future == 0.18.3
six == 1.16.0
joblib == 1.2.0
...

And then download all packages with the following command on Ubuntu 22.04:

pip3.9 download -r "/home/requirements.txt"

The above command exited with the following error:

...
...
Collecting widgetsnbextension~=4.0.7
  Downloading widgetsnbextension-4.0.7-py3-none-any.whl (2.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 3.9 MB/s eta 0:00:00
Collecting branca>=0.5.0
  Downloading branca-0.6.0-py3-none-any.whl (24 kB)
Collecting traittypes<3,>=0.2.1
  Downloading traittypes-0.2.1-py2.py3-none-any.whl (8.6 kB)
Collecting xyzservices>=2021.8.1
  Downloading xyzservices-2023.5.0-py3-none-any.whl (56 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 56.5/56.5 KB 1.3 MB/s eta 0:00:00
Collecting futures
  Downloading futures-3.0.5.tar.gz (25 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [25 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 14, in <module>
        File "/python39/lib/python3.9/site-packages/setuptools/__init__.py", line 18, in <module>
          from setuptools.dist import Distribution
        File "/python39/lib/python3.9/site-packages/setuptools/dist.py", line 32, in <module>
          from setuptools.extern.more_itertools import unique_everseen
        File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
        File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
        File "<frozen importlib._bootstrap>", line 565, in module_from_spec
        File "/python39/lib/python3.9/site-packages/setuptools/extern/__init__.py", line 52, in create_module
          return self.load_module(spec.name)
        File "/python39/lib/python3.9/site-packages/setuptools/extern/__init__.py", line 37, in load_module
          __import__(extant)
        File "/python39/lib/python3.9/site-packages/setuptools/_vendor/more_itertools/__init__.py", line 1, in <module>
          from .more import *  # noqa
        File "/python39/lib/python3.9/site-packages/setuptools/_vendor/more_itertools/more.py", line 5, in <module>
          from concurrent.futures import ThreadPoolExecutor
        File "/tmp/pip-download-jelw4tc2/futures/concurrent/futures/__init__.py", line 8, in <module>
          from concurrent.futures._base import (FIRST_COMPLETED,
        File "/tmp/pip-download-jelw4tc2/futures/concurrent/futures/_base.py", line 357
          raise type(self._exception), self._exception, self._traceback
                                     ^
      SyntaxError: invalid syntax
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> futures

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

How to find out which package depends on the "futures" from the "requirements.txt"?

Here is the dummy code:

# find_out_depends --requirement-file "/home/requirements.txt" --find-depends "futures"

Is there any "find_out_depends" command for accepting requirements.txt as argument and then print out the whole dependencies tree?

2

Answers


  1. Check out this thread, you can use pipdeptree to achieve something similar to what you are looking for:

    Is there any way to show the dependency trees for pip packages?

    I imagine that you could just write a bash script to run this command on every module in your requirements.txt file.

    Login or Signup to reply.
  2. Create a fresh Python 3.9 venv and install your requirements without dependencies:

    python3.9 -m pip install --no-deps requirements.txt
    

    Then run the pip check CLI:

    python3.9 -m pip check
    

    It will complain that some package(s) have unmet dependencies, and you should find futures somewhere in there. Not to be confused with future, which is cross-compat.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search