v0.21c Release - Fixes Python package installation issue


#1

Hello everyone. Version 0.21c of Mail-in-a-Box has been posted.

This update corrects a problem installing and updating Mail-in-a-Box. If you have not encountered any problems, there is no need to update. There are no other changes in this release besides correcting this issue.

From the changelog:

Installations and upgrades started failing about 10 days ago with the error ImportError: No module named 'packaging' after an upstream package (Python’s setuptools) was updated by its maintainers. The updated package conflicted with Ubuntu 14.04’s version of another package (Python’s pip). This update upgrades both packages to remove the conflict.

If you encountered an error like the one mentioned above while trying to install or upgrade Mail-in-a-Box, this update may correct the problem. Upgrading instructions are here:

https://mailinabox.email/maintenance.html#upgrade

If when running this update you encounter ImportError: No module named 'pyrfc3339', please try it a second time before reporting a problem below.

If you encountered the issue while creating a fresh box, starting over on a new machine might be better.

For further information on what the problem was, please see the commit with the fix:


#2

I’ve attached a screenshot of the issue I am currently dealing with. I was two versions behind and decided to update today.


#3

Thanks Josh for fixing the Python setuptools issue that people seemed to have issues with. However, I am still at v0.19b and I think I’ll keep from updating if people still experience issues with the 0.21 releases.


#4

I’ve tried this upgrade a couple times… still getting this issue. Upgrading from 0.20

root# sudo mailinabox

FAILED: pip3 install email_validator>=1.0.0

Traceback (most recent call last):
File “/usr/bin/pip3”, line 5, in
from pkg_resources import load_entry_point
File “/usr/local/lib/python3.4/dist-packages/pkg_resources/init.py”, line 70, in
import packaging.version
ImportError: No module named ‘packaging’

root# sudo mailinabox

FAILED: pip3 install email_validator>=1.0.0

Traceback (most recent call last):
File “/usr/bin/pip3”, line 5, in
from pkg_resources import load_entry_point
File “/usr/local/lib/python3.4/dist-packages/pkg_resources/init.py”, line 70, in
import packaging.version
ImportError: No module named ‘packaging’


#5

Smart. I wasn’t having issues but now I am. Le sigh.


#6

I got an email this morning from my MiaB instance with a bunch of errors. In the interest of helping track the issue, I’ll share it here:

