PIP और setup.py के साथ पायथन क्रिप्टोग्राफ़ी पैकेज स्थापित करने में विफल


256

जब मैं पायथन के लिए क्रिप्टोग्राफी पैकेज को pip install cryptographyया तो अपनी साइट से पैकेज डाउनलोड करके और चलाने की python setup.pyकोशिश करता हूं, तो मुझे निम्नलिखित त्रुटि मिलती है:


D:\Anaconda\Scripts\pip-script.py run on 02/27/14 16:13:17
Downloading/unpacking cryptography
  Getting page https://pypi.python.org/simple/cryptography/
  URLs to search for versions for cryptography:
  * https://pypi.python.org/simple/cryptography/
  Analyzing links from page https://pypi.python.org/simple/cryptography/
    Skipping https://pypi.python.org/packages/cp26/c/cryptography/cryptography-0.2-cp26-none-win32.whl#md5=13e5c4b19520e7dc6f07c6502b3f74e2 (from https://pypi.python.org/simple/cryptography/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/cp26/c/cryptography/cryptography-0.2.1-cp26-none-win32.whl#md5=00e733648ee5cdb9e58876238b1328f8 (from https://pypi.python.org/simple/cryptography/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/cp27/c/cryptography/cryptography-0.2-cp27-none-win32.whl#md5=013ccafa6a5a3ea92c73f2c1c4879406 (from https://pypi.python.org/simple/cryptography/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/cp27/c/cryptography/cryptography-0.2.1-cp27-none-win32.whl#md5=127d6a5dc687250721f892d55720a06c (from https://pypi.python.org/simple/cryptography/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/cp32/c/cryptography/cryptography-0.2-cp32-none-win32.whl#md5=051424a36e91039807b72f112333ded3 (from https://pypi.python.org/simple/cryptography/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/cp32/c/cryptography/cryptography-0.2.1-cp32-none-win32.whl#md5=53f6f57db8e952d64283baaa14cbde3d (from https://pypi.python.org/simple/cryptography/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/cp33/c/cryptography/cryptography-0.2-cp33-none-win32.whl#md5=302812c1c1a035cf9ba3292f8dbf3f9e (from https://pypi.python.org/simple/cryptography/) because it is not compatible with this Python
    Skipping https://pypi.python.org/packages/cp33/c/cryptography/cryptography-0.2.1-cp33-none-win32.whl#md5=81acca90caf8a45f2ca73f3f9859fae4 (from https://pypi.python.org/simple/cryptography/) because it is not compatible with this Python
    Found link https://pypi.python.org/packages/source/c/cryptography/cryptography-0.1.tar.gz#md5=bdc1c5fe069deca7467b71a0cc538f17 (from https://pypi.python.org/simple/cryptography/), version: 0.1
    Found link https://pypi.python.org/packages/source/c/cryptography/cryptography-0.2.1.tar.gz#md5=872fc04268dadc66a0305ae5ab1c123b (from https://pypi.python.org/simple/cryptography/), version: 0.2.1
    Found link https://pypi.python.org/packages/source/c/cryptography/cryptography-0.2.tar.gz#md5=8a3d21e837a21e1b7634ee1f22b06bb6 (from https://pypi.python.org/simple/cryptography/), version: 0.2
  Using version 0.2.1 (newest of versions: 0.2.1, 0.2, 0.1)
  Downloading from URL https://pypi.python.org/packages/source/c/cryptography/cryptography-0.2.1.tar.gz#md5=872fc04268dadc66a0305ae5ab1c123b (from https://pypi.python.org/simple/cryptography/)
  Running setup.py (path:c:\users\paco\appdata\local\temp\pip_build_Paco\cryptography\setup.py) egg_info for package cryptography
    In file included from c/_cffi_backend.c:7:0:
    c/misc_win32.h:225:23: error: two or more data types in declaration specifiers
    c/misc_win32.h:225:1: warning: useless type name in empty declaration [enabled by default]
    c/_cffi_backend.c: In function 'convert_array_from_object':
    c/_cffi_backend.c:1105:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1105:26: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c:1130:30: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1130:30: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c:1150:30: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1150:30: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function 'convert_struct_from_object':
    c/_cffi_backend.c:1183:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1183:26: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c:1196:30: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1196:30: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function 'cdata_repr':
    c/_cffi_backend.c:1583:13: warning: unknown conversion type character 'L' in format [-Wformat]
    c/_cffi_backend.c:1583:13: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c:1595:9: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1595:9: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function 'cdataowning_repr':
    c/_cffi_backend.c:1647:30: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1647:30: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function '_cdata_get_indexed_ptr':
    c/_cffi_backend.c:1820:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1820:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1820:26: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function '_cdata_getslicearg':
    c/_cffi_backend.c:1872:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1872:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1872:26: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function 'cdata_ass_slice':
    c/_cffi_backend.c:1951:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1951:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1951:26: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c:1969:30: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1969:30: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1969:30: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c:1983:22: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:1983:22: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function 'cdata_call':
    c/_cffi_backend.c:2367:30: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:2367:30: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'Py_ssize_t' [-Wformat]
    c/_cffi_backend.c:2367:30: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function 'cast_to_integer_or_char':
    c/_cffi_backend.c:2916:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:2916:26: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'Py_ssize_t' [-Wformat]
    c/_cffi_backend.c:2916:26: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c:2928:26: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:2928:26: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'Py_ssize_t' [-Wformat]
    c/_cffi_backend.c:2928:26: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function 'new_array_type':
    c/_cffi_backend.c:3480:9: warning: unknown conversion type character 'l' in format [-Wformat]
    c/_cffi_backend.c:3480:9: warning: too many arguments for format [-Wformat-extra-args]
    c/_cffi_backend.c: In function 'b_complete_struct_or_union':
    c/_cffi_backend.c:3878:22: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:3878:22: warning: unknown conversion type character 'z' in format [-Wformat]
    c/_cffi_backend.c:3878:22: warning: too many arguments for format [-Wformat-extra-args]
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "c:\users\paco\appdata\local\temp\pip_build_Paco\cryptography\setup.py", line 113, in <module>
        "build": cffi_build,
      File "D:\Anaconda\lib\distutils\core.py", line 112, in setup
        _setup_distribution = dist = klass(attrs)
      File "build\bdist.win-amd64\egg\setuptools\dist.py", line 239, in __init__
      File "build\bdist.win-amd64\egg\setuptools\dist.py", line 264, in fetch_build_eggs
      File "build\bdist.win-amd64\egg\pkg_resources.py", line 580, in resolve
        dist = best[req.key] = env.best_match(req, ws, installer)
      File "build\bdist.win-amd64\egg\pkg_resources.py", line 818, in best_match
        return self.obtain(req, installer) # try and download/install
      File "build\bdist.win-amd64\egg\pkg_resources.py", line 830, in obtain
        return installer(requirement)
      File "build\bdist.win-amd64\egg\setuptools\dist.py", line 314, in fetch_build_egg
      File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 593, in easy_install

      File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 623, in install_item

      File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 809, in install_eggs

      File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 1015, in build_and_install

      File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 1003, in run_setup

    distutils.errors.DistutilsError: Setup script exited with error: command 'gcc' failed with exit status 1
    Complete output from command python setup.py egg_info:
    In file included from c/_cffi_backend.c:7:0:

c/misc_win32.h:225:23: error: two or more data types in declaration specifiers

c/misc_win32.h:225:1: warning: useless type name in empty declaration [enabled by default]

c/_cffi_backend.c: In function 'convert_array_from_object':

c/_cffi_backend.c:1105:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1105:26: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c:1130:30: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1130:30: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c:1150:30: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1150:30: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function 'convert_struct_from_object':

c/_cffi_backend.c:1183:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1183:26: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c:1196:30: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1196:30: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function 'cdata_repr':

c/_cffi_backend.c:1583:13: warning: unknown conversion type character 'L' in format [-Wformat]

c/_cffi_backend.c:1583:13: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c:1595:9: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1595:9: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function 'cdataowning_repr':

c/_cffi_backend.c:1647:30: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1647:30: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function '_cdata_get_indexed_ptr':

c/_cffi_backend.c:1820:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1820:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1820:26: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function '_cdata_getslicearg':

c/_cffi_backend.c:1872:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1872:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1872:26: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function 'cdata_ass_slice':

c/_cffi_backend.c:1951:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1951:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1951:26: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c:1969:30: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1969:30: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1969:30: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c:1983:22: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:1983:22: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function 'cdata_call':

c/_cffi_backend.c:2367:30: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:2367:30: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'Py_ssize_t' [-Wformat]

c/_cffi_backend.c:2367:30: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function 'cast_to_integer_or_char':

c/_cffi_backend.c:2916:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:2916:26: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'Py_ssize_t' [-Wformat]

c/_cffi_backend.c:2916:26: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c:2928:26: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:2928:26: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'Py_ssize_t' [-Wformat]

c/_cffi_backend.c:2928:26: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function 'new_array_type':

c/_cffi_backend.c:3480:9: warning: unknown conversion type character 'l' in format [-Wformat]

c/_cffi_backend.c:3480:9: warning: too many arguments for format [-Wformat-extra-args]

c/_cffi_backend.c: In function 'b_complete_struct_or_union':

