3

Python version 2.7

user 'jenkins': installation works
pip install bcrypt
Requirement already satisfied (use --upgrade to upgrade): bcrypt in /home/jenkins/.virtualenvs/dal/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): cffi>=1.1 in /home/jenkins/.virtualenvs/dal/lib/python2.7/site-packages (from bcrypt)
Requirement already satisfied (use --upgrade to upgrade): six>=1.4.1 in /home/jenkins/.virtualenvs/dal/lib/python2.7/site-packages (from bcrypt)
Requirement already satisfied (use --upgrade to upgrade): pycparser in /home/jenkins/.virtualenvs/dal/lib/python2.7/site-packages (from cffi>=1.1->bcrypt)

under root user:

sudo su
root@server_name:/apps/app_name# pip install bcrypt
Collecting bcrypt
  Using cached bcrypt-2.0.0.tar.gz
Requirement already satisfied (use --upgrade to upgrade): cffi>=1.1 in /usr/local/lib/python2.7/dist-packages (from bcrypt)
Requirement already satisfied (use --upgrade to upgrade): six>=1.4.1 in /usr/local/lib/python2.7/dist-packages (from bcrypt)
Requirement already satisfied (use --upgrade to upgrade): pycparser in /usr/local/lib/python2.7/dist-packages (from cffi>=1.1->bcrypt)
Installing collected packages: bcrypt
  Running setup.py install for bcrypt ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-UQAoWx/bcrypt/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-BL_G1e-record/install-record.txt --single-version-externally-managed --compile:
    <module 'pycparser' from '/usr/local/lib/python2.7/dist-packages/pycparser/__init__.pyc'>
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-UQAoWx/bcrypt/setup.py", line 226, in <module>
        **keywords_with_side_effects(sys.argv)
      File "/usr/lib/python2.7/distutils/core.py", line 112, in setup
        _setup_distribution = dist = klass(attrs)
      File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 225, in __init__
        _Distribution.__init__(self,attrs)
      File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
        self.finalize_options()
      File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 258, in finalize_options
        ep.load()(self, ep.name, value)
      File "/usr/local/lib/python2.7/dist-packages/cffi/setuptools_ext.py", line 161, in cffi_modules
        add_cffi_module(dist, cffi_module)
      File "/usr/local/lib/python2.7/dist-packages/cffi/setuptools_ext.py", line 48, in add_cffi_module
        execfile(build_file_name, mod_vars)
      File "/usr/local/lib/python2.7/dist-packages/cffi/setuptools_ext.py", line 24, in execfile
        exec(code, glob, glob)
      File "src/build_bcrypt.py", line 29, in <module>
        """
      File "/usr/local/lib/python2.7/dist-packages/cffi/api.py", line 105, in cdef
        self._cdef(csource, override=override, packed=packed)
      File "/usr/local/lib/python2.7/dist-packages/cffi/api.py", line 119, in _cdef
        self._parser.parse(csource, override=override, **options)
      File "/usr/local/lib/python2.7/dist-packages/cffi/cparser.py", line 290, in parse
        self._internal_parse(csource)
      File "/usr/local/lib/python2.7/dist-packages/cffi/cparser.py", line 295, in _internal_parse
        ast, macros, csource = self._parse(csource)
      File "/usr/local/lib/python2.7/dist-packages/cffi/cparser.py", line 230, in _parse
        csource, macros = _preprocess(csource)
      File "/usr/local/lib/python2.7/dist-packages/cffi/cparser.py", line 138, in _preprocess
        if pycparser.__version__ < '2.14':
    AttributeError: 'module' object has no attribute '__version__'

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-UQAoWx/bcrypt/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-BL_G1e-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-UQAoWx/bcrypt

Tried:

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

also tried:

sudo apt-get remove python-pycparser
sudo apt-get install python-pycparser
2
  • Have you read /tmp/pip-build-UQAoWx/bcrypt? Commented Jan 24, 2016 at 9:37
  • There is nothing there after installation Commented Jan 24, 2016 at 9:39

2 Answers 2

4

I encountered similar problems when attempting

pip install --user --upgrade bcrypt

I had debian python-cffi package installed, version 0.8.6. After removing it the command above succeeded. The old version somehow caused problems even though new version of cffi had been installed using pip.

Also

pip uninstall  bcrypt cffi pycparser
pip install --user --upgrade cffi
pip install --user --upgrade bcrypt

seems to work even when python-cffi package is installed.

Sign up to request clarification or add additional context in comments.

2 Comments

I still got an error, until I did "sudo apt-get install python3-dev"
This worked with python version 3.8.13. Windows Machine. Thank you!
0

ensure that the required dependencies are installed from the Homepage of bcrypt

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.