Unable to run "mailinabox"command

I recently let my SSL cert expire because i wanted to start using lets encrypt. The day it expired i tried to get into the TLS menu to set it up. The error i received only said “something went wrong” and no details. i attempted to run the install command again and get this…

FAILED: pip3 install email_validator>=1.0.0

Traceback (most recent call last):
File “/usr/bin/pip3”, line 9, in
load_entry_point(‘pip==1.5.4’, ‘console_scripts’, ‘pip3’)()
File “/usr/local/lib/python3.4/dist-packages/pkg_resources/init.py”, line 561, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File “/usr/local/lib/python3.4/dist-packages/pkg_resources/init.py”, line 2627, in load_entry_point
return ep.load()
File “/usr/local/lib/python3.4/dist-packages/pkg_resources/init.py”, line 2287, in load
return self.resolve()
File “/usr/local/lib/python3.4/dist-packages/pkg_resources/init.py”, line 2293, in resolve
module = import(self.module_name, fromlist=[‘name’], level=0)
File “/usr/lib/python3/dist-packages/pip/init.py”, line 61, in
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File “/usr/lib/python3/dist-packages/pip/vcs/mercurial.py”, line 9, in
from pip.download import path_to_url
File “/usr/lib/python3/dist-packages/pip/download.py”, line 22, in
import requests, six
File “”, line 2237, in _find_and_load
File “”, line 2226, in _find_and_load_unlocked
File “”, line 1191, in _load_unlocked
File “”, line 1161, in _load_backward_compatible
File “/usr/share/python-wheels/requests-2.2.1-py2.py3-none-any.whl/requests/init.py”, line 53, in
File “”, line 2237, in _find_and_load
File “”, line 2226, in _find_and_load_unlocked
File “”, line 1191, in _load_unlocked
File “”, line 1161, in _load_backward_compatible
File “/usr/share/python-wheels/urllib3-1.7.1-py2.py3-none-any.whl/urllib3/contrib/pyopenssl.py”, line 25, in
File “/usr/local/lib/python3.4/dist-packages/OpenSSL/init.py”, line 8, in
from OpenSSL import rand, crypto, SSL
File “/usr/local/lib/python3.4/dist-packages/OpenSSL/rand.py”, line 12, in
from OpenSSL._util import (
File “/usr/local/lib/python3.4/dist-packages/OpenSSL/_util.py”, line 6, in
from cryptography.hazmat.bindings.openssl.binding import Binding
File “/usr/local/lib/python3.4/dist-packages/cryptography/hazmat/bindings/openssl/binding.py”, line 207, in
Binding.init_static_locks()
File “/usr/local/lib/python3.4/dist-packages/cryptography/hazmat/bindings/openssl/binding.py”, line 178, in init_static_locks
cls._ensure_ffi_initialized()
File “/usr/local/lib/python3.4/dist-packages/cryptography/hazmat/bindings/openssl/binding.py”, line 165, 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 104, in build_conditional_library
if not getattr(lib, condition):
AttributeError: cffi library ‘_openssl’ has no function, constant or global variable named ‘Cryptography_HAS_SCRYPT’

im not sure how to proceed. any help would be great. thanks in advance.

I think this is the solution here:

Similar issue here:

root@box:~# curl -s https://mailinabox.email/setup.sh | sudo bash

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@box:~#

Have you tried the solutions above? What was the result of those commands?

Comment: This forum is very hard to follow.

With that said, there’s a weird issue here where once the above issue happens, any time you type ‘pip3’ it results in the error:

root@box:~# pip3
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’****

So even using the solutions on Version 0.21 is posted, some commands cannot work since pip3 is broken:

EG: pip3 install pyOpenSSL

this command cannot be run, since pip3 results in the above error.

running: apt-get remove python3-pip and then apt-get install python3-pip does not resolve the issue.

installing pyOpenSSL via apt-get works fine, but I still can’t run ‘mailinabox’ without getting the above error due to pip3:

root@box:~/mailinabox# 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@box:~/mailinabox#

apt-get -y purge python3-openssl
apt-get -y purge python3-pip
rm -rf /usr/local/lib/python3.4/dist-packages/{OpenSSL,cryptography}*
rm -rf /usr/local/lib/python3.4/dist-packages/pkg_resources
apt-get install python3-pip
pip3 install pyOpenSSL
mailinabox

[…]

Installing Z-Push (Exchange/ActiveSync server)…
Installing Mail-in-a-Box system management daemon…

FAILED: pip3 install --upgrade rtyaml email_validator>=1.0.0 free_tls_certificates>=0.1.3 idna>=2.0.0 cryptography>=1.0.2 boto psutil

Requirement already up-to-date: rtyaml in /usr/local/lib/python3.4/dist-packages
Requirement already up-to-date: email-validator>=1.0.0 in /usr/local/lib/python3.4/dist-packages
Requirement already up-to-date: free-tls-certificates>=0.1.3 in /usr/local/lib/python3.4/dist-packages
Requirement already up-to-date: idna>=2.0.0 in /usr/local/lib/python3.4/dist-packages
Downloading/unpacking cryptography>=1.0.2
Running setup.py (path:/tmp/pip_build_root/cryptography/setup.py) egg_info for package cryptography
Traceback (most recent call last):
File “”, line 3, in
File “/usr/local/lib/python3.4/dist-packages/setuptools/init.py”, line 14, in
from setuptools.dist import Distribution, Feature
File “/usr/local/lib/python3.4/dist-packages/setuptools/dist.py”, line 17, in
import packaging
ImportError: No module named 'packaging’
Complete output from command python setup.py egg_info:
Traceback (most recent call last):

File “”, line 3, in

File “/usr/local/lib/python3.4/dist-packages/setuptools/init.py”, line 14, in

from setuptools.dist import Distribution, Feature

File “/usr/local/lib/python3.4/dist-packages/setuptools/dist.py”, line 17, in

import packaging

ImportError: No module named ‘packaging’


Cleaning up…
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/cryptography
Storing debug log for failure in /root/.pip/pip.log

root@box:~#

So I have tried apt-get install python3-openssl and while that installs fine, I am still unable to get through ‘mailinabox’ configuration.

I cannot access the web interface.

I got the exact same error doing a clean install on a clean Ubuntu 14.04. First I thought it was because I installed 14.04.05 and did some apt-get update/upgrade/dist-upgrade, but I also get the same error on a clean 14.04.03 without updating and directly installing mailinabox after installation of Ubuntu.

I’ve just tried to install too, and it’s failing around: “ImportError: No module named ‘packaging’”

I’ve got the same error. I had mailinabox installed like 3 months ago and it worked since. now when i want to install it on a new (clean) machine it throws the same error OP has. I tried with Ubuntu 14.4 32bit min, ubuntu 14.4 32 bit and ubuntu 14.4 64 bit. Always the same error (saying module package cannot be found)

1 Like

I’ve tried all suggested workarounds too

1 Like

Having the same issue with renewing certificates. The workaround I used 90ish days ago (uninstalling python ssl and re-installing) isn’t working this time.

1 Like

I was able to get pip working by doing the following.

sudo -i
apt-get purge -y python3-pip
wget https://bootstrap.pypa.io/get-pip.py
python3 ./get-pip.py
apt-get install python3-pip

after doing that I was able to run the mailinabox installation with no issues.

4 Likes

This solved my installation issue! Thank you for this so I can start checking out mailinabox

glad it worked for you

Did you have do do anything with the openssl packages, or did you just run the curl script, have it fail, then run your commands, and have it succeed?

This worked for me perfectly too - thank you!

This also worked for me.

Thank you!

Worked for me aswell. Thanks alot for taking the time and post the solution that worked for you

Ok I’ve been trying to resolve my issue for hours now and can’t work out the solution. Originally I had the packaging error and have resolved that, however now I get the following when running both the curl command and the mailinabox script.

Collecting cryptography>=1.3.4 (from pyOpenSSL)
Using cached cryptography-1.7.1.tar.gz
Complete output from command python setup.py egg_info:
running egg_info
error: Invalid distribution name or version syntax: cryptography-1.7.1

----------------------------------------

Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-rf89i4p6/cryptography/

Could anyone let me know what i’m doing wrong? All of this has been run on a new instance of a 14.04 install so I thought this was going to be much more straight forward