Traceback (most recent call last):
  File "management/ssl_certificates.py", line 807, in <module>
    provision_certificates_cmdline()
  File "management/ssl_certificates.py", line 450, in provision_certificates_cmdline
    status = provision_certificates(env, agree_to_tos_url=agree_to_tos_url, logger=my_logger, force_domains=force_domains, show_extended_problems=show_extended_problems)
  File "management/ssl_certificates.py", line 271, in provision_certificates
    import requests.exceptions
  File "/usr/local/lib/python3.4/dist-packages/requests/__init__.py", line 52, in <module>
    from .packages.urllib3.contrib import pyopenssl
  File "/usr/local/lib/python3.4/dist-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 46, in <module>
    import OpenSSL.SSL
  File "/usr/local/lib/python3.4/dist-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/usr/local/lib/python3.4/dist-packages/OpenSSL/rand.py", line 12, in <module>
    from OpenSSL._util import (
  File "/usr/local/lib/python3.4/dist-packages/OpenSSL/_util.py", line 6, in <module>
    from cryptography.hazmat.bindings.openssl.binding import Binding
  File "/usr/local/lib/python3.4/dist-packages/cryptography/hazmat/bindings/openssl/binding.py", line 173, in <module>
    Binding.init_static_locks()
  File "/usr/local/lib/python3.4/dist-packages/cryptography/hazmat/bindings/openssl/binding.py", line 137, in init_static_locks
    cls._ensure_ffi_initialized()
  File "/usr/local/lib/python3.4/dist-packages/cryptography/hazmat/bindings/openssl/binding.py", line 124, in _ensure_ffi_initialized
    cls.lib = build_conditional_library(lib, CONDITIONAL_NAMES)
  File "/usr/local/lib/python3.4/dist-packages/cryptography/hazmat/bindings/openssl/binding.py", line 89, in build_conditional_library
    if not getattr(lib, condition):
AttributeError: cffi library '_openssl' has no function, constant or global variable named 'Cryptography_HAS_SCRYPT'
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/lib/python3.4/multiprocessing/pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "/usr/lib/python3.4/multiprocessing/pool.py", line 47, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
  File "management/status_checks.py", line 332, in run_domain_checks_on_domain
    ssl_certificates = get_ssl_certificates(env)
  File "/root/mailinabox/management/ssl_certificates.py", line 47, in get_ssl_certificates
    pem = load_pem(load_cert_chain(fn)[0])
  File "/root/mailinabox/management/ssl_certificates.py", line 765, in load_pem
    return serialization.load_pem_private_key(pem, password=None, backend=default_backend())
  File "/usr/local/lib/python3.4/dist-packages/cryptography/hazmat/backends/__init__.py", line 71, in default_backend
    _default_backend = MultiBackend(_available_backends())
  File "/usr/local/lib/python3.4/dist-packages/cryptography/hazmat/backends/__init__.py", line 28, in _available_backends
    "cryptography.backends"
  File "/usr/local/lib/python3.4/dist-packages/cryptography/hazmat/backends/__init__.py", line 27, in <listcomp>
    for ep in pkg_resources.iter_entry_points(
  File "/usr/local/lib/python3.4/dist-packages/pkg_resources/__init__.py", line 2302, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python3.4/dist-packages/cryptography/hazmat/backends/openssl/__init__.py", line 7, in <module>
    from cryptography.hazmat.backends.openssl.backend import backend
  File "/usr/local/lib/python3.4/dist-packages/cryptography/hazmat/backends/openssl/backend.py", line 52, in <module>
    from cryptography.hazmat.bindings.openssl import binding
  File "/usr/local/lib/python3.4/dist-packages/cryptography/hazmat/bindings/openssl/binding.py", line 173, in <module>
    Binding.init_static_locks()
  File "/usr/local/lib/python3.4/dist-packages/cryptography/hazmat/bindings/openssl/binding.py", line 137, in init_static_locks
    cls._ensure_ffi_initialized()
  File "/usr/local/lib/python3.4/dist-packages/cryptography/hazmat/bindings/openssl/binding.py", line 124, in _ensure_ffi_initialized
    cls.lib = build_conditional_library(lib, CONDITIONAL_NAMES)
  File "/usr/local/lib/python3.4/dist-packages/cryptography/hazmat/bindings/openssl/binding.py", line 89, in build_conditional_library
    if not getattr(lib, condition):
AttributeError: cffi library '_openssl' has no function, constant or global variable named 'Cryptography_HAS_SCRYPT'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "management/status_checks.py", line 970, in <module>
    run_and_output_changes(env, pool)
  File "management/status_checks.py", line 826, in run_and_output_changes
    run_checks(True, env, cur, pool)
  File "management/status_checks.py", line 65, in run_checks
    run_domain_checks(rounded_values, env, output, pool)
  File "management/status_checks.py", line 323, in run_domain_checks
    ret = pool.starmap(run_domain_checks_on_domain, args, chunksize=1)
  File "/usr/lib/python3.4/multiprocessing/pool.py", line 268, in starmap
    return self._map_async(func, iterable, starmapstar, chunksize).get()
  File "/usr/lib/python3.4/multiprocessing/pool.py", line 599, in get
    raise self._value
AttributeError: cffi library '_openssl' has no function, constant or global variable named 'Cryptography_HAS_SCRYPT'

#7

I have exact same problem.
Let’s Encrypt certificates are not renewed.
I also cannot see anything on a status page since server returns 500 error on XHR call.


#8

For errors like the one @jmoudy is reporting (No module named 'packaging'), you can try:

sudo rm -rf /usr/local/lib/python3.4/dist-packages/{pkg_resources,setuptools}*
apt-get install --reinstall python3-setuptools python3-pip python3-pkg-resources

And then run the Mail-in-a-Box setup again.

For errors like the one @netoperatorwibby is reporting (cffi library '_openssl' has no function), try:

sudo rm -rf /usr/local/lib/python3.4/dist-packages/cryptography*

And then run the Mail-in-a-Box setup again. See this earlier post about that problem.


Error during upgrade to v0.23a
#9

I thought I was diligent in my searching. Oh well, thanks for the tip!


#10

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.