Repository: deepset-ai/haystack

Issue:
Requirements.txt mssing so cannot run docker-compose build
**requirements.txt is missing**
I did docker-compose up but then I have changed some code and I run docker-compose build and it gives 


<img width="927" alt="Screen Shot 2022-01-30 at 16 14 47" src="https://user-images.githubusercontent.com/12005291/151705549-75901c0a-d235-445f-b7f9-7e75625ce4c3.png">

Because there is no requirements.txt file. I do not understand how it works the first time when I run docker-compose up but it crashes how can I fix this?



Discussion:
Hi @arater you're right that there is a problem when the ui docker image is built. It's because one of our most recent PRs #1994 deleted the `requirements.txt` file that would be copied here and changed the dependency management. I'll need to make some changes to https://github.com/deepset-ai/haystack/blob/master/ui/Dockerfile and will let you know once it is fixed. 
@arater as a quick fix you can add the following file to your folder `haystack/ui/`: https://github.com/deepset-ai/haystack/blob/4cc37548e3bedbb375ab0cb76aa1c80ee5a5430f/ui/requirements.txt
@ZanSara did we want to reorganize the dependency management for the UI as well or could we just re-add the `requirements.txt` in `haystack/ui` to solve this problem?
Thanks for quick solution
Hello @arater, I'll implement a fix today and let you know once it's done. I'm going to modify the UI's Dockerfile not to look for a `requirements.txt` (after the dependency management refactoring it's no more needed).

Resolving patch:
diff --git a/rest_api/setup.py b/rest_api/setup.py
new file mode 100644
--- /dev/null
+++ b/rest_api/setup.py
@@ -0,0 +1,44 @@
+from setuptools import setup, find_packages
+import logging
+from pathlib import Path
+
+
+VERSION = None
+try:
+    VERSION = open(Path(__file__).parent.parent/'VERSION.txt', "r").read()
+except Exception as e:
+    logging.exception("No VERSION.txt found!", e)
+
+
+setup(
+    name="farm-haystack-rest-api",
+    version=VERSION,
+    description='Demo REST API server for Haystack (https://github.com/deepset-ai/haystack)',
+    author='deepset.ai',
+    author_email='malte.pietsch@deepset.ai',
+    url=' https://github.com/deepset-ai/haystack/tree/master/rest_api',
+    classifiers=[
+        "Development Status :: 5 - Production/Stable",
+        "Intended Audience :: Science/Research",
+        "Topic :: Scientific/Engineering :: Artificial Intelligence",
+        "Operating System :: OS Independent",
+        "Programming Language :: Python",
+        "Programming Language :: Python :: 3",
+        "Programming Language :: Python :: 3.7",
+        "Programming Language :: Python :: 3.8",
+        "Programming Language :: Python :: 3.9",
+        "Programming Language :: Python :: 3.10",
+    ],
+    packages=find_packages(),
+    python_requires='>=3.7, <4',
+    install_requires=[
+        # The link below cannot be translated properly into setup.cfg
+        # because it looks into the parent folder.
+        # TODO check if this is still a limitation later on
+        f"farm-haystack @ file://localhost/{Path(__file__).parent.parent}#egg=farm-haystack",
+        "fastapi<1",
+        "uvicorn<1",
+        "gunicorn<21",
+        "python-multipart<1"  # optional FastAPI dependency for form data
+    ],  
+)
diff --git a/ui/setup.py b/ui/setup.py
new file mode 100644
--- /dev/null
+++ b/ui/setup.py
@@ -0,0 +1,43 @@
+from setuptools import setup, find_packages
+import logging
+from pathlib import Path
+
+
+VERSION = None
+try:
+    # After git clone, VERSION.txt is in the root folder
+    VERSION = open(Path(__file__).parent.parent/'VERSION.txt', "r").read()
+except Exception:
+    try:
+        # In Docker, VERSION.txt is in the same folder
+        VERSION = open(Path(__file__).parent/'VERSION.txt', "r").read()
+    except Exception as e:
+        logging.exception("No VERSION.txt found!", e)
+
+setup(
+    name="farm-haystack-ui",
+    version=VERSION,
+    description='Demo UI for Haystack (https://github.com/deepset-ai/haystack)',
+    author='deepset.ai',
+    author_email='malte.pietsch@deepset.ai',
+    url=' https://github.com/deepset-ai/haystack/tree/master/ui',
+    classifiers=[
+        "Development Status :: 5 - Production/Stable",
+        "Intended Audience :: Science/Research",
+        "Topic :: Scientific/Engineering :: Artificial Intelligence",
+        "Operating System :: OS Independent",
+        "Programming Language :: Python",
+        "Programming Language :: Python :: 3",
+        "Programming Language :: Python :: 3.7",
+        "Programming Language :: Python :: 3.8",
+        "Programming Language :: Python :: 3.9",
+        "Programming Language :: Python :: 3.10",
+    ],
+    packages=find_packages(),
+    python_requires='>=3.7, <4',
+    install_requires=[
+        'streamlit>=1.2.0, <2', 
+        'st-annotated-text>=2.0.0, <3', 
+        'markdown>=3.3.4, <4'
+    ]
+)


Test patch: