Issue with upgrading to ver 7, and issue with Cryptography

Hello,

While updating to ver 7 I got this error:

Executing erpnext.patches.v7_0.remove_features_setup in site3.local (1dd227d3c8)
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in runmodule_as_main
    "main", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in runcode
    exec code in run_globals
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in 
    main()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 664, in call
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 644, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 991, in invoke
    return processresult(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 991, in invoke
    return processresult(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 203, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py", line 27, in migrate
    frappe.modules.patch_handler.run_all()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 25, in run_all
    if not run_single(patchmodule = patch):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 52, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 68, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + ".execute")()
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v7_0/remove_features_setup.py", line 10, in execute
    stock_settings.save()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 242, in save
    self._save(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 269, in _save
    self.run_before_save_methods()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 687, in run_before_save_methods
    self.run_method("validate")
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 638, in run_method
    return Document.hook(fn)(self, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 816, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 799, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 632, in 
    fn = lambda self, args, **kwargs: getattr(self, method)(args, **kwargs)
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/stock_settings/stock_settings.py", line 18, in validate
    self.get("item_naming_by")=="Naming Series", hide_name_field=True)

  File 
"/home/frappe/frappe-bench/apps/erpnext/erpnext/setup/doctype/naming_series/naming_series.py",
 line 170, in set_by_naming_series
    make_property_setter(doctype, "naming_series", "reqd", 0, "Check")

  File 
"/home/frappe/frappe-bench/apps/frappe/frappe/custom/doctype/property_setter/property_setter.py",
 line 70, in make_property_setter
    property_setter.insert()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 231, in insert
    self.run_post_save_methods()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 705, in run_post_save_methods
    self.run_method("on_update")
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 638, in run_method
    return Document.hook(fn)(self, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 816, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 799, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 632, in 
    fn = lambda self, args, **kwargs: getattr(self, method)(args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/custom/doctype/property_setter/property_setter.py", line 55, in on_update
    validate_fields_for_doctype(self.doc_type)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 258, in validate_fields_for_doctype
    validate_fields(frappe.get_meta(doctype, cached=False))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 456, in validate_fields
    check_illegal_default(d)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 326, in check_illegal_default
    frappe.throw(_("Default for 'Check' type of field must be either '0' or '1'"))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 299, in throw
    msgprint(msg, raise_exception=exc, title=title)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 292, in msgprint
    raiseexception()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 265, in raiseexception
    raise raise_exception, encode(msg)
frappe.exceptions.ValidationError: Default for 'Check' type of field must be either '0' or '1'
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in 
    load_entry_point('bench==0.1', 'console_scripts', 'bench')()
  File "/home/frappe/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 664, in call
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 644, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 991, in invoke
    return processresult(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/bench-repo/bench/commands/update.py", line 60, in update
    update(pull, patch, build, bench, auto, restartsupervisor, requirements, no_backup, upgrade, force=force)
  File "/home/frappe/bench-repo/bench/commands/update.py", line 90, in _update
    patch_sites(bench_path=bench_path)
  File "/home/frappe/bench-repo/bench/utils.py", line 124, in patch_sites
    run_frappe_cmd('--site', 'all', 'migrate', bench_path=bench_path)
  File "/home/frappe/bench-repo/bench/utils.py", line 453, in run_frappe_cmd
    raise CommandFailedError(args)
bench.utils.CommandFailedError: ('--site', 'all', 'migrate')

Then I was asked to download Cryptography, that as well gave the error:

root@work:/home/frappe/frappe-bench# pip install cryptography
Collecting cryptography
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/uti                                                                                                             l/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available                                                                                                            
 . This prevents urllib3 from configuring SSL appropriately and may 
cause certain                                                                                                              SSL connections to fail. For more information, see https://urllib3.readthedocs.                                                                                                             org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading cryptography-1.4.tar.gz (399kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 401kB 1.1MB/s
Collecting idna>=2.0 (from cryptography)
  Downloading idna-2.1-py2.py3-none-any.whl (54kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 57kB 5.9MB/s
Requirement already satisfied (use --upgrade to upgrade): pyasn1>=0.1.8 in /usr/                                                                                                             local/lib/python2.7/dist-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): six>=1.4.1 in /usr/loc                                                                                                             al/lib/python2.7/dist-packages (from cryptography)
Collecting setuptools>=11.3 (from cryptography)
  Downloading setuptools-25.0.0-py2.py3-none-any.whl (442kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 446kB 409kB/s
Collecting enum34 (from cryptography)
  Downloading enum34-1.1.6-py2-none-any.whl
Collecting ipaddress (from cryptography)
  Downloading ipaddress-1.0.16-py27-none-any.whl
Collecting cffi>=1.4.1 (from cryptography)
  Downloading cffi-1.7.0.tar.gz (400kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 401kB 928kB/s
Collecting pycparser (from cffi>=1.4.1->cryptography)
  Downloading pycparser-2.14.tar.gz (223kB)
    100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 225kB 1.8MB/s
Building wheels for collected packages: cryptography, cffi, pycparser
  Running setup.py bdist_wheel for cryptography
  Complete output from command /usr/bin/python -c "import setuptools;__file__='/                                                                                                             tmp/pip-build-eCnNkI/cryptography/setup.py';exec(compile(open(__file__).read().r                                                                                                             eplace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpchELL4pip-wheel                                                                                                             -:
  Package libffi was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libffi.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libffi' found
  Package libffi was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libffi.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libffi' found
  Package libffi was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libffi.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libffi' found
  Package libffi was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libffi.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libffi' found
  Package libffi was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libffi.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libffi' found
  c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
   #include <ffi.h>
                   ^
  compilation terminated.
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-build-eCnNkI/cryptography/setup.py", line 333, in <module>
      **keywords_with_side_effects(sys.argv)
    File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
      _setup_distribution = dist = klass(attrs)
    File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 239, in __i                                                                                                             nit__
      self.fetch_build_eggs(attrs.pop('setup_requires'))
    File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 264, in fet                                                                                                             ch_build_eggs
      replace_conflicting=True
    File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 620, in resol                                                                                                             ve
      dist = best[req.key] = env.best_match(req, ws, installer)
    File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 858, in best_                                                                                                             match
      return self.obtain(req, installer) # try and download/install
    File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 870, in obtai                                                                                                             n
      return installer(requirement)
    File "/usr/lib/python2.7/dist-packages/setuptools/dist.py", line 314, in fet                                                                                                             ch_build_egg
      return cmd.easy_install(req)
    File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py",                                                                                                              line 616, in easy_install
      return self.install_item(spec, dist.location, tmpdir, deps)
    File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py",                                                                                                              line 646, in install_item
      dists = self.install_eggs(spec, download, tmpdir)
    File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py",                                                                                                              line 834, in install_eggs
      return self.build_and_install(setup_script, setup_base)
    File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py",                                                                                                              line 1040, in build_and_install
      self.run_setup(setup_script, setup_base, args)
    File "/usr/lib/python2.7/dist-packages/setuptools/command/easy_install.py",                                                                                                              line 1028, in run_setup
      raise DistutilsError("Setup script exited with %s" % (v.args[0],))
  distutils.errors.DistutilsError: Setup script exited with error: command 'x86_                                                                                                             64-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for cryptography
  Running setup.py bdist_wheel for cffi
  Complete output from command /usr/bin/python -c "import setuptools;__file__='/                                                                                                             tmp/pip-build-eCnNkI/cffi/setup.py';exec(compile(open(__file__).read().replace('                                                                                                             \r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpMlcQHEpip-wheel-:
  Package libffi was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libffi.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libffi' found
  Package libffi was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libffi.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libffi' found
  Package libffi was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libffi.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libffi' found
  Package libffi was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libffi.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libffi' found
  Package libffi was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libffi.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libffi' found
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-2.7
  creating build/lib.linux-x86_64-2.7/cffi
  copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/recompiler.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/api.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/lock.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/verifier.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/commontypes.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/__init__.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/model.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/ffiplatform.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/vengine_gen.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/cparser.py -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/_cffi_include.h -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/parse_c_type.h -> build/lib.linux-x86_64-2.7/cffi
  copying cffi/_embedding.h -> build/lib.linux-x86_64-2.7/cffi
  running build_ext
  building '_cffi_backend' extension
  creating build/temp.linux-x86_64-2.7
  creating build/temp.linux-x86_64-2.7/c
  x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wa                                                                                                             ll -Wstrict-prototypes -fPIC -DUSE__THREAD -I/usr/include/ffi -I/usr/include/lib                                                                                                             ffi -I/usr/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-x86_64-2.7                                                                                                             /c/_cffi_backend.o
  c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
   #include <ffi.h>
                   ^
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for cffi
  Running setup.py bdist_wheel for pycparser
  Stored in directory: /root/.cache/pip/wheels/9b/f4/2e/d03e949a551719a1ffcb659f                                                                                                             2c63d8444f4df12e994ce52112
Successfully built pycparser
Failed to build cryptography cffi
Installing collected packages: idna, setuptools, enum34, ipaddress, pycparser, c                                                                                                             ffi, cryptography
  Found existing installation: setuptools 3.3
    Uninstalling setuptools-3.3:
      Successfully uninstalled setuptools-3.3
  Running setup.py install for cffi
    Complete output from command /usr/bin/python -c "import setuptools, tokenize                                                                                                             ;__file__='/tmp/pip-build-eCnNkI/cffi/setup.py';exec(compile(getattr(tokenize, '                                                                                                             open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install                                                                                                              --record /tmp/pip-wCWPLQ-record/install-record.txt --single-version-externally-                                                                                                             managed --compile:
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    running install
    running build
    running build_py
    running build_ext
    building '_cffi_backend' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -                                                                                                             Wall -Wstrict-prototypes -fPIC -DUSE__THREAD -I/usr/include/ffi -I/usr/include/l                                                                                                             ibffi -I/usr/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-x86_64-2                                                                                                             .7/c/_cffi_backend.o
    c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
     #include <ffi.h>
                     ^
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-buil                                                                                                             d-eCnNkI/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).r                                                                                                             ead().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-wCWPL                                                                                                             Q-record/install-record.txt --single-version-externally-managed --compile" faile                                                                                                             d with error code 1 in /tmp/pip-build-eCnNkI/cffi
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/uti                                                                                                             l/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available                                                                                                            
 . This prevents urllib3 from configuring SSL appropriately and may 
cause certain                                                                                                              SSL connections to fail. For more information, see https://urllib3.readthedocs.                                                                                                             org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
You are using pip version 7.1.2, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Can you please help me urgently, since my whole office is stuck today and yesterday?

Regards,
Ahmed

Try running:

If you’re on Ubuntu run:

sudo apt-get install libffi-dev libssl-dev

If you’re on CentOS run:

sudo yum install libffi-devel openssl-devel

And try to update again

I am running Ubuntu. I ran the suggested command:
sudo apt-get install libffi-dev libssl-dev

Then I ran:
Pip install Cryptography

And now Cryptography is installed, but when I run bench update, I get the same error.

try frappe@dev:~/frappe-bench$ ./env/bin/pip install cryptography instead of pip install cryptography

I think the issue is not with Cryptography anymore, since when I run pip install cryptography, I get:
Requirement already satisfied (use --upgrade to upgrade): cryptography in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied (use --upgrade to upgrade): idna>=2.0 in /usr/local/lib/python2.7/dist-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): pyasn1>=0.1.8 in /usr/local/lib/python2.7/dist-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): six>=1.4.1 in /usr/local/lib/python2.7/dist-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): setuptools>=11.3 in /usr/local/lib/python2.7/dist-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): enum34 in /usr/local/lib/python2.7/dist-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): ipaddress in /usr/local/lib/python2.7/dist-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): cffi>=1.4.1 in /usr/local/lib/python2.7/dist-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): pycparser in /usr/local/lib/python2.7/dist-packages (from cffi>=1.4.1->cryptography)

cryptography should also be available under bench’s python environment ./env/
Right now it is there in /usr/local/lib/python2.7/dist-packages

1 Like

Thanks Revant,

I did as you said ./env/bin/pip install cryptography from Frappe-bench folder, and I got:

root@work:/home/frappe/frappe-bench# ./env/bin/pip install cryptography
Requirement already satisfied (use --upgrade to upgrade): cryptography in ./env/                                                                                                             lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): idna>=2.0 in ./env/lib                                                                                                             /python2.7/site-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): pyasn1>=0.1.8 in ./env                                                                                                             /lib/python2.7/site-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): six>=1.4.1 in ./env/li                                                                                                             b/python2.7/site-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): setuptools>=11.3 in ./                                                                                                             env/lib/python2.7/site-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): enum34 in ./env/lib/py                                                                                                             thon2.7/site-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): ipaddress in ./env/lib                                                                                                             /python2.7/site-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): cffi>=1.4.1 in ./env/l                                                                                                             ib/python2.7/site-packages (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): pycparser in ./env/lib                                                                                                             /python2.7/site-packages (from cffi>=1.4.1->cryptography)

Then I ran bench update, and still I having the same error.

Regards,
Ahmed

@ahmed

On terminal execute bench mysql

and please share output for following queries

query 1:

select `default` from tabDocField where parent="Item" and fieldtype="Check";

query 2:

select property_type, doc_type, value, default_value, name from `tabProperty Setter` where doc_type = "Item" and property_type="Check";
1 Like

Hello Surabh, for query 1:

MariaDB [1bd3e0294d]> select `default` from tabDocField where parent="Item" and                                                                                                              fieldtype="Check";
+---------+
| default |
+---------+
| NULL    |
| NULL    |
| 0       |
|         |
| NULL    |
| 1       |
|         |
| 0       |
|         |
|         |
| 0       |
| NULL    |
+---------+
12 rows in set (0.01 sec)

For query 2:

MariaDB [1bd3e0294d]> select property_type, doc_type, value, default_value, name from `tabProperty Setter` where doc_type = "Item" and property_type="Check";
+---------------+----------+-------+---------------+---------------------------+
| property_type | doc_type | value | default_value | name                      |
+---------------+----------+-------+---------------+---------------------------+
| Check         | Item     | 0     | NULL          | Item-barcode-hidden       |
| Check         | Item     | 0     | NULL          | Item-item_code-hidden     |
| Check         | Item     | 1     | NULL          | Item-item_code-reqd       |
| Check         | Item     | 1     | NULL          | Item-naming_series-hidden |
| Check         | Item     | 0     | NULL          | Item-naming_series-reqd   |
+---------------+----------+-------+---------------+---------------------------+
5 rows in set (0.00 sec)

@saurabh6790, Any luck with our update issue? It’s getting hot here.

Dear Saurabh, here is the query outputs for site3.local as well, which is the site that is failing during the migration:

MariaDB [1dd227d3c8]> select fieldname, `default` from tabDocField where parent="Item" and fieldtype="Check";
+------------------------+---------+
| fieldname              | default |
+------------------------+---------+
| is_fixed_asset         | NULL    |
| is_stock_item          | 1       |
| inspection_required    |         |
| publish_in_hub         | 0       |
| disabled               | NULL    |
| show_in_website        | NULL    |
| has_variants           | 0       |
| synced_with_hub        | 0       |
| is_sub_contracted_item |         |
| has_serial_no          |         |
| has_batch_no           |         |
| delivered_by_supplier  | NULL    |
+------------------------+---------+
12 rows in set (0.01 sec)

and for second query:

MariaDB [1dd227d3c8]> select property_type, doc_type, value, default_value, name from `tabProperty Setter` where doc_type="Item" and property_type="Check";
+---------------+----------+-------+---------------+---------------------------+
| property_type | doc_type | value | default_value | name                      |
+---------------+----------+-------+---------------+---------------------------+
| Check         | Item     | 0     | NULL          | Item-item_code-hidden     |
| Check         | Item     | 1     | NULL          | Item-item_code-reqd       |
| Check         | Item     | 1     | NULL          | Item-naming_series-hidden |
| Check         | Item     | 0     | NULL          | Item-naming_series-reqd   |
+---------------+----------+-------+---------------+---------------------------+
4 rows in set (0.00 sec)

I hope this helps.

Regards,
Ahmed

@ahmed

from bench mysql execute,

update `tabProperty Setter` set value = 0 where field_name = "is_stock_item" and name = "Item-is_stock_item-default";

commit;

then do bench migrate

Dear @saurabh6790,

This worked I guess, but now there is a different error!

Executing erpnext.patches.v7_0.rename_fee_amount_to_fee_component in site3.local (1dd227d3c8)
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
    main()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 664, in __call__
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 644, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 203, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py", line 27, in migrate
    frappe.modules.patch_handler.run_all()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 25, in run_all
    if not run_single(patchmodule = patch):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 52, in run_single
    return execute_patch(patchmodule, method, methodargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py", line 68, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + ".execute")()
  File "/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v7_0/rename_fee_amount_to_fee_component.py", line 13, in execute
    rename_field(dt, "amount", "components")
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/utils/rename_field.py", line 24, in rename_field
    (new_fieldname, old_fieldname))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 137, in sql
    self._cursor.execute(query, values)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
_mysql_exceptions.ProgrammingError: (1146, "Table '1dd227d3c8.tabFee Component' doesn't exist")

Im getting the same error

regards
Hemant

@ahmed @hpema108

Fixed !! Pull latest updates and do bench migrate

1 Like

Still the same error, unless I missed a step:

hemant@VarmaniHQ:~/frappe-bench/apps/erpnext$ git pull upstream
remote: Counting objects: 24, done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 24 (delta 4), reused 0 (delta 0), pack-reused 8
Unpacking objects: 100% (24/24), done.
From https://github.com/frappe/erpnext
18f622f…9b542f3 develop -> upstream/develop
29628f3…1adb77e hotfix -> upstream/hotfix

  • [new branch] v6.x.x -> upstream/v6.x.x
  • [new tag] v6.27.22 -> v6.27.22
  • [new tag] v6.27.23 -> v6.27.23
  • [new tag] v6.27.24 -> v6.27.24
  • [new tag] v6.27.25 -> v6.27.25
  • [new tag] v6.27.26 -> v6.27.26
  • [new tag] v7.0.0 -> v7.0.0
  • [new tag] v7.0.1 -> v7.0.1
  • [new tag] v7.0.2 -> v7.0.2
  • [new tag] v7.0.3 -> v7.0.3
  • [new tag] v7.0.4 -> v7.0.4
    Already up-to-date.
    hemant@VarmaniHQ:~/frappe-bench/apps/erpnext$ bench migtrate
    Usage: bench [OPTIONS] COMMAND [ARGS]…

Error: No such command β€œmigtrate”.
hemant@VarmaniHQ:~/frappe-bench/apps/erpnext$ bench migrate
Migrating www.varmani.co.za
Executing erpnext.patches.v7_0.rename_fee_amount_to_fee_component in www.varmani.co.za (e7d1040a24)
Traceback (most recent call last):
File β€œ/usr/lib/python2.7/runpy.py”, line 162, in _run_module_as_main
β€œmain”, fname, loader, pkg_name)
File β€œ/usr/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File β€œ/home/hemant/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File β€œ/home/hemant/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=β€˜bench’)
File β€œ/home/hemant/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File β€œ/home/hemant/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File β€œ/home/hemant/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File β€œ/home/hemant/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File β€œ/home/hemant/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File β€œ/home/hemant/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File β€œ/home/hemant/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File β€œ/home/hemant/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File β€œ/home/hemant/frappe-bench/apps/frappe/frappe/commands/site.py”, line 203, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File β€œ/home/hemant/frappe-bench/apps/frappe/frappe/migrate.py”, line 27, in migrate
frappe.modules.patch_handler.run_all()
File β€œ/home/hemant/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 25, in run_all
if not run_single(patchmodule = patch):
File β€œ/home/hemant/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 52, in run_single
return execute_patch(patchmodule, method, methodargs)
File β€œ/home/hemant/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 68, in execute_patch
frappe.get_attr(patchmodule.split()[0] + β€œ.execute”)()
File β€œ/home/hemant/frappe-bench/apps/erpnext/erpnext/patches/v7_0/rename_fee_amount_to_fee_component.py”, line 13, in execute
rename_field(dt, β€œamount”, β€œcomponents”)
File β€œ/home/hemant/frappe-bench/apps/frappe/frappe/model/utils/rename_field.py”, line 24, in rename_field
(new_fieldname, old_fieldname))
File β€œ/home/hemant/frappe-bench/apps/frappe/frappe/database.py”, line 137, in sql
self._cursor.execute(query, values)
File β€œ/home/hemant/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 205, in execute
self.errorhandler(self, exc, value)
File β€œ/home/hemant/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py”, line 36, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.ProgrammingError: (1146, β€œTable β€˜e7d1040a24.tabFee Component’ doesn’t exist”)
hemant@VarmaniHQ:~/frappe-bench/apps/erpnext$

I have 3 production sites on my server, at the moment site1.local and site2 are working fine, the problem is with site3. I am afraid that if I do bench update I will create problem for site1 & 2, so I will do it in a couple of hours after people leave the office.

For now, I did a migrate without bench update and I still have the same issue. Will give feedback after I do bench update then migrate.

Thanks

@hpema108 @ahmed

We have fixed this issue and released a patch for it. You may try updating bench at your convenience.

2 Likes