55

I'm trying to install the mitmproxy package via pip like this:

$ sudo pip install mitmproxy

It terminates with following error message:

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c build/temp.linux-x86_64-2.7/_openssl.c -o build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7/_openssl.o

build/temp.linux-x86_64-2.7/_openssl.c:391:30: fatal error: openssl/opensslv.h: No such file or directory

compilation terminated.

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
  Can't roll back cryptography; was not uninstalled
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-jvLTVf/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-DrY4DI-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-build-jvLTVf/cryptography
Storing debug log for failure in /home/niklas/.pip/pip.log

After this it's somewhat installed, at least I can uninstall it afterwards.

 $ mitmproxy

leads to

Traceback (most recent call last):
  File "/usr/local/bin/mitmproxy", line 7, in <module>
    from mitmproxy.main import mitmproxy
  File "/usr/local/lib/python2.7/dist-packages/mitmproxy/main.py", line 7, in <module>
    from . import version, cmdline
  File "/usr/local/lib/python2.7/dist-packages/mitmproxy/cmdline.py", line 6, in <module>
    import configargparse
ImportError: No module named configargparse
1

3 Answers 3

82

The other answers only address the dependencies to make the errors you mentioned go away. The list of all dependencies needed is actually much longer.

You can install them all with:

sudo apt-get install python-pip python-dev libffi-dev libssl-dev libxml2-dev libxslt1-dev libjpeg8-dev zlib1g-dev

Then you can install mitmproxy:

sudo pip install mitmproxy

And run it:

mitmproxy

Source: the documentation

2
  • 1
    worked, but somehow killed pip. Had to reinstall it. Now everything works. :)
    – Niklas
    Jul 11, 2016 at 12:34
  • 1
    @Niklas I'm glad to hear that it solved your issue. Have a great day!
    – grooveplex
    Jul 11, 2016 at 12:36
71
»» fatal error: openssl/opensslv.h: No such file or directory ««

Install openssl : sudo apt-get update && sudo apt-get install libssl-dev

9
  • I did receive the same error during the setup of pyOpenSSL in Ubuntu 16.04 (inside a python virtualenv). This answer solved my problem. Thanks
    – yucer
    Sep 14, 2016 at 12:53
  • fixed issue when installing "pip install fabric" on Ubuntu server (stretch/sid or Ubuntu 16.04.1 LTS).
    – Sergei G
    Mar 15, 2017 at 22:21
  • 1
    This is the simple clean answer for anything that relies on pypi.python.org/pypi/cryptography/1.8.1 for instance pypi.python.org/pypi/paramiko/2.1.2 Mar 16, 2017 at 0:39
  • 1
    Saved the error while installing hashpumpy. May 29, 2018 at 20:28
  • I had a similar issue trying to install keyring on alpine, but got ERROR: unsatisfiable constraints when trying to install libssl-dev. Was able to solve it by installing openssl-dev instead.
    – cowlinator
    Jan 11, 2019 at 1:58
4

There's actually two different issues here in your output (assuming all other dependency issues are resolved already). Both need fixed.

Missing SSL Libraries

  1. As was stated by Knud Larsen in their answer to this question, you are missing the OpenSSL libraries. Refer to their answer on this question for that issue.

Missing Python Modules

  1. There is a python script that is part of whatever you're running, and it is missing a module (called configargparse) which it needs to run.

    If you are on Ubuntu 15.10 or newer, you can install it by doing sudo apt-get install python-configargparse.

    If you are on any version of Ubuntu before 15.10 you will need to install it via pip to download it and make it available to the system: sudo pip install configargparse

    (Note that python pip install mitmproxy will achieve the same type of dependency resolutions once you fix the missing SSL libraries issue, however if it does not for some reason you'll have to manually install that module)

NOTE: Your question states that you are using Ubuntu MATE 15.10. Ubuntu 15.10 for all variants has gone EndOfLife on July 28, 2016. You should consider upgrading to 16.04, in order to receive continued Ubuntu support and updates.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .