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.
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
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
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.
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
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