c/_cffi_backend.c:3878:22: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:3878:22: warning: unknown conversion type character 'z' in format [-Wformat]

c/_cffi_backend.c:3878:22: warning: too many arguments for format [-Wformat-extra-args]

Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "c:\users\paco\appdata\local\temp\pip_build_Paco\cryptography\setup.py", line 113, in <module>

    "build": cffi_build,

  File "D:\Anaconda\lib\distutils\core.py", line 112, in setup

    _setup_distribution = dist = klass(attrs)

  File "build\bdist.win-amd64\egg\setuptools\dist.py", line 239, in __init__

  File "build\bdist.win-amd64\egg\setuptools\dist.py", line 264, in fetch_build_eggs

  File "build\bdist.win-amd64\egg\pkg_resources.py", line 580, in resolve

    dist = best[req.key] = env.best_match(req, ws, installer)

  File "build\bdist.win-amd64\egg\pkg_resources.py", line 818, in best_match

    return self.obtain(req, installer) # try and download/install

  File "build\bdist.win-amd64\egg\pkg_resources.py", line 830, in obtain

    return installer(requirement)

  File "build\bdist.win-amd64\egg\setuptools\dist.py", line 314, in fetch_build_egg

  File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 593, in easy_install



  File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 623, in install_item



  File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 809, in install_eggs



  File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 1015, in build_and_install



  File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 1003, in run_setup



distutils.errors.DistutilsError: Setup script exited with error: command 'gcc' failed with exit status 1

----------------------------------------
Cleaning up...
  Removing temporary dir c:\users\paco\appdata\local\temp\pip_build_Paco...
Command python setup.py egg_info failed with error code 1 in c:\users\paco\appdata\local\temp\pip_build_Paco\cryptography
Exception information:
Traceback (most recent call last):
  File "D:\Anaconda\lib\site-packages\pip-1.5.4-py2.7.egg\pip\basecommand.py", line 122, in main
    status = self.run(options, args)
  File "D:\Anaconda\lib\site-packages\pip-1.5.4-py2.7.egg\pip\commands\install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "D:\Anaconda\lib\site-packages\pip-1.5.4-py2.7.egg\pip\req.py", line 1229, in prepare_files
    req_to_install.run_egg_info()
  File "D:\Anaconda\lib\site-packages\pip-1.5.4-py2.7.egg\pip\req.py", line 325, in run_egg_info
    command_desc='python setup.py egg_info')
  File "D:\Anaconda\lib\site-packages\pip-1.5.4-py2.7.egg\pip\util.py", line 697, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code 1 in c:\users\paco\appdata\local\temp\pip_build_Paco\cryptography

मुझे अन्य egg_info त्रुटि पोस्ट ( यहां और यहां ) मिले, लेकिन वहां दिए गए समाधान मेरी समस्या का समाधान नहीं करेंगे। इसके अलावा, मैं पीआईपी के माध्यम से अन्य पैकेज स्थापित करने में सक्षम हूं।

पीआईपी संस्करण 1.5.4 सेटप्टूलस संस्करण 2.2


हर किसी के लिए सूचक - क्रिप्टोग्राफी अब ज्यादातर ओएस के लिए जहाजों का निर्माण करती है, इसलिए एक pip installक्रिप्टोग्राफी को बॉक्स से बाहर काम करना चाहिए।
लेगरूज

जवाबों:


427

मेरे पास एक समान मुद्दा था, और पाया कि मुझे बस एक निर्भरता याद आ रही थी (मेरे लिए libssl-dev)। जैसा कि https://cryptography.io/en/latest/installation/ में संदर्भित है , यह सुनिश्चित करें कि सभी निर्भरताएं पूरी हों:

विंडोज पर

यदि आप विंडोज पर हैं, तो आपको यह सुनिश्चित करने की आवश्यकता होगी कि आपके पास ओपनएसएसएल स्थापित है। पहले से संकलित बायनेरिज़ उपलब्ध हैं। यदि आपकी स्थापना असामान्य स्थान पर है, तो संबंधित स्थानों को शामिल करने के लिए LIB और INCLUDE वातावरण चर सेट करें। उदाहरण के लिए:

C:\> \path\to\vcvarsall.bat x86_amd64
C:\> set LIB=C:\OpenSSL-1.0.1f-64bit\lib;%LIB%
C:\> set INCLUDE=C:\OpenSSL-1.0.1f-64bit\include;%INCLUDE%
C:\> pip install cryptography

लिनक्स पर क्रिप्टोग्राफी का निर्माण

