title: How to install cryptography in Python virtual environment? [ undefined symbol: __syscall_error]
body: <p>Steps I've tried so far:</p>
  
  <ol>
  <li><p>create the virtual environment.</p>
  
  <p>python3.4 -m venv [venv_name_here]</p></li>
  <li><p>enter the virtual environment.</p>
  
  <p>cd [venv_name_here]</p></li>
  <li><p>activate the virtual environment.</p>
  
  <p>source bin/activate</p></li>
  <li><p>install setuptools.</p>
  
  <p>pip install --upgrade setuptools</p></li>
  <li><p>install pyparser.</p>
  
  <p>pip install --upgrade pyparser</p></li>
  </ol>
  
  <p>Output:</p>
  
  <pre><code>Downloading/unpacking pyparser
    Downloading pyparser-1.0.tar.gz
    Running setup.py (path:[path-to-venv]/build/pyparser/setup.py) egg_info for package pyparser
  Downloading/unpacking parse==1.6.5 (from pyparser)
    Downloading parse-1.6.5.tar.gz
    Running setup.py (path:[path-to-venv]/build/parse/setup.py) egg_info for package parse
  Installing collected packages: pyparser, parse
    Running setup.py install for pyparser
    Could not find .egg-info directory in install record for pyparser
    Running setup.py install for parse
    Could not find .egg-info directory in install record for parse==1.6.5 (from pyparser)
  Successfully installed pyparser parse
  Cleaning up..
  </code></pre>
  
  <ol start="6">
  <li><p>install cffi.</p>
  
  <p>pip install --upgrade cffi</p></li>
  </ol>
  
  <p>Output:</p>
  
  <pre><code>Downloading/unpacking cffi
    Downloading cffi-1.11.5.tar.gz (438kB): 438kB downloaded
    Running setup.py (path:[path-to-venv]/build/cffi/setup.py) egg_info for package cffi
  Downloading/unpacking pycparser (from cffi)
    Downloading pycparser-2.18.tar.gz (245kB): 245kB downloaded
    Running setup.py (path:[path-to-venv]/build/pycparser/setup.py) egg_info for package pycparser
      warning: no previously-included files matching 'yacctab.*' found under directory 'tests'
      warning: no previously-included files matching 'lextab.*' found under directory 'tests'
      warning: no previously-included files matching 'yacctab.*' found under directory 'examples'
      warning: no previously-included files matching 'lextab.*' found under directory 'examples'
  Installing collected packages: cffi, pycparser
    Running setup.py install for cffi
      building '_cffi_backend' extension
      gcc -pthread -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/local/lib/libffi-3.1/include -I[path-to-venv]/include -I/usr/local/include/python3.4m -c c/_cffi_backend.c -o build/temp.linux-i686-3.4/c/_cffi_backend.o
      gcc -pthread -shared build/temp.linux-i686-3.4/c/_cffi_backend.o -L$(libdir) -lffi -o build/lib.linux-i686-3.4/_cffi_backend.cpython-34m.so
    Could not find .egg-info directory in install record for cffi
    Running setup.py install for pycparser
      warning: no previously-included files matching 'yacctab.*' found under directory 'tests'
      warning: no previously-included files matching 'lextab.*' found under directory 'tests'
      warning: no previously-included files matching 'yacctab.*' found under directory 'examples'
      warning: no previously-included files matching 'lextab.*' found under directory 'examples'
      Build the lexing/parsing tables
    Could not find .egg-info directory in install record for pycparser (from cffi)
  Successfully installed cffi pycparser
  Cleaning up...
  </code></pre>
  
  <ol start="7">
  <li><p>install cryptography.</p>
  
  <p>pip install --upgrade cryptography</p></li>
  </ol>
  
  <p>Output:</p>
  
  <pre><code>Downloading/unpacking cryptography
    Downloading cryptography-2.2.2.tar.gz (443kB): 443kB downloaded
    Running setup.py (path:[path-to-venv]/build/cryptography/setup.py) egg_info for package cryptography
      no previously-included directories found matching 'docs/_build'
      warning: no previously-included files matching '*' found under directory 'vectors'
  Downloading/unpacking idna&gt;=2.1 (from cryptography)
    Downloading idna-2.6-py2.py3-none-any.whl (56kB): 56kB downloaded
  Downloading/unpacking asn1crypto&gt;=0.21.0 (from cryptography)
    Downloading asn1crypto-0.24.0-py2.py3-none-any.whl (101kB): 101kB downloaded
  Downloading/unpacking six&gt;=1.4.1 (from cryptography)
    Downloading six-1.11.0-py2.py3-none-any.whl
  Installing collected packages: cryptography, idna, asn1crypto, six
    Running setup.py install for cryptography
      Traceback (most recent call last):
        File "&lt;string&gt;", line 1, in &lt;module&gt;
        File "[path-to-venv]/build/cryptography/setup.py", line 319, in &lt;module&gt;
          **keywords_with_side_effects(sys.argv)
        File "[path-to-venv]/lib/python3.4/site-packages/setuptools/__init__.py", line 129, in setup
          return distutils.core.setup(**attrs)
        File "/usr/local/lib/python3.4/distutils/core.py", line 108, in setup
          _setup_distribution = dist = klass(attrs)
        File "[path-to-venv]/lib/python3.4/site-packages/setuptools/dist.py", line 363, in __init__
          _Distribution.__init__(self, attrs)
        File "/usr/local/lib/python3.4/distutils/dist.py", line 280, in __init__
          self.finalize_options()
        File "[path-to-venv]/lib/python3.4/site-packages/setuptools/dist.py", line 519, in finalize_options
          ep.load()(self, ep.name, value)
        File "[path-to-venv]/lib/python3.4/site-packages/cffi/setuptools_ext.py", line 204, in cffi_modules
          add_cffi_module(dist, cffi_module)
        File "[path-to-venv]/lib/python3.4/site-packages/cffi/setuptools_ext.py", line 49, in add_cffi_module
          execfile(build_file_name, mod_vars)
        File "[path-to-venv]/lib/python3.4/site-packages/cffi/setuptools_ext.py", line 25, in execfile
          exec(code, glob, glob)
        File "src/_cffi_src/build_openssl.py", line 106, in &lt;module&gt;
          extra_link_args=extra_link_args(compiler_type()),
        File "[path-to-venv]/build/cryptography/src/_cffi_src/utils.py", line 49, in build_ffi_for_binding
          extra_link_args=extra_link_args,
        File "[path-to-venv]/build/cryptography/src/_cffi_src/utils.py", line 57, in build_ffi
          ffi = FFI()
        File "[path-to-venv]/lib/python3.4/site-packages/cffi/api.py", line 46, in __init__
          import _cffi_backend as backend
      ImportError: [path-to-venv]/lib/python3.4/site-packages/_cffi_backend.cpython-34m.so: undefined symbol: __syscall_error
      Complete output from command [path-to-venv]/bin/python3.4 -c "import setuptools, tokenize;__file__='[path-to-venv]/build/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-pm4i20dg-record/install-record.txt --single-version-externally-managed --compile --install-headers [path-to-venv]/include/site/python3.4:
      Traceback (most recent call last):
  
    File "&lt;string&gt;", line 1, in &lt;module&gt;
  
    File "[path-to-venv]/build/cryptography/setup.py", line 319, in &lt;module&gt;
      **keywords_with_side_effects(sys.argv)
  
    File "[path-to-venv]/lib/python3.4/site-packages/setuptools/__init__.py", line 129, in setup
      return distutils.core.setup(**attrs)
  
    File "/usr/local/lib/python3.4/distutils/core.py", line 108, in setup
      _setup_distribution = dist = klass(attrs)
  
    File "[path-to-venv]/lib/python3.4/site-packages/setuptools/dist.py", line 363, in __init__
      _Distribution.__init__(self, attrs)
  
    File "/usr/local/lib/python3.4/distutils/dist.py", line 280, in __init__
      self.finalize_options()
  
    File "[path-to-venv]/lib/python3.4/site-packages/setuptools/dist.py", line 519, in finalize_options
      ep.load()(self, ep.name, value)
  
    File "[path-to-venv]/lib/python3.4/site-packages/cffi/setuptools_ext.py", line 204, in cffi_modules
      add_cffi_module(dist, cffi_module)
  
    File "[path-to-venv]/lib/python3.4/site-packages/cffi/setuptools_ext.py", line 49, in add_cffi_module
      execfile(build_file_name, mod_vars)
  
    File "[path-to-venv]/lib/python3.4/site-packages/cffi/setuptools_ext.py", line 25, in execfile
      exec(code, glob, glob)
  
    File "src/_cffi_src/build_openssl.py", line 106, in &lt;module&gt;
      extra_link_args=extra_link_args(compiler_type()),
  
    File "[path-to-venv]/build/cryptography/src/_cffi_src/utils.py", line 49, in build_ffi_for_binding
      extra_link_args=extra_link_args,
  
    File "[path-to-venv]/build/cryptography/src/_cffi_src/utils.py", line 57, in build_ffi
      ffi = FFI()
  
    File "[path-to-venv]/lib/python3.4/site-packages/cffi/api.py", line 46, in __init__
      import _cffi_backend as backend
  
  ImportError: [path-to-venv]/lib/python3.4/site-packages/_cffi_backend.cpython-34m.so: undefined symbol: __syscall_error
  
  ----------------------------------------
  Cleaning up...
  Command [path-to-venv]/bin/python3.4 -c "import setuptools, tokenize;__file__='[path-to-venv]/build/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-pm4i20dg-record/install-record.txt --single-version-externally-managed --compile --install-headers [path-to-venv]/include/site/python3.4 failed with error code 1 in [path-to-venv]/build/cryptography
  Storing debug log for failure in /home/webdev/.pip/pip.log
  </code></pre>
  
  <hr>
  
  <p>What's malfunctioning here and how to fix it?</p>
  
  <p>Installing cryptography seems like a relatively straightforward thing to do with a virtual environment, but it's not working and I don't see any references to problems like this one anywhere online.</p>
  
  <p>Update: the operating system type is Linux, and installation of cryptography works fine on the system itself. This problem only appears when attempting to install into a virtual environment.</p>