1
votes

Steps I've tried so far:

  1. create the virtual environment.

    python3.4 -m venv [venv_name_here]

  2. enter the virtual environment.

    cd [venv_name_here]

  3. activate the virtual environment.

    source bin/activate

  4. install setuptools.

    pip install --upgrade setuptools

  5. install pyparser.

    pip install --upgrade pyparser

Output:

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..
  1. install cffi.

    pip install --upgrade cffi

Output:

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...
  1. install cryptography.

    pip install --upgrade cryptography

Output:

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>=2.1 (from cryptography)
  Downloading idna-2.6-py2.py3-none-any.whl (56kB): 56kB downloaded
Downloading/unpacking asn1crypto>=0.21.0 (from cryptography)
  Downloading asn1crypto-0.24.0-py2.py3-none-any.whl (101kB): 101kB downloaded
Downloading/unpacking six>=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 "<string>", line 1, in <module>
      File "[path-to-venv]/build/cryptography/setup.py", line 319, in <module>
        **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 <module>
        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 "<string>", line 1, in <module>

  File "[path-to-venv]/build/cryptography/setup.py", line 319, in <module>
    **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 <module>
    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

What's malfunctioning here and how to fix it?

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.

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.

1
cryptography usually requires some root level access to certain tools; if you don't have that, try pip install --upgrade --user cryptography and see if that works.Danielle M.
What platform is this? If Mac OS X, you need to use homebrew to install libffi. See cffi.readthedocs.io/en/latest/installation.html#macos-x. You'll certainly need OpenSSL via brew.Martijn Pieters♦
@DanielleM.: I never needed to do that, certainly not in a virtualenv.Martijn Pieters♦
Yeah it was the permissions error that made me just want to see if output differed. Prob a waste of time in this case tho.Danielle M.
@DanielleM.: it is absolutely a waste of time. The issue is not even with cryptography here.Martijn Pieters♦

1 Answers

1
votes

for me using virtualenv solved the problem create virtual environment by python3 -m virtualenv venv then install cryptography pip install cryptography