क्रिप्टोग्राफी लिनक्स पर बहुत आसानी से निर्माण करना चाहिए बशर्ते आपके पास सी कंपाइलर, पायथन के लिए हेडर (यदि आप पेपी का उपयोग नहीं कर रहे हैं), और ओपनएसएसएल के लिए हेडर और आपके सिस्टम पर उपलब्ध लाइबरी लाइब्रेरी।

के लिए Debian और Ubuntu , निम्न आदेश यह सुनिश्चित करेंगे कि आवश्यक निर्भरता स्थापित कर रहे हैं:

sudo apt-get install build-essential libssl-dev libffi-dev python-dev

के लिए फेडोरा और RHEL-डेरिवेटिव्स , निम्न आदेश यह सुनिश्चित करेंगे कि आवश्यक निर्भरता स्थापित कर रहे हैं:

sudo yum install gcc libffi-devel python-devel OpenSSL-devel

अब आपको सामान्य रूप से क्रिप्टोग्राफी का निर्माण और स्थापित करने में सक्षम होना चाहिए।

pip install cryptography

1
धन्यवाद, पूरी तरह से काम किया! VS2010 होने के बाद मुझे यह करना था: VS90COMNTOOLS =% VS100COMNTOOLS% सेट करें और "mt" प्रत्यय को नाम से जोड़ें
Maciek

//, मैं पुष्टि कर सकता हूं कि यह पायथन 3.3 के साथ CEntOS 6.3 मशीन पर काम करता है जो मूल प्रश्न में पोस्ट की गई एक समान त्रुटि के साथ है।
नाथन बसानी

4
लगता है कि libffi-devपैकेज बिल्कुल महत्वपूर्ण है। मुझे कुछ और कॉन्फ़िगर करने की आवश्यकता नहीं थी, लेकिन वह पैकेज नाम त्रुटि लॉग में प्रकट नहीं हुआ: - / धन्यवाद।
m3nda

6
भूल को बदलने के लिए नहीं है python-devके साथ python3-devआप python3 उपयोग कर रहे हैं
डुआन

1
एफडब्ल्यूआईडब्ल्यू मैं डेबियन 9 चला रहा हूं और पाइप स्थापित क्रिप्टोग्राफी के दौरान त्रुटियों को छोड़ने से पहले मुझे एफटीएसएल -1.0-देव स्थापित करना पड़ा
माइक पेनिंगटन

113

यह क्रिप्टोग्राफी के इंस्टॉलेशन डॉक्स पृष्ठ पर मिली जानकारी का एक संक्षिप्त संस्करण है । नवीनतम विवरण के लिए उस पृष्ठ से परामर्श करें।

चूँकि यह SO प्रश्न सामने आता रहता है, मैं यहाँ भी एक प्रतिक्रिया छोड़ दूँगा (मैं pyca / क्रिप्टोग्राफ़ी डेवलपर्स में से एक हूँ)। यहाँ आपको 3 प्रमुख प्लेटफार्मों पर pyca / क्रिप्टोग्राफी को मज़बूती से स्थापित करने की आवश्यकता है।

कृपया ध्यान दें कि इन सभी मामलों में यह अत्यधिक अनुशंसित है कि आप एक virtualenv में स्थापित करें न कि वैश्विक पैकेज स्पेस में। यह क्रिप्टोग्राफी के लिए विशिष्ट नहीं है, बल्कि आपके पायथन इंस्टॉलेशन को विश्वसनीय बनाए रखने के लिए सामान्य सलाह है। ओएस में वैश्विक पैकेज स्थान प्रदान किया गया है पायथन सिस्टम के स्वामित्व में है और इसमें पाइप के माध्यम से चीजों को स्थापित करना परेशानी पूछ रहा है।

खिड़कियाँ

नवीनतम पाइप (जून 2016 के अनुसार 8.1.2) और अपग्रेड करें pip install cryptography

क्रिप्टोग्राफी और cffi दोनों को स्टैटिकली लिंक्ड व्हील्स के रूप में शिप किया गया है।

ओएस एक्स

नवीनतम पाइप (जून 2016 के अनुसार 8.1.2) और अपग्रेड करें pip install cryptography

क्रिप्टोग्राफी और cffi दोनों को स्टैटिकली लिंक्ड व्हील्स के रूप में शिप किया गया है। यह pyenv Python, सिस्टम Python, homebrew Python आदि के लिए काम करेगा। जब तक आप नवीनतम पाइप पर होते हैं, तब तक आपको कंपाइलर की आवश्यकता नहीं होगी।

लिनक्स

