Lemmons/pytest-raises

Failed installation inside docker container

Closed this issue · 4 comments

I tried installing pytest-raises in a Docker container using pyton:3.6-slim with pipenv 11.10.0 and it fails with the following error.

"/usr/local/lib/python3.6/site-packages/pipenv/patched/piptools/repositories/pypi.py", l
ine 215, in get_dependencies                                                                   legacy_results = self.get_legacy_dependencies(ireq)                                   
  File "/usr/local/lib/python3.6/site-packages/pipenv/patched/piptools/repositories/pypi.py", line 263, in get_legacy_dependencies
    result = reqset._prepare_file(self.finder, ireq, ignore_requires_python=True)
  File "/usr/local/lib/python3.6/site-packages/pipenv/patched/notpip/req/req_set.py", line 
644, in _prepare_file                                                                     
    abstract_dist.prep_for_dist()
  File "/usr/local/lib/python3.6/site-packages/pipenv/patched/notpip/req/req_set.py", line 
134, in prep_for_dist
    self.req_to_install.run_egg_info()
  File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/pip9/req/req_install.py", line
 439, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/pip9/utils/__init__.py", line 
707, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pip9.exceptions.InstallationError: Command "python setup.py egg_info" failed with error cod
e 1 in /tmp/tmpe2ndssgzbuild/pytest-raises/

I created a minimal Dockerfile for you to try out:

FROM python:3.6-slim

ENV PYTHONUNBUFFERED=1

WORKDIR /root

RUN set -ex \
    && ln -sf /usr/local/bin/python /bin/python \
    && pip install --upgrade pip setuptools wheel pipenv==11.10.0

RUN pipenv install pytest-raises

where I get a different error:

Downloading https://files.pythonhosted.org/packages/05/ce/e77800866e07239135b022f433ff40dce5671b8a62dcaffcb8d74e0c2ec5/pytest-raises-0.7.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-if_pc81z/pytest-raises/setup.py", line 122, in <module>
        main()
      File "/tmp/pip-install-if_pc81z/pytest-raises/setup.py", line 93, in main
        version             = get_version(),
      File "/tmp/pip-install-if_pc81z/pytest-raises/setup.py", line 75, in get_version
        git_version = _get_version_from_git()
      File "/tmp/pip-install-if_pc81z/pytest-raises/setup.py", line 39, in _get_version_from_git
        git_description = _get_git_description()
      File "/tmp/pip-install-if_pc81z/pytest-raises/setup.py", line 20, in _get_git_description
        return _get_output_or_none(['git', 'describe'])
      File "/tmp/pip-install-if_pc81z/pytest-raises/setup.py", line 15, in _get_output_or_none
        return subprocess.check_output(args).decode('utf-8').strip()
      File "/usr/local/lib/python3.6/subprocess.py", line 336, in check_output
        **kwargs).stdout
      File "/usr/local/lib/python3.6/subprocess.py", line 403, in run
        with Popen(*popenargs, **kwargs) as process:
      File "/usr/local/lib/python3.6/subprocess.py", line 709, in __init__
        restore_signals, start_new_session)
      File "/usr/local/lib/python3.6/subprocess.py", line 1344, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: 'git': 'git'

Then I tried with plain pip

RUN pip install pytest-raises

and I get the same error.

The last line of the traceback says it all: FileNotFoundError: [Errno 2] No such file or directory: 'git': 'git'

You need to install git

That being said, I'll look into making git a soft requirement instead of a hard one.

Fixed in #10

Cool, thank you. I guess, I didn't understand why pytest-raises would need git.