Brand new Installation fails at pip upgrade

hello,
I tried all of your suggestions on a brand new krystal ubuntu22.04 * Ubuntu 22.04

  • Data Center

London

  • WHMCS License

Free/None

  • Management

No

  • Backups

Backups Standard

  • CPU

0 x Extra CPU Core £5.00

  • Memory

1 x 1GB of extra RAM £3.00

  • SSD Space

0 x 1GB of extra SSD Storage £0.20

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: Is a directory

root@box:/home/liam# export DEB_PYTHON_INSTALL_LAYOUT=‘deb’
root@box:/home/liam# curl -s https://mailinabox.email/setup.sh | sudo -E bash

running in circles now for hours.

Something is very wrong here. pip is supposed to be an executable, not a directory. Somehow a directory named pip has appeared in your venv/bin/ where the application should be.

I deleted that already. it was a more desperate attempt.

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

  1. Permissions: The default installation of Python may not have the necessary permissions to upgrade pip. Try running the command with sudo:

sudo pip install --upgrade pip

it’s not they aren’t there, as I understand it. They are in the wrong place.

Same issue for me with a new DigitalOcean install.

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

Does not help either:

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

Same issue after running:

pip install --upgrade pip

Help?

The solution worked for me a couple of days ago with a fresh Digital Ocean install.

I suspect your problem is the the second ‘sudo’ in the line ‘sudo --preserve-env …’. I am not a unix shell expert, but likely you are not passing the environment variable you just set to the environment this command uses.

My work around was to just run the setup as root to ensure all commands executed in the same environment. The better solution would be to spend a few minutes understanding the sudo command, and how it handles accounts and environment variables.

The first sudo is the one that is not needed. It doesn’t hurt to have it there, afaict, but it’s not needed. -E and --preserve-env are the same as used in that command. But if you want to remove all doubt, then just run everything as the root user (including the export command) and don’t use sudo at all, and see if that helps.

I’ve suggested this several times before, but no one has ever responded on whether it helped or did not help, but I think you might need to remove the env directory entirely under /usr/local/lib/mailinabox/ to force the setup to re-create the virtual env, because the script checks for the existence of that directory before trying to run virtualenv. So, please try removing the env directory. This can be done with the command:
sudo rm -rf /usr/local/lib/mailinabox/env

1 Like

A super simple fix is to try this, it worked for me:

cp /usr/local/lib/mailinabox/env/local/bin/ /usr/local/lib/mailinabox/env/bin/

Thanks for the correction. For some reason, I completely overlooked the -E parameter.

I can confirm that this is true from my testing on a Digital Ocean instance. If the setup script fails due to this error, the script will not work, even with DEB_PYTHON_INSTALL_LAYOUT set, unless the env directory is deleted.

1 Like

I can confirm as well this is the solution on a new VPS with the root account:

root@box:~# export DEB_PYTHON_INSTALL_LAYOUT='deb'
root@box:~# curl -s https://mailinabox.email/setup.sh | sudo -E bash
1 Like

I can also confirm this finally works for me.

You have to run the export command before the first attempt of installing mailinabox.

Running it after the first failure does not work. You’ll have to then start over and create a brand new VM.

Worked on DigitalOcean Ubuntu 22.04 droplet.

Ran these 2 commands as root :

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

I’ve been struggling with the same failure, but finally got my installation to work, so I’m sharing what I know.

fwiw, Linode 22.04, 2GB ram, 1 core

After clean 22.04 install (no apt update or upgrade performed)
I tried multiple suggestions from various forums with no luck. Even the export suggestion didn’t work. I finally got past the error when I first removed the env directory and then did the export suggestion. This was not from a completely fresh 22.04 image. I had tried various suggestion and had run the mailinabox / curl command many times.

Here’s the commands:
root@box:~# rm -r /usr/local/lib/mailinabox/env #remove the env dir entirely
root@box:~# export DEB_PYTHON_INSTALL_LAYOUT=‘deb’
root@box:~# curl -s https://mailinabox.email/setup.sh | sudo -E bash

After a successful install I was able follow the miab migration procedure to copy my backup from my ubuntu 18.04 server, rerun the maib script and everything works on the new server!

Thanks everyone for their suggestions and good luck!

This unfortunately does not resolve my issue. I have tried pretty much everything described as working in this thread, but none of the solutions work for me. Well, I guess that is a rather convenient way to unsubscribe from many email newsletters at once :sweat_smile:

EDIT: I have been able to reinstall using the following advice from github:

You need to run the command before anything else, otherwise it wont work.
So, get a VM, connect, run export DEB_PYTHON_INSTALL_LAYOUT='deb', then as second step, run sudo --preserve-env curl -s https://mailinabox.email/setup.sh | sudo -E bash.

Confirmed this works on Amazons EC2.
again, you must export before curl. if you bash the script before you export you must rebuild the vm from the ground

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