संस्करण 2.0 क्रिप्टोग्राफी के जहाजों के रूप में manylinux1 पहियों। इसका मतलब है कि पाइप 8.1+ वाले उपयोगकर्ताओं को ग्लिब-आधारित वितरण (अल्पाइन लिनक्स को छोड़कर लगभग सब कुछ) और x86 / x86-64 (क्षमा करें रास्पबेरी पाई लोगों) पर चलने वाले उपयोगकर्ताओं को अब संकलक या हेडर की आवश्यकता नहीं है क्योंकि आपको स्वचालित रूप से एक प्री-व्हील व्हील मिलेगा। । तो, पहली बात यह है कि आपको अपना पाइप अपग्रेड करना चाहिए!

यदि आप manylinux1 संगत नहीं हैं तो यहां आपको क्या करना है:

आपको C कंपाइलर, libffi + इसके डेवलपमेंट हेडर, और Opensl + इसके डेवलपमेंट हेडर की आवश्यकता होगी।

डेबियन या उबंटू व्युत्पन्न वितरण

apt-get install build-essential libssl-dev libffi-dev python-dev के बाद

pip install cryptography

रेड हैट का वितरण हुआ

yum install gcc openssl-devel libffi-devel python-devel के बाद

pip install cryptography


1
मैंने ऐसा किया है, लेकिन मुझे अभी भी यह त्रुटि मिलती है: "क्रिप्टोग्राफी के लिए असफल निर्माण पहिया" बहुत सारे आउटपुट (एक टिप्पणी के लिए बहुत अधिक) द्वारा पीछा किया गया।
रॉलंडीएक्सॉर

4
MacOSX प्रतिक्रिया ने MacOS Sierra 10.12 पर एक आकर्षण की तरह काम किया। मैंने इस समय अपने पाइप को सबसे हाल के संस्करण में उन्नत किया है, 9.0.1।
जोआ सैंटोस

3
नवीनतम पाइप (जून २०१६ के अनुसार as.१.२) पर अपग्रेड करें और बस पाइप स्थापित करें क्रिप्टोग्राफी काम करता है!
तीमुथियुस डाल्टन

मुझे मैन्युअल रूप से अपडेट करना था pipजो कि मेरी उम्र का है, तो OSX समाधान एक आकर्षण की तरह काम करता है। ( ) pip 9.0.1,MacOS Sierra
बेंजामिन

1
मेरे windows10 पर काम नहीं करता है, बिल्ड एरर मिलने से फ़ाइल नहीं खुल सकती है: 'खुलता है / खुलता है।'
Totte Karlsson

43

आप में से जो लोग OS X चला रहे हैं, उनके लिए यहां मेरे लिए काम किया गया है:

brew install openssl
env ARCHFLAGS="-arch x86_64" LDFLAGS="-L/usr/local/opt/openssl/lib" CFLAGS="-I/usr/local/opt/openssl/include"
pip install cryptography

(10.9 Mavericks चल रहा है)

आप नीचे दिए गए टिप्पणी के अनुसार झंडे और पाइप कमांड को विलय करने की कोशिश कर सकते हैं:

brew install openssl
env ARCHFLAGS="-arch x86_64" LDFLAGS="-L/usr/local/opt/openssl/lib" CFLAGS="-I/usr/local/opt/openssl/include" pip install cryptography

1
CFLAGS="-I/usr/include" pip install cryptographyरीपरहुल से मेरे लिए मावेरिक्स पर काम किया।
jjr4826

उत्तर में यह आदेश सही नहीं है: दूसरी और तीसरी पंक्ति का विलय होना चाहिए (बैकस्लैश का उपयोग करें)। फिर यह पूरी तरह से काम करता है, बस एल कैपिटन पर परीक्षण किया गया है। ऊपर की यह टिप्पणी भी सही नहीं है। उत्तर में अन्य सेटिंग्स आवश्यक हैं, या आपको बाद में शिकायतें मिलेंगी।
क्रिश्चियन टिस्मर

1
हमेशा की तरह @nathancahill HEHE
निक

1
मुझे उपयोग exportनहीं करना था env, लेकिन अन्यथा काम करता है।
रिचर्ड

$ ARCHFLAGS="-arch x86_64" LDFLAGS="-L/usr/local/opt/openssl/lib" CFLAGS="-I/usr/local/opt/openssl/include" pip install cryptographyस्थापित करने के लिए आवश्यकता पड़ने पर (एक virtualenv में) मेरे macOS 10.12साथ काम किया । Python3.7cryptographyansible
जलानब

23

यह मेरे लिए एल Capitan में काम किया

brew install pkg-config libffi openssl
env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" pip install cryptography

आप यहां धागा भी देख सकते हैं: https://github.com/pyca/cryptography/issues/2350


इस पृष्ठ पर यह पहला (और कई, कई अन्य ..) है कि Mojave 10.14.5 में मेरे लिए काम किया, धन्यवाद। यह भी पसंद है कि पर्यावरण चर केवल सत्र के लिए कमांड के बजाय अन्यत्र सक्रिय हैं।
क्रिस

