Brand new Installation fails at pip upgrade

Hi folks,

I’m trying to install Mail-in-a-box on a brand new Ubuntu 22.04 vm on DigitalOcean.

The initial setup script fails at this step related to pip upgrade :

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

FAILED: /usr/local/lib/mailinabox/env/bin/pip install --upgrade pip
-----------------------------------------
setup/functions.sh: line 19: /usr/local/lib/mailinabox/env/bin/pip: No such file or directory

I looked into the directory, and it seems the expected path to pip might be incorrect.

The script attempts to call : /usr/local/lib/mailinabox/env/bin/pip

But the actual path to pip is : /usr/local/lib/mailinabox/env/local/bin/pip

Does the script need to be tweaked to get past this error? The installation doesn’t finish for me.

Thoughts?

Same problem as well brother

Looking through the scripts, I think I found where that path is declared

It is in the management.sh script from the cloned repo.

# Create a virtualenv for the installation of Python 3 packages
# used by the management daemon.
inst_dir=/usr/local/lib/mailinabox
mkdir -p $inst_dir
venv=$inst_dir/env
if [ ! -d $venv ]; then
        hide_output virtualenv -ppython3 $venv
fi

I will try to manually modify the script with the correct path, and run it again.

Okay let me know if its worked brother

Please try the solution I outlined here, https://github.com/mail-in-a-box/mailinabox/issues/2335#issuecomment-1828910117, and let us know if it works.

This code in management.sh hasn’t changed in years. It looks like something might have changed in a recent Ubuntu package upgrade that has changed the behavior of python’s virtualenv creation.

2 Likes

This worked for me.

I set the env var and ran the scripts again.
export DEB_PYTHON_INSTALL_LAYOUT='deb'

1 Like

It worked for me too.
Just in case if you are installing from non-root, then in my case worked:
export DEB_PYTHON_INSTALL_LAYOUT=‘deb’
sudo --preserve-env curl -s https://mailinabox.email/setup.sh | sudo -E bash

Actually I still cannot install Mailinabox on a vanilla VM. Tried all the previous suggestions.

I keep restoring a snapshot or re-deploying a vanilla VM with Ubuntu 22.04. Fails every time.

Either at the pip error :
FAILED: /usr/local/lib/mailinabox/env/bin/pip install --upgrade pip

OR at the blinker error
ERROR: Cannot uninstall 'blinker'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

Blockquote actually I still cannot install Mailinabox on a vanilla VM. Tried all the previous suggestions.

did you try the command export DEB_PYTHON_INSTALL_LAYOUT=‘deb’ ?

Stil dead for me, even setting that env var & using preserve env (I’m on a non-root user)

Also just jumped into root, set env var there, and executed - still same error.

FAILED: /usr/local/lib/mailinabox/env/bin/pip install --upgrade pip                                                          │  
-----------------------------------------┌─────────────────────────────────────────────────────────────────────────────────┐ │  
setup/functions.sh: line 19: /usr/local/lib/mailinabox/env/bin/pip: No such file or directory```

Can you try completely removing the env directory that is there now, then setting the environment variable and running setup again? I’m thinking when management.sh runs, it won’t try to create the venv if it’s already there.

Unfortunatly i have the same problem.
Fresh install of ubuntu 22.04.3.

gmarth@truemail:~$ export DEB_PYTHON_INSTALL_LAYOUT=‘deb’
gmarth@truemail:~$ sudo --preserve-env curl -s https://mailinabox.email/setup.sh | sudo -E bash
........
Installing Mail-in-a-Box system management daemon...

FAILED: /usr/local/lib/mailinabox/env/bin/pip install --upgrade pip
-----------------------------------------
setup/functions.sh: line 19: /usr/local/lib/mailinabox/env/bin/pip: No such file or directory
-----------------------------------------

EDIT: Ok. Seems like i was just missing the second preserve-env argument. So with this it is working:

export DEB_PYTHON_INSTALL_LAYOUT=‘deb’
sudo --preserve-env curl -L https://power-mailinabox.net/setup.sh | sudo --preserve-env bash

yes, each sudo initiates a new session. so you should pass env vars. or not use the second sudo at all

I tried both the commands on a fresh VM (Ubuntu 22.04 on DigitalOcean)

export DEB_PYTHON_INSTALL_LAYOUT=  'deb'
sudo --preserve-env curl -L https://power-mailinabox.net/setup.sh | sudo --preserve-env bash

No bueno

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

FAILED: /usr/local/lib/mailinabox/env/bin/pip install --upgrade pip
-----------------------------------------
setup/functions.sh: line 17: /usr/local/lib/mailinabox/env/bin/pip: No such file or directory

Still unable to install mailinabox, unfortunately

There must not be any spaces between = and 'deb'

This probably isn’t the way to fix the problem but… I did:
ln -s /usr/bin/pip /usr/local/lib/mailinabox/env/bin/pip
pip install --ignore-installed blinker

EDIT: Disclosure - I’m brand new to the Mail-in-a-Box ecosystem and have no clue how it works. I just noticed this thread and decided to jump in.

I had the same issue… I got further down the install by copying Ubuntu’s built-in pip installation to the specified path:

sudo mkdir /usr/local/lib/mailinabox/env/bin
sudo cp /usr/bin/pip /usr/local/lib/mailinabox/env/bin/pip

I then ran into the blinker problem and “fixed” it by:

sudo apt remove python3-blinker

Then:

sudo /usr/local/lib/mailinabox/env/bin/pip install --upgrade rtyaml "email_validator>=1.0.0" "exclusiveprocess" flask dnspython python-dateutil expiringdict gunicorn qrcode[
pil] pyotp "idna>=2.0.0" "cryptography==37.0.2" psutil postfix-mta-sts-resolver b2sdk boto3

HOWEVER now I’m running into an issue where no matter what email I specify when creating my first mail account I get “That’s not a valid email address

I’m not familiar with the “blinker problem”, but your copying around of pip was probably ill-advised. For one, you didn’t copy the correct “pip” into the venv. Also, there’s more than just pip in the venv bin directory to consider.

If you’re not too far down the road with the install, I’d advise starting over and using the tactic of setting the environment variable that’s discussed above, which would be this:

export DEB_PYTHON_INSTALL_LAYOUT='deb'
curl -s https://mailinabox.email/setup.sh | sudo -E bash

There wasn’t any, it was just added when I copied it into this forum.
I also confirmed with echo $DEB_PYTHON_INSTALL_LAYOUT which splits out ‘deb’

The setup code tests if the venv dir is present and creates it if it is not present. So I would recommend that you try deleting the directory (or just moving it somewhere else out of the way) and running the setup again.