Bench update issues due to gitpython

[root@vmerp frappe-bench]# bench update --reset
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up-to-date.
INFO:bench.utils:./env/bin/pip install Pillow
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages (4.2.1)
Requirement already satisfied: olefile in ./env/lib/python2.7/site-packages (from Pillow) (0.44)
From cffi callback <function _verify_callback at 0x7f77d2545668>:
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/OpenSSL/SSL.py", line 313, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),)) - skipping
INFO:bench.app:pulling frappe
INFO:bench.utils:git fetch --all
Fetching upstream
INFO:bench.utils:git reset --hard upstream/master
HEAD is now at 40787b3 Merge branch 'hotfix'
INFO:bench.utils:find . -name "*.pyc" -delete
INFO:bench.app:pulling erpnext
INFO:bench.utils:git fetch --all
Fetching upstream
INFO:bench.utils:git reset --hard upstream/master
HEAD is now at 38eaaad Merge branch 'hotfix'
INFO:bench.utils:find . -name "*.pyc" -delete
Updating Python libraries...
INFO:bench.utils:./env/bin/pip install --upgrade pip
From cffi callback <function _verify_callback at 0x7f81cace4668>:
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/OpenSSL/SSL.py", line 313, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),)': /simple/pip/
From cffi callback <function _verify_callback at 0x30f5aa0>:
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/OpenSSL/SSL.py", line 313, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),)': /simple/pip/
From cffi callback <function _verify_callback at 0x3112aa0>:
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/OpenSSL/SSL.py", line 313, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),)': /simple/pip/
From cffi callback <function _verify_callback at 0x3112f50>:
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/OpenSSL/SSL.py", line 313, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),)': /simple/pip/
From cffi callback <function _verify_callback at 0x3112c80>:
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/OpenSSL/SSL.py", line 313, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),)': /simple/pip/
From cffi callback <function _verify_callback at 0x31122a8>:
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/OpenSSL/SSL.py", line 313, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),)) - skipping
Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages (18.1)
From cffi callback <function _verify_callback at 0x30f5d70>:
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/OpenSSL/SSL.py", line 313, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),)) - skipping
INFO:bench.utils:./env/bin/pip install -q -r /home/frappe/.bench/requirements.txt
From cffi callback <function _verify_callback at 0x2d48aa0>:
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/OpenSSL/SSL.py", line 313, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),)': /simple/gitpython/
From cffi callback <function _verify_callback at 0x2d65c08>:
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/OpenSSL/SSL.py", line 313, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),)': /simple/gitpython/
From cffi callback <function _verify_callback at 0x2d650c8>:
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/OpenSSL/SSL.py", line 313, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),)': /simple/gitpython/
From cffi callback <function _verify_callback at 0x2d65cf8>:
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/OpenSSL/SSL.py", line 313, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),)': /simple/gitpython/
From cffi callback <function _verify_callback at 0x2d657d0>:
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/OpenSSL/SSL.py", line 313, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),)': /simple/gitpython/
From cffi callback <function _verify_callback at 0x2d65050>:
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/OpenSSL/SSL.py", line 313, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
  Could not find a version that satisfies the requirement GitPython==2.1.11 (from -r /home/frappe/.bench/requirements.txt (line 8)) (from versions: )
No matching distribution found for GitPython==2.1.11 (from -r /home/frappe/.bench/requirements.txt (line 8))
From cffi callback <function _verify_callback at 0x2d65758>:
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/OpenSSL/SSL.py", line 313, in wrapper
    _lib.X509_up_ref(x509)
AttributeError: 'module' object has no attribute 'X509_up_ref'
Traceback (most recent call last):
  File "/usr/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/frappe/.bench/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/lib64/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/lib64/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib64/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib64/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/.bench/bench/commands/update.py", line 60, in update
    _update(pull, patch, build, bench, auto, restart_supervisor, restart_systemd, requirements, no_backup, force=force, reset=reset)
  File "/home/frappe/.bench/bench/commands/update.py", line 76, in _update
    update_requirements(bench_path=bench_path)
  File "/home/frappe/.bench/bench/utils.py", line 431, in update_requirements
    install_requirements(pip, bench_req_file)
  File "/home/frappe/.bench/bench/utils.py", line 499, in install_requirements
    exec_cmd("{pip} install -q -r {req_file}".format(pip=pip, req_file=req_file))
  File "/home/frappe/.bench/bench/utils.py", line 159, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: ./env/bin/pip install -q -r /home/frappe/.bench/requirements.txt