23

इससे मेरे लिए समस्या हल हो गई (Ubuntu 16.04):

sudo apt-get install build-essential libssl-dev libffi-dev python-dev python3-dev

और फिर यह इस तरह काम कर रहा था:

pip install cryptography
pip install pyopenssl ndg-httpsclient pyasn1

14

OSX के हाल के संस्करणों पर स्पष्ट रूप से यह Apple द्वारा OpenSSL के अपने संस्करण को शिपिंग करने के कारण हो सकता है, जो क्रिप्टो लाइब्रेरी के साथ काम नहीं करता है।

क्रिप्टोग्राफी लाइब्रेरी जहाज के हाल के संस्करण अपने स्वयं के मूल निर्भरता के साथ, लेकिन उन्हें प्राप्त करने के लिए आपको पाइप को अपग्रेड करने की आवश्यकता होगी, और संभवतः वर्चुअल एनवी भी। तो मेरे लिए, समाधान था:

pip install --upgrade --force-reinstall pip virtualenv

virtualenv ने इसे मेरे लिए पुन: स्थापित किया, यह पाइप के पुराने संस्करण का उपयोग कर रहा था जो विफल रहा, धन्यवाद!
बजे एड्री वान हॉडट

अभी भी मेरे लिए विफल है। यहाँ OSX 10.11.3 एल कैपिटन।
agondiken

14

मैंने "क्रिप्टोग्राफी के लिए फेल्ड क्लीनिंग बिल्ड डीआईआर" कैसे हल किया
(मैं इस त्रुटि के परिणाम के लिए Google से यहां आया था।)

नोट : एक virtualenv का उपयोग कर

टी एल; डॉ:

मेरी फ़ाइल /etc/apt/sources.listमेरे डेबियन 8 के लिए सही ढंग से कॉन्फ़िगर नहीं की गई थी।

स्पष्टीकरण:

मैं पैरामिको स्थापित करना चाहता था। पैरामिको को क्रिप्टोग्राफी की जरूरत होती है।

मुझे ये त्रुटियां मिलीं: पहली बार pip install cryptography:

(...)
  ----------------------------------------
  Failed cleaning build dir for cryptography
Failed to build cryptography
(...)
    ----------------------------------------
Command "/home/myuser/pyenvs/testo/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-HXWKAO/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-WjqY6V-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/myuser/pyenvs/testo/include/site/python2.7/cryptography" failed with error code 1 in /tmp/pip-build-HXWKAO/cryptography/

और उसके बाद sudo apt-get install build-essential:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 build-essential : Depends: libc6-dev but it is not going to be installed > or
                            libc-dev
                   Depends: gcc (>= 4:4.4.3) but it is not going to be installed
                   Depends: g++ (>= 4:4.4.3) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

(ओपी के समान बिल्कुल त्रुटियां नहीं हैं, लेकिन मैं अंततः मदद करने के लिए यहां हूं )

सुलझाने:

हर पोस्ट से लगभग हर कमांड का परीक्षण करने के बाद, मैं
https://wiki.debian.org/SourceList पर जा रहा हूं
और फ़ाइल में मेरे पर्याप्त कॉन्फ़िग को कॉपी किया।/etc/apt/sources.list

फिर:

sudo aptitude update

और फिर

sudo apt-get install build-essential libssl-dev libffi-dev python-dev

और फिर

pip install cryptography

hth


Ubuntu 16.04 सर्वर पर मेरी समस्या का समाधान किया। धन्यवाद
अल्ताफ हुसैन

14

मैंने ऊपर दिए गए कई समाधानों की कोशिश की, लेकिन केवल निम्नलिखित लिब की स्थापना के बाद ही मैं इसे स्थापित कर सका cryptography:

sudo apt install libssl1.0

मैं Ubuntu 18.04 का उपयोग कर रहा हूं, लेकिन यह Ubuntu 18.10 पर भी काम करेगा।


1
हालांकि यह कोड प्रश्न का उत्तर दे सकता है, लेकिन यह समस्या का हल कैसे और / या इसके बारे में अतिरिक्त संदर्भ प्रदान करता है, इससे उत्तर के दीर्घकालिक मूल्य में सुधार होगा।
निक 3500

1
इसने मेरे लिए काम किया। यह काम क्यों किया? उस पैकेज में क्या अंतर है, जो libssl1.0-dev और libssl-dev को स्थापित करता है?
क्रिस

2
मुझे क्यों नहीं मिला, लेकिन इससे मुझे भी मदद मिली
dyus

