We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Avoid dependencies duplicity
<!-- ⚠️ If you do not respect this template, your issue will be closed -->
<!-- ⚠️ Make sure to browse the opened and closed issues to confirm this idea does not exist. -->

### What is the expected enhancement?
Currently, when you want to add or update a dependency, you need to do that in the `requirements.txt` and `setup.py` files. That is really error-prone.

It would be nice to avoid that situation and make changes only in one of the files when a dependency is added or updated.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `setup.py`
Content:
```
1 # This code is part of Qiskit.
2 #
3 # (C) Copyright IBM 2017.
4 #
5 # This code is licensed under the Apache License, Version 2.0. You may
6 # obtain a copy of this license in the LICENSE.txt file in the root directory
7 # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
8 #
9 # Any modifications or derivative works of this code must retain this
10 # copyright notice, and modified files need to carry a notice indicating
11 # that they have been altered from the originals.
12 
13 "The Qiskit Terra setup file."
14 
15 import os
16 import sys
17 from setuptools import setup, find_packages, Extension
18 try:
19     from Cython.Build import cythonize
20 except ImportError:
21     import subprocess
22     subprocess.call([sys.executable, '-m', 'pip', 'install', 'Cython>=0.27.1'])
23     from Cython.Build import cythonize
24 
25 REQUIREMENTS = [
26     "contextvars>=2.4;python_version<'3.7'",
27     "jsonschema>=2.6",
28     "retworkx>=0.7.0",
29     "numpy>=1.17",
30     "ply>=3.10",
31     "psutil>=5",
32     "scipy>=1.4",
33     "sympy>=1.3",
34     "dill>=0.3",
35     "fastjsonschema>=2.10",
36     "python-constraint>=1.4",
37     "python-dateutil>=2.8.0",
38 ]
39 
40 # Add Cython extensions here
41 CYTHON_EXTS = ['utils', 'swap_trial']
42 CYTHON_MODULE = 'qiskit.transpiler.passes.routing.cython.stochastic_swap'
43 CYTHON_SOURCE_DIR = 'qiskit/transpiler/passes/routing/cython/stochastic_swap'
44 
45 INCLUDE_DIRS = []
46 # Extra link args
47 LINK_FLAGS = []
48 # If on Win and not in MSYS2 (i.e. Visual studio compile)
49 if (sys.platform == 'win32' and os.environ.get('MSYSTEM') is None):
50     COMPILER_FLAGS = ['/O2']
51 # Everything else
52 else:
53     COMPILER_FLAGS = ['-O2', '-funroll-loops', '-std=c++11']
54     if sys.platform == 'darwin':
55         # These are needed for compiling on OSX 10.14+
56         COMPILER_FLAGS.append('-mmacosx-version-min=10.9')
57         LINK_FLAGS.append('-mmacosx-version-min=10.9')
58 
59 
60 EXT_MODULES = []
61 # Add Cython Extensions
62 for ext in CYTHON_EXTS:
63     mod = Extension(CYTHON_MODULE + '.' + ext,
64                     sources=[CYTHON_SOURCE_DIR + '/' + ext + '.pyx'],
65                     include_dirs=INCLUDE_DIRS,
66                     extra_compile_args=COMPILER_FLAGS,
67                     extra_link_args=LINK_FLAGS,
68                     language='c++')
69     EXT_MODULES.append(mod)
70 
71 # Read long description from README.
72 README_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)),
73                            'README.md')
74 with open(README_PATH) as readme_file:
75     README = readme_file.read()
76 
77 setup(
78     name="qiskit-terra",
79     version="0.17.0",
80     description="Software for developing quantum computing programs",
81     long_description=README,
82     long_description_content_type='text/markdown',
83     url="https://github.com/Qiskit/qiskit-terra",
84     author="Qiskit Development Team",
85     author_email="hello@qiskit.org",
86     license="Apache 2.0",
87     classifiers=[
88         "Environment :: Console",
89         "License :: OSI Approved :: Apache Software License",
90         "Intended Audience :: Developers",
91         "Intended Audience :: Science/Research",
92         "Operating System :: Microsoft :: Windows",
93         "Operating System :: MacOS",
94         "Operating System :: POSIX :: Linux",
95         "Programming Language :: Python :: 3 :: Only",
96         "Programming Language :: Python :: 3.6",
97         "Programming Language :: Python :: 3.7",
98         "Programming Language :: Python :: 3.8",
99         "Programming Language :: Python :: 3.9",
100         "Topic :: Scientific/Engineering",
101     ],
102     keywords="qiskit sdk quantum",
103     packages=find_packages(exclude=['test*']),
104     install_requires=REQUIREMENTS,
105     setup_requires=['Cython>=0.27.1'],
106     include_package_data=True,
107     python_requires=">=3.6",
108     extras_require={
109         'visualization': ['matplotlib>=2.1', 'ipywidgets>=7.3.0',
110                           'pydot', "pillow>=4.2.1", "pylatexenc>=1.4",
111                           "seaborn>=0.9.0", "pygments>=2.4"],
112         'classical-function-compiler': ['tweedledum'],
113         'full-featured-simulators': ['qiskit-aer>=0.1'],
114         'crosstalk-pass': ['z3-solver>=4.7'],
115     },
116     project_urls={
117         "Bug Tracker": "https://github.com/Qiskit/qiskit-terra/issues",
118         "Documentation": "https://qiskit.org/documentation/",
119         "Source Code": "https://github.com/Qiskit/qiskit-terra",
120     },
121     ext_modules=cythonize(EXT_MODULES),
122     zip_safe=False
123 )
124
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -22,20 +22,8 @@
     subprocess.call([sys.executable, '-m', 'pip', 'install', 'Cython>=0.27.1'])
     from Cython.Build import cythonize
 
-REQUIREMENTS = [
-    "contextvars>=2.4;python_version<'3.7'",
-    "jsonschema>=2.6",
-    "retworkx>=0.7.0",
-    "numpy>=1.17",
-    "ply>=3.10",
-    "psutil>=5",
-    "scipy>=1.4",
-    "sympy>=1.3",
-    "dill>=0.3",
-    "fastjsonschema>=2.10",
-    "python-constraint>=1.4",
-    "python-dateutil>=2.8.0",
-]
+with open('requirements.txt') as f:
+    REQUIREMENTS = f.read().splitlines()
 
 # Add Cython extensions here
 CYTHON_EXTS = ['utils', 'swap_trial']

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -22,20 +22,8 @@\n     subprocess.call([sys.executable, '-m', 'pip', 'install', 'Cython>=0.27.1'])\n     from Cython.Build import cythonize\n \n-REQUIREMENTS = [\n-    \"contextvars>=2.4;python_version<'3.7'\",\n-    \"jsonschema>=2.6\",\n-    \"retworkx>=0.7.0\",\n-    \"numpy>=1.17\",\n-    \"ply>=3.10\",\n-    \"psutil>=5\",\n-    \"scipy>=1.4\",\n-    \"sympy>=1.3\",\n-    \"dill>=0.3\",\n-    \"fastjsonschema>=2.10\",\n-    \"python-constraint>=1.4\",\n-    \"python-dateutil>=2.8.0\",\n-]\n+with open('requirements.txt') as f:\n+    REQUIREMENTS = f.read().splitlines()\n \n # Add Cython extensions here\n CYTHON_EXTS = ['utils', 'swap_trial']\n", "issue": "Avoid dependencies duplicity\n<!-- \u26a0\ufe0f If you do not respect this template, your issue will be closed -->\r\n<!-- \u26a0\ufe0f Make sure to browse the opened and closed issues to confirm this idea does not exist. -->\r\n\r\n### What is the expected enhancement?\r\nCurrently, when you want to add or update a dependency, you need to do that in the `requirements.txt` and `setup.py` files. That is really error-prone.\r\n\r\nIt would be nice to avoid that situation and make changes only in one of the files when a dependency is added or updated.\r\n\n", "before_files": [{"content": "# This code is part of Qiskit.\n#\n# (C) Copyright IBM 2017.\n#\n# This code is licensed under the Apache License, Version 2.0. You may\n# obtain a copy of this license in the LICENSE.txt file in the root directory\n# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.\n#\n# Any modifications or derivative works of this code must retain this\n# copyright notice, and modified files need to carry a notice indicating\n# that they have been altered from the originals.\n\n\"The Qiskit Terra setup file.\"\n\nimport os\nimport sys\nfrom setuptools import setup, find_packages, Extension\ntry:\n    from Cython.Build import cythonize\nexcept ImportError:\n    import subprocess\n    subprocess.call([sys.executable, '-m', 'pip', 'install', 'Cython>=0.27.1'])\n    from Cython.Build import cythonize\n\nREQUIREMENTS = [\n    \"contextvars>=2.4;python_version<'3.7'\",\n    \"jsonschema>=2.6\",\n    \"retworkx>=0.7.0\",\n    \"numpy>=1.17\",\n    \"ply>=3.10\",\n    \"psutil>=5\",\n    \"scipy>=1.4\",\n    \"sympy>=1.3\",\n    \"dill>=0.3\",\n    \"fastjsonschema>=2.10\",\n    \"python-constraint>=1.4\",\n    \"python-dateutil>=2.8.0\",\n]\n\n# Add Cython extensions here\nCYTHON_EXTS = ['utils', 'swap_trial']\nCYTHON_MODULE = 'qiskit.transpiler.passes.routing.cython.stochastic_swap'\nCYTHON_SOURCE_DIR = 'qiskit/transpiler/passes/routing/cython/stochastic_swap'\n\nINCLUDE_DIRS = []\n# Extra link args\nLINK_FLAGS = []\n# If on Win and not in MSYS2 (i.e. Visual studio compile)\nif (sys.platform == 'win32' and os.environ.get('MSYSTEM') is None):\n    COMPILER_FLAGS = ['/O2']\n# Everything else\nelse:\n    COMPILER_FLAGS = ['-O2', '-funroll-loops', '-std=c++11']\n    if sys.platform == 'darwin':\n        # These are needed for compiling on OSX 10.14+\n        COMPILER_FLAGS.append('-mmacosx-version-min=10.9')\n        LINK_FLAGS.append('-mmacosx-version-min=10.9')\n\n\nEXT_MODULES = []\n# Add Cython Extensions\nfor ext in CYTHON_EXTS:\n    mod = Extension(CYTHON_MODULE + '.' + ext,\n                    sources=[CYTHON_SOURCE_DIR + '/' + ext + '.pyx'],\n                    include_dirs=INCLUDE_DIRS,\n                    extra_compile_args=COMPILER_FLAGS,\n                    extra_link_args=LINK_FLAGS,\n                    language='c++')\n    EXT_MODULES.append(mod)\n\n# Read long description from README.\nREADME_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)),\n                           'README.md')\nwith open(README_PATH) as readme_file:\n    README = readme_file.read()\n\nsetup(\n    name=\"qiskit-terra\",\n    version=\"0.17.0\",\n    description=\"Software for developing quantum computing programs\",\n    long_description=README,\n    long_description_content_type='text/markdown',\n    url=\"https://github.com/Qiskit/qiskit-terra\",\n    author=\"Qiskit Development Team\",\n    author_email=\"hello@qiskit.org\",\n    license=\"Apache 2.0\",\n    classifiers=[\n        \"Environment :: Console\",\n        \"License :: OSI Approved :: Apache Software License\",\n        \"Intended Audience :: Developers\",\n        \"Intended Audience :: Science/Research\",\n        \"Operating System :: Microsoft :: Windows\",\n        \"Operating System :: MacOS\",\n        \"Operating System :: POSIX :: Linux\",\n        \"Programming Language :: Python :: 3 :: Only\",\n        \"Programming Language :: Python :: 3.6\",\n        \"Programming Language :: Python :: 3.7\",\n        \"Programming Language :: Python :: 3.8\",\n        \"Programming Language :: Python :: 3.9\",\n        \"Topic :: Scientific/Engineering\",\n    ],\n    keywords=\"qiskit sdk quantum\",\n    packages=find_packages(exclude=['test*']),\n    install_requires=REQUIREMENTS,\n    setup_requires=['Cython>=0.27.1'],\n    include_package_data=True,\n    python_requires=\">=3.6\",\n    extras_require={\n        'visualization': ['matplotlib>=2.1', 'ipywidgets>=7.3.0',\n                          'pydot', \"pillow>=4.2.1\", \"pylatexenc>=1.4\",\n                          \"seaborn>=0.9.0\", \"pygments>=2.4\"],\n        'classical-function-compiler': ['tweedledum'],\n        'full-featured-simulators': ['qiskit-aer>=0.1'],\n        'crosstalk-pass': ['z3-solver>=4.7'],\n    },\n    project_urls={\n        \"Bug Tracker\": \"https://github.com/Qiskit/qiskit-terra/issues\",\n        \"Documentation\": \"https://qiskit.org/documentation/\",\n        \"Source Code\": \"https://github.com/Qiskit/qiskit-terra\",\n    },\n    ext_modules=cythonize(EXT_MODULES),\n    zip_safe=False\n)\n", "path": "setup.py"}], "after_files": [{"content": "# This code is part of Qiskit.\n#\n# (C) Copyright IBM 2017.\n#\n# This code is licensed under the Apache License, Version 2.0. You may\n# obtain a copy of this license in the LICENSE.txt file in the root directory\n# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.\n#\n# Any modifications or derivative works of this code must retain this\n# copyright notice, and modified files need to carry a notice indicating\n# that they have been altered from the originals.\n\n\"The Qiskit Terra setup file.\"\n\nimport os\nimport sys\nfrom setuptools import setup, find_packages, Extension\ntry:\n    from Cython.Build import cythonize\nexcept ImportError:\n    import subprocess\n    subprocess.call([sys.executable, '-m', 'pip', 'install', 'Cython>=0.27.1'])\n    from Cython.Build import cythonize\n\nwith open('requirements.txt') as f:\n    REQUIREMENTS = f.read().splitlines()\n\n# Add Cython extensions here\nCYTHON_EXTS = ['utils', 'swap_trial']\nCYTHON_MODULE = 'qiskit.transpiler.passes.routing.cython.stochastic_swap'\nCYTHON_SOURCE_DIR = 'qiskit/transpiler/passes/routing/cython/stochastic_swap'\n\nINCLUDE_DIRS = []\n# Extra link args\nLINK_FLAGS = []\n# If on Win and not in MSYS2 (i.e. Visual studio compile)\nif (sys.platform == 'win32' and os.environ.get('MSYSTEM') is None):\n    COMPILER_FLAGS = ['/O2']\n# Everything else\nelse:\n    COMPILER_FLAGS = ['-O2', '-funroll-loops', '-std=c++11']\n    if sys.platform == 'darwin':\n        # These are needed for compiling on OSX 10.14+\n        COMPILER_FLAGS.append('-mmacosx-version-min=10.9')\n        LINK_FLAGS.append('-mmacosx-version-min=10.9')\n\n\nEXT_MODULES = []\n# Add Cython Extensions\nfor ext in CYTHON_EXTS:\n    mod = Extension(CYTHON_MODULE + '.' + ext,\n                    sources=[CYTHON_SOURCE_DIR + '/' + ext + '.pyx'],\n                    include_dirs=INCLUDE_DIRS,\n                    extra_compile_args=COMPILER_FLAGS,\n                    extra_link_args=LINK_FLAGS,\n                    language='c++')\n    EXT_MODULES.append(mod)\n\n# Read long description from README.\nREADME_PATH = os.path.join(os.path.abspath(os.path.dirname(__file__)),\n                           'README.md')\nwith open(README_PATH) as readme_file:\n    README = readme_file.read()\n\nsetup(\n    name=\"qiskit-terra\",\n    version=\"0.17.0\",\n    description=\"Software for developing quantum computing programs\",\n    long_description=README,\n    long_description_content_type='text/markdown',\n    url=\"https://github.com/Qiskit/qiskit-terra\",\n    author=\"Qiskit Development Team\",\n    author_email=\"hello@qiskit.org\",\n    license=\"Apache 2.0\",\n    classifiers=[\n        \"Environment :: Console\",\n        \"License :: OSI Approved :: Apache Software License\",\n        \"Intended Audience :: Developers\",\n        \"Intended Audience :: Science/Research\",\n        \"Operating System :: Microsoft :: Windows\",\n        \"Operating System :: MacOS\",\n        \"Operating System :: POSIX :: Linux\",\n        \"Programming Language :: Python :: 3 :: Only\",\n        \"Programming Language :: Python :: 3.6\",\n        \"Programming Language :: Python :: 3.7\",\n        \"Programming Language :: Python :: 3.8\",\n        \"Programming Language :: Python :: 3.9\",\n        \"Topic :: Scientific/Engineering\",\n    ],\n    keywords=\"qiskit sdk quantum\",\n    packages=find_packages(exclude=['test*']),\n    install_requires=REQUIREMENTS,\n    setup_requires=['Cython>=0.27.1'],\n    include_package_data=True,\n    python_requires=\">=3.6\",\n    extras_require={\n        'visualization': ['matplotlib>=2.1', 'ipywidgets>=7.3.0',\n                          'pydot', \"pillow>=4.2.1\", \"pylatexenc>=1.4\",\n                          \"seaborn>=0.9.0\", \"pygments>=2.4\"],\n        'classical-function-compiler': ['tweedledum'],\n        'full-featured-simulators': ['qiskit-aer>=0.1'],\n        'crosstalk-pass': ['z3-solver>=4.7'],\n    },\n    project_urls={\n        \"Bug Tracker\": \"https://github.com/Qiskit/qiskit-terra/issues\",\n        \"Documentation\": \"https://qiskit.org/documentation/\",\n        \"Source Code\": \"https://github.com/Qiskit/qiskit-terra\",\n    },\n    ext_modules=cythonize(EXT_MODULES),\n    zip_safe=False\n)\n", "path": "setup.py"}]}