[root@vmerp frappe-bench]#

note: when i swap GitPython 0.3.2.rc1 for GitPython 2.1.11 bench 4.1.0 won’t work and when i run bench update, GitPython 2.1.11 is required according to the requirement in /home/frappe/.bench/requirements.txt

1 Like

seems to be the source of your problem. This link resolved a similar problem (but module was num2words instead of pip/pillow). Maybe try reinstalling pip/pillow this way

Otherwise, have a look at this link to a link

i have tried most of those tips and its still not working.

when i try to run as a non root user, i get the error below

Traceback (most recent call last):
  File "/usr/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/frappe/.bench/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/lib64/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib64/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/lib64/python2.7/site-packages/click/core.py", line 1063, in invoke
    Command.invoke(self, ctx)
  File "/usr/lib64/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib64/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/.bench/bench/commands/__init__.py", line 31, in bench_command
    setup_logging(bench_path=bench_path)
  File "/home/frappe/.bench/bench/utils.py", line 300, in setup_logging
    hdlr = logging.FileHandler(log_file)
  File "/usr/lib64/python2.7/logging/__init__.py", line 902, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/lib64/python2.7/logging/__init__.py", line 925, in _open
    stream = open(self.baseFilename, self.mode)
IOError: [Errno 13] Permission denied: '/home/frappe/frappe-bench/logs/bench.log'

Not a good/safe idea to run it as root.

Most likely an incompatible version combo of pyopenssl and cryptography installed.
If you run

pip show cryptography | grep “Version:”
pip show pyopenssl | grep “Version:”

what do you get? Normally if you updated both to latest, it should work
otherwise, uninstalling one or the other might help (you can always add them back if it doesn’t)

pip uninstall pyOpenSSL

any update, were you able to solve this ?

Same problem here upgrading to v11

Before you continue troubleshooting, you need to reassign ownership of the home folder to frappe:
chown -R frappe:frappe *

Wow. Bad idea.

DO NOT DO THIS.

You do not want to provide world level read-write-execute on the entire home directory. That is going to make your server very insecure.

Please take some time to read up on unix permissions and retry. Feel free to ask any specific questions you ma have about this.

You are right, the other commands were for Develop server!
My bad!

However, trouble to update to V11 still remains an issue of either:

  • Pip Version
  • Something regarding the ssl connection to Links for pip. It seems the ssl certificate is expired or some other problem.

Stuff I have tried:

  1. Install Gitpython as frappe from frappe-bench folder.
    pip install GitPython

Yes probably the learning here is - to avoid permission and security headaches, the rule of thumb is never login as root. Better yet simply disable root login.

2 Likes

OK, Definitely avoid the root login for production servers, I agree. As I have been learning, this is standard practice for our production instances. On our development servers it does come in handy, thus the accidental proposal of that solution, which clearly, I have removed it so it is no longer an issue. Thus, instead of turning this into a discussion on the merits of root user or not, which have been abundantly clarified beyond any reasonable doubt, I would like to turn this discussion into a specific topic regarding the specific error originally posted by @Ubfacility_Saas

However, fact remains, that the above problem happened to me while logged in as frappe not as root.

Well to disable root login on all servers is not a bad idea.

That might prevent this -

To install as root has what merit but inevitably leads to permission problems?

Few of us are superusers with a keen idea of what we are doing :wink:

1 Like

I am also getting the same error. Cannot proceed with the upgrade. Have you solved this?

This seems to work for me:

  • go to your bench folder
. env/bin/activate
pip uninstall pyOpenSSL cryptography
sudo pip install pyOpenSSL cryptography