मेरे लिए भी काम किया। हालांकि सफल इंस्टॉलेशन की घोषणा के बाद भी पाइप को एक विभाजन दोष मिलता है, लेकिन मुझे लगता है कि यह सिर्फ एक पाइप समस्या है।
रॉब मोशर

10

यह मेरे लिए काम कर रहा है (मैं Ubuntu 14.04 का उपयोग कर रहा हूँ):

पहले स्थापित करें libffi-dev libssl-dev libpython2.7-dev:

sudo apt-get install libffi-dev libssl-dev libpython2.7-dev

फिर virtualenv के अंदर:

pip install cryptography
pip install pyopenssl ndg-httpsclient pyasn1

सूत्रों का कहना है:

https://stackoverflow.com/a/32800685/5123544

https://stackoverflow.com/a/29202163/5123544


7

निक वुडहैम का जवाब मेरे लिए OSX 10.11 El Capitan पर काम नहीं करता था, लेकिन यह किया।

brew install openssl
CFLAGS="-I/usr/local/opt/openssl/include" pip install cryptography==0.8

यह मेरे लिए काम करने के सबसे करीब था, लेकिन असफल भी रहा। एल कैपिटान ओएसएक्स 10.11.3 यहां। में / निजी / var / फ़ोल्डर्स / d9 / 75cfznt17cjc124j3stq3qc40000gn / टी / पिप-निर्माण Q_JjdE / क्रिप्टोग्राफी / त्रुटि कोड 1 के साथ विफल
agondiken

मुझे उपयोग करना था CFLAGS="-I/usr/local/opt/openssl/include" pip install cryptographyऔर इसे स्थापित किया। मुझे LDFLAGS="-L/usr/local/opt/openssl/lib"पुस्तकालय को लोड करने के लिए जोड़ना था । डीन क्रिस्चियन अरमादा की टिप्पणी समान काम करने के लिए लगती है लेकिन हार्ड कोडिंग के बजाय काढ़ा उत्पन्न चर का उपयोग करना।
spig

4

यदि आप python3 का उपयोग कर रहे हैं, तो आपको इंस्टॉल करने की आवश्यकता है python3-dev। इससे मेरी समस्या ठीक हो गई sudo apt-get install python3-dev


4

मैं cryptography==1.7.1Ubuntu 16.04 पर स्थापित करने के साथ समस्याएँ कर रहा था और ऊपर दिए गए किसी भी उत्तर ने मदद नहीं की। इसलिए, मैंने आवश्यकता को संगत 1.8.2 पर अपग्रेड किया और सेटअप सफल रहा। ध्यान दें कि आपको अभी भी शीर्ष में वर्णित आवश्यक और अन्य निर्भरता (सबसे अधिक उत्कीर्ण) का निर्माण करने की आवश्यकता होगी ।


3

मुझे चलने में समस्या हो रही थी sudo pip install cryptographyक्योंकि संकलन करने की कोशिश करने पर यह ff नहीं मिलेगा। (OSX - योसेमाइट)

मैंने इसे libffi डाउनलोड करके और env var सेट करके हल किया।

$ brew install pkg-config libffi
$ export PKG_CONFIG_PATH=/usr/local/Cellar/libffi/3.0.13/lib/pkgconfig/
$ pip install cryptography

मुझे bcrypt स्थापित करने में समस्या हो रही थी क्योंकि cffi स्थापित करने में विफल रहा, लेकिन इसने cffi और bcrypt दोनों के लिए इसे ठीक कर दिया। धन्यवाद!
रेडिएंट्रैडन

यह मेरे लिए एल Capitan पर काम नहीं किया। "पाइप स्थापित क्रिप्टोग्राफी" के अंत में आवारा अवधि पर भी ध्यान दें।
शकर

@ चेकर के पास एल कैपिटान नहीं है इसलिए वह परीक्षण नहीं कर सकता है लेकिन आवारा अवधि को हटा दिया है।
थिंकबोनोबो

@ चेकर एल कैपिटन इंस्टॉलेशन के लिए मेरे उत्तर भाई की जाँच करें
डीन क्रिस्चियन आर्मडा


3

यदि आप GitLab CI के लिए एक .itlab-ci.yml फ़ाइल में एक अजगर पैकेज वितरण का निर्माण कर रहे हैं जो एक एडब्ल्यूएस EC2 मशीन में तैनात एक गिट्लाब धावक का उपयोग करता है

 - apk add --update alpine-sdk && \
 - apk add libffi-dev openssl-dev && \
 - apk --no-cache --update add build-base

1
चीयर्स, एक अल्पाइन आधारित डॉकटर कंटेनर में महान काम किया!
एलेक्स ज़ाबू

2

