Milkshak3s/CSEC-380-G5

Remove hashlib from backend/requirements.txt

Closed this issue · 0 comments

Problem
While freshly git cloning the repository and performing docker-compose build, the following error occurred.

Error message

  Downloading https://files.pythonhosted.org/packages/74/bb/9003d081345e9f0451884146e9ea2cff6e4cc4deac9ffd4a9ee98b318a49/hashlib-20081119.zip (42kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ckns0mu7/hashlib/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ckns0mu7/hashlib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
         cwd: /tmp/pip-install-ckns0mu7/hashlib/
    Complete output (22 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/local/lib/python3.7/site-packages/setuptools/__init__.py", line 18, in <module>
        import setuptools.version
      File "/usr/local/lib/python3.7/site-packages/setuptools/version.py", line 1, in <module>
        import pkg_resources
      File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 36, in <module>
        import email.parser
      File "/usr/local/lib/python3.7/email/parser.py", line 12, in <module>
        from email.feedparser import FeedParser, BytesFeedParser
      File "/usr/local/lib/python3.7/email/feedparser.py", line 27, in <module>
        from email._policybase import compat32
      File "/usr/local/lib/python3.7/email/_policybase.py", line 9, in <module>
        from email.utils import _has_surrogates
      File "/usr/local/lib/python3.7/email/utils.py", line 28, in <module>
        import random
      File "/usr/local/lib/python3.7/random.py", line 46, in <module>
        from hashlib import sha512 as _sha512
      File "/tmp/pip-install-ckns0mu7/hashlib/hashlib.py", line 80
        raise ValueError, "unsupported hash type"
                        ^
    SyntaxError: invalid syntax
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
ERROR: Service 'backend' failed to build: The command '/bin/sh -c pip3 install -r requirements.txt' returned a non-zero code: 1

Reason
This is because pip is trying to install hashlib module. Hashlib module is default in python3, so there is no need.

Solution
Removing hashlib from the /backend/requirements.txt have solved the issue, and the docker-compose build and docker-compose up was successful.