Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#26952 closed Cleanup/optimization (fixed)

Mention the need to install libffi-dev prior to installing packages for tests

Reported by: Ed Morley Owned by: Damian
Component: Documentation Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

The contributing guide explains how to install the Python packages required to run the tests in a couple of places:
https://docs.djangoproject.com/en/dev/intro/contributing/#running-django-s-test-suite-for-the-first-time
https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#running-all-the-tests

However the pip install tests/requirements/py*.txt will fail during the installation of argon2-cffi unless libffi-dev is installed, with a delightful error like:

$ pip install -r requirements/py2.txt
Collecting argon2-cffi>=16.1.0 (from -r requirements/base.txt (line 1))
  Downloading argon2_cffi-16.1.0.tar.gz (1.2MB)
    100% |################################| 1.2MB 1.1MB/s
    Complete output from command python setup.py egg_info:
    c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
    compilation terminated.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-PCA0QU/argon2-cffi/setup.py", line 160, in <module>
        extras_require=EXTRAS_REQUIRE,
      File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
        _setup_distribution = dist = klass(attrs)
      File "/home/vagrant/.virtualenvs/django/local/lib/python2.7/site-packages/setuptools/dist.py", line 348, in __init__
        self.fetch_build_eggs(attrs['setup_requires'])
      File "/home/vagrant/.virtualenvs/django/local/lib/python2.7/site-packages/setuptools/dist.py", line 394, in fetch_build_eggs
        replace_conflicting=True,
      File "/home/vagrant/.virtualenvs/django/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 826, in resolve
        dist = best[req.key] = env.best_match(req, ws, installer)
      File "/home/vagrant/.virtualenvs/django/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1092, in best_match
        return self.obtain(req, installer)
      File "/home/vagrant/.virtualenvs/django/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1104, in obtain
        return installer(requirement)
      File "/home/vagrant/.virtualenvs/django/local/lib/python2.7/site-packages/setuptools/dist.py", line 461, in fetch_build_egg
        return cmd.easy_install(req)
      File "/home/vagrant/.virtualenvs/django/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 664, in easy_install
        return self.install_item(spec, dist.location, tmpdir, deps)
      File "/home/vagrant/.virtualenvs/django/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 694, in install_item
        dists = self.install_eggs(spec, download, tmpdir)
      File "/home/vagrant/.virtualenvs/django/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 875, in install_eggs
        return self.build_and_install(setup_script, setup_base)
      File "/home/vagrant/.virtualenvs/django/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1114, in build_and_install
        self.run_setup(setup_script, setup_base, args)
      File "/home/vagrant/.virtualenvs/django/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1102, in run_setup
        raise DistutilsError("Setup script exited with %s" % (v.args[0],))
    distutils.errors.DistutilsError: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-PCA0QU/argon2-cffi/

Many people will know immediately what the issue is (or one would hope after Googling), however it would probably be good to state the requirement explicitly and also mention in the troubleshooting section :-)

Change History (7)

comment:1 by Tim Graham, 8 years ago

Triage Stage: UnreviewedAccepted
Type: BugCleanup/optimization

There is also libjpeg-dev and zlib1g-dev for Pillow. Hopefully we can link to instructions in the docs for argon2-cffi and Pillow rather than writing our own instructions.

comment:2 by Damian, 8 years ago

Owner: changed from nobody to Damian
Status: newassigned

Hello There,
I would like to assign this ticket to myself as my first contribution.

in reply to:  1 comment:3 by Damian, 8 years ago

Replying to timgraham:

There is also libjpeg-dev and zlib1g-dev for Pillow. Hopefully we can link to instructions in the docs for argon2-cffi and Pillow rather than writing our own instructions.

I just wanted to ask if linking the docs to the instructions pages of these libraries is all that you want me to do? Or should I create some text in the troubleshooting section regarding that problem, as edmorley suggested in the ticket description?

comment:4 by Tim Graham, 8 years ago

Please do whatever you think will be most helpful.

comment:5 by Damian, 8 years ago

I have created a new pull request at https://github.com/django/django/pull/6991.

I have created new Unit Testing section under the Troubleshooting page, with subsection regarding in general the problem of missing libraries for the dependencies - based on the ticket description problem. Moreover I have linked appropriate pages to that section, which were also mentioned in the ticket description. One last thing I have changed were url addresses (for the dependencies mentioned in the ticket description as well as in comments). I made them point to the dependencies' documentation rather than writing new instructions as suggested in the comment section of this ticket.

comment:6 by Tim Graham <timograham@…>, 8 years ago

Resolution: fixed
Status: assignedclosed

In 2b759c94:

Fixed #26952 -- Added tips for installing test suite dependencies.

comment:7 by Tim Graham <timograham@…>, 8 years ago

In 7c04223:

[1.10.x] Fixed #26952 -- Added tips for installing test suite dependencies.

Backport of 2b759c94c562c9ee9b6ca970739be15014050fda from master

Note: See TracTickets for help on using tickets.
Back to Top