मैंने देखा कि मूल पोस्टर स्पष्ट रूप से एक विंडोज़ इंस्टॉलेशन का उपयोग कर रहा था ... और ऊपर दिए गए सर्वश्रेष्ठ उत्तर सभी अन्य ओएस के लिए हैं ... इसलिए यहां जाता है। यह माना जाता है कि आपने पायथन 2.7 स्थापित किया है जो सबसे व्यापक रूप से समर्थित (हालांकि पुराना) संस्करण है।

  1. स्थापित करें " विजुअल C ++ पायथन के लिए संकलक "
  2. एक प्रशासनिक कमांड प्रॉम्प्ट विंडो खोलें
  3. फिर से चलाने के लिए स्थापित पाइप (पैकेज) उदा

    cd C:\Python27\Scripts
    pip install cryptography  (or pycrypto, fabric, etc)

2

मुझे हाल ही में इसी तरह के मुद्दे का सामना करना पड़ा। मेरे मामले में संस्करण cffiऔर cryptographyआवश्यकताओं में लिखे गए हैं। यह संगत नहीं था (cffi == 1.8.9 और क्रिप्टोग्राफी == 1.9)। मैंने cffiअंतिम उपलब्ध संस्करण के साथ अपडेट करना हल किया ।


1

मैं वास्तव में स्क्रेपी को स्थापित करने की कोशिश में इसी संभावना में भाग गया, जो पहले स्थापित होने वाली क्रिप्टोग्राफी पर निर्भर करता है। मैं Win764- बिट पर पायथन 2.7 64-बिट के साथ स्थापित हूं। @ jsonm के उत्तर ने आखिरकार मेरे लिए काम किया, लेकिन पहले मुझे उस बिन डायर के भीतर उपनिरीक्षक को कॉपी C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvarsx86_amd64.batकरना पड़ा x86_amd64ताकि vcvarsall.batयह कहते हुए एक त्रुटि को रोक दिया जाए कि यह कॉन्फ़िगरेशन को याद नहीं कर रहा था। यदि आपको एक अलग सेटअप के लिए env var को कॉन्फ़िगर करने की आवश्यकता है, तो संबंधित vdvars बैट फाइल को संबंधित सबडिर पर कॉपी करना सुनिश्चित करें या नीचे दिया गया पहला कमांड काम न करे।

फिर मैंने @ jsonm के निर्देशों के अनुसार एक कमांडलाइन से निम्न भाग किया (मेरे कॉन्फिग के लिए ट्वीक किया गया) ...

C:\> "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86_amd64 
C:\> set LIB=C:\OpenSSL-Win64\lib;%LIB% 
C:\> set INCLUDE=C:\OpenSSL-Win64\include;%INCLUDE% 
C:\> pip install cryptography

और इसने काम किया।


1

मेरी भी यही त्रुटि थी। ओपनएसएसएल स्थापित करने के बाद भी इस त्रुटि को जारी रखने के बाद, मैंने अंततः https://pypi.python.org/pypi/cryptography/0.2.2#downloads से पहिया फ़ाइलों से इंस्टॉल करने का प्रयास किया । इसने काम कर दिया!


1

मैं pami से paramiko पूर्ण स्रोत कोड डाउनलोड किया और किया

अजगर setup.py स्थापित

यह निर्दोष रूप से काम किया

सभी डिफ़ॉल्ट pythondev / खुलने का समय / libffi संकुल पहले से ही rhel में मौजूद हैं।

आरपीएम डाउनलोड करने में आरपीएम मिसमैच और अधिक परेशानी होती है


0

मैं एक ही समस्या है:

pip install cryptography

.
.
.
Installing collected packages: cffi, cryptography
     Running setup.py install for cffi ... error

तब मैं libffi-devel स्थापित करता हूं और समस्या हल हो जाती है

yum install libffi-devel

0

उन दो आदेशों ने इसे मेरे लिए तय किया:

brew install openssl
brew link openssl --force

स्रोत: https://github.com/phusion/passenger/issues/1630#issuecomment-147527656


1
मैं brew link openssl --forceओएस एक्स पर करने के खिलाफ अत्यधिक सलाह देता हूं। इसके बजाय, बस अपने पाइप को नवीनतम संस्करण में अपग्रेड करें और यह बिना किसी समस्या के cffi और क्रिप्टोग्राफी दोनों के लिए एक सांख्यिकीय रूप से जुड़ा पहिया स्थापित करेगा।
पॉल केहर

हमारी साइट का प्रयोग करके, आप स्वीकार करते हैं कि आपने हमारी Cookie Policy और निजता नीति को पढ़ और समझा लिया है।
Licensed under cc by-sa 3.0 with attribution required.