New error when running bench update: ./env/bin/pip not found

hello guys, i get these error when bench update and now my erpnext is not working:

INFO:bench.utils:./env/bin/pip install Pillow
/bin/sh: 1: ./env/bin/pip: not found
Please install these dependencies using the command:
sudo apt-get install -y libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk

i tried to install these dependencies, but they are already installed, now i am stuck
please help
thank you

bench migrate-env python3
DEBUG:bench.commands:Clearing Redis Cache…
INFO:bench.utils:/usr/bin/redis-cli -p 13000 FLUSHALL
OK
DEBUG:bench.commands:Clearing Redis DataBase…
INFO:bench.utils:/usr/bin/redis-cli -p 13000 FLUSHDB
OK
DEBUG:bench.commands:Backing up Virtual Environment
DEBUG:bench.commands:Migration Error
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 9, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/bench/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/frappe/bench/bench/commands/init.py”, line 139, in migrate_env
os.rename(source, dest)
OSError: [Errno 2] No such file or directory

now i get this error when i try bech migrate-env python3

Same problem here with successful fix Bench update fails: /bin/sh: 1: ./env/bin/pip: not found - #7 by kdevloper

I tried it before i write here, i reached where i have to execute in bench folder ./env/bin/easy_install pip and it still gives me no such file or directory, now i am stuck

Perhaps you got something like this:

frappe@ubuntu:~/frappe-bench$ ./env/bin/pip install pip --upgrade
Collecting pip
  Using cached https://files.pythonhosted.org/packages/46/dc/7fd5df840efb3e56c8b4f768793a237ec4ee59891959d6a215d63f727023/pip-19.0.1-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 18.0
    Uninstalling pip-18.0:
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/home/frappe/frappe-bench/env/lib/python2.7/site-packages/pip-18.0.dist-info/INSTALLER'
Consider using the `--user` option or check the permissions.

To get around the above permission error this worked for me - I used sudo:

frappe@ubuntu:~/frappe-bench$ ./env/bin/easy_install pip
Searching for pip
Best match: pip 18.0
Adding pip 18.0 to easy-install.pth file
Installing pip script to /home/frappe/frappe-bench/env/bin
Installing pip3.7 script to /home/frappe/frappe-bench/env/bin
Installing pip3 script to /home/frappe/frappe-bench/env/bin

Using /home/frappe/frappe-bench/env/lib/python2.7/site-packages
Processing dependencies for pip
Finished processing dependencies for pip
frappe@ubuntu:~/frappe-bench$ sudo ./env/bin/pip install pip --upgrade
The directory '/home/frappe/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/frappe/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pip
  Downloading https://files.pythonhosted.org/packages/46/dc/7fd5df840efb3e56c8b4f768793a237ec4ee59891959d6a215d63f727023/pip-19.0.1-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 1.6MB/s 
Installing collected packages: pip
  Found existing installation: pip 18.0
    Uninstalling pip-18.0:
      Successfully uninstalled pip-18.0
Successfully installed pip-19.0.1
frappe@ubuntu:~/frappe-bench$ bench update --reset
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
Already up-to-date.
INFO:bench.utils:./env/bin/pip install Pillow
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages (5.0.0)
INFO:bench.app:pulling frappe
INFO:bench.utils:git fetch --all
Fetching upstream
INFO:bench.utils:git reset --hard upstream/master

Nope, Thats what i get exactly

root@erp:/home/frappe/prod-bench# ./env/bin/pip install pip --upgrade
-bash: ./env/bin/pip: No such file or directory

I think something is missed up when i tried to migrate python env to return back to python2.7, as of now when i try to do

root@erp:/home/frappe/prod-bench# bench migrate-env python3.6
DEBUG:bench.commands:Clearing Redis Cache…
INFO:bench.utils:/usr/bin/redis-cli -p 13000 FLUSHALL
OK
DEBUG:bench.commands:Clearing Redis DataBase…
INFO:bench.utils:/usr/bin/redis-cli -p 13000 FLUSHDB
OK
DEBUG:bench.commands:Backing up Virtual Environment
DEBUG:bench.commands:Migration Error
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 9, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/bench/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 722, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 697, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 535, in invoke
return callback(*args, **kwargs)
File “/home/frappe/bench/bench/commands/init.py”, line 139, in migrate_env
os.rename(source, dest)
OSError: [Errno 2] No such file or directory

Yes same for me, so then first do this:

frappe@ubuntu:~/frappe-bench$ ./env/bin/easy_install pip

then this:

frappe@ubuntu:~/frappe-bench$ sudo ./env/bin/pip install pip --upgrade

same error

root@erp:/home/frappe/prod-bench# ./env/bin/easy_install pip
-bash: ./env/bin/easy_install: No such file or directory

ok sorry I can’t be of much help here, I have little sense of environments

no problem, just dont know what just happened here :frowning_face:

I reinstalled the server, and the same problem, i think there is something wrong i dont know what, started from scratch and still the same error

Was there any headway with this? I’ve got the same thing- ./env doesn’t seem to be there.

Something to be aware of: If you find you must run as root - or if any bench commands only run on sudo - that typically means and invites environment problems.

Best to leave super powers to those who know precisely what they are doing :slight_smile:

I understand that I was likely the root cause. In fact, I can almost guarantee that it is linked back to me running some sudo upgrade and sudo update commands on the root system rather than just going through bench.

That being said, I’m just trying to determine if this is something that can be fixed, or if I have to try to restore/rebuild from scratch. If one ‘oops’ (regardless of size) is enough to render the system doa and make all of the data iffy at best, it’s a bit of a concern as I move forward with full deployment (and heavy reliance).

Luckily, this was during my research and develop (on a production install) stage in preparation to move to my full-on production build, so it would only take a few hours to rebuild from scratch.

Nevermind. The page linked above actually does contain the solution- it’s just spread amongst the various comments about uninstalling/reinstalling mysql/mariadb, etc. Since this page was the most recent to come up when I searched for the ./env/bin/pip not found “root cause” error, I’ll sum up.

Basically I (and you, person who found this) screwed up by sudo updating from root rather than just running bench update. To fix-

From the frappe-bench directory:

bench setup env
./env/bin/pip install -e ./apps/frappe
./env/bin/pip install -e ./apps/erpnext
bench update

This got my system back up. I assume I can now proceed with standard bench update/migrate and/or normal operations. Will update this if further issues are encountered.

2 Likes

Okay. Follow up.

It actually looks like I didn’t break anything due to tossing around sudo root updates as previously speculated. Rather, this entire thing was caused by one simple thing it would seem.

WHAT HAPPENED TO ME:

After seeing a few mentions here and there about migrating to python3, I saw a few posts… somewhere?.. on here that mentioned it was performed with:

bench migrate-env **python_3.5/6_**    <<<WRONG

Instead of:

bench migrate-env python3            <<<CORRECT

If you run that, with either “python3.6” or “python3.5”, it prepares for the update by backing up/archiving the python2.7 env (which I never quite figured out how to restore, but that’s probably just a noob mistake), then discovers that the folder, etc. doesn’t exist and errors out resulting in there not being any env mounted/present/whatever. So, if you go and look, and find the correct migrate command, it doesn’t work now and you end up screaming at your screen the 4hrs. Or more. But let’s go with 4 hrs.

So anyway. Yeah. Follow the latest and largest migrate threads (currently… this one?).

1 Like

bench setup env solve the problem