Bench update fails: /bin/sh: 1: ./env/bin/pip: not found

I am having issues updating. Please see below log

frappe@erp:~/frappe-bench$ cd apps/erpnext/
frappe@erp:~/frappe-bench/apps/erpnext$ git reset --hard
Checking out files: 100% (4493/4493), done.
HEAD is now at 245c2e8 Merge branch 'hotfix'
frappe@erp:~/frappe-bench/apps/erpnext$ cd ../..
frappe@erp:~/frappe-bench$ bench update
INFO:bench.utils:updating bench
Already up-to-date.
/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
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench==0.1', 'console_scripts', 'bench')()
  File "/home/frappe/bench-repo/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-repo/bench/commands/update.py", line 62, in update
    _update(pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, upgrade, force=force, reset=reset)
  File "/home/frappe/bench-repo/bench/commands/update.py", line 75, in _update
    before_update(bench_path=bench_path, requirements=requirements)
  File "/home/frappe/bench-repo/bench/utils.py", line 632, in before_update
    validate_pillow_dependencies(bench_path, requirements)
  File "/home/frappe/bench-repo/bench/utils.py", line 640, in validate_pillow_dependencies
    exec_cmd("{pip} install Pillow".format(pip=pip))
  File "/home/frappe/bench-repo/bench/utils.py", line 127, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: ./env/bin/pip install Pillow
frappe@erp:~/frappe-bench$ 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
[sudo] password for frappe:
Reading package lists... Done
Building dependency tree
Reading state information... Done
libjpeg8-dev is already the newest version.
python-tk is already the newest version.
tcl8.6-dev is already the newest version.
tk8.6-dev is already the newest version.
zlib1g-dev is already the newest version.
libfreetype6-dev is already the newest version.
liblcms2-dev is already the newest version.
libtiff5-dev is already the newest version.
libwebp-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 275 not upgraded.

Hi please execute bench update again after running the command

I have run bench update but I have same error

How did you install your python before? Do you have python pre installed in your server at that time you first setup your server? Or you installed it by your own. Because as far as I can remember, I encountered somewhat similar to this error when I installed python libs wrongly

This seems to be a problem!

Hello,
This is a working ERPNEXT instance.
I installed the it using the Easy Install Step. But It seems I made a Mistake using root user.
I tried to do some update but this time with frappe user, but I discovered there was file permission issue.
I ran the Linux command: “Sudo chown -R $USER:$USER bench-repo frappe-bench” to reset the permission to frappe user.

This caused so git problems, but I did a hard reset.

I tried bench update, but it failed.

How can I repair this,
On my Virtual Machine local instance, I noticed there is a file “pip” inside frappe-bench/env/bin/pip but It is missing on the Live server.
Should I copy this file over?
Are there some other files that could be missing too

When you’ll execute bench update it’ll also upgrade the pip in virtual env.
if there is version mismatch in /bin/pip and /home/frappe/frappe-bench/env/bin/pip then you’ll get this error while bench update.

Solution:
Try to upgrade pip manually:
Step 1 (System Environment) execute :
sudo /bin/pip install pip --upgrade
Step 2 (Python virtual Environment) Inside frappe-bench execute :
./env/bin/pip install pip --upgrade

Now again try to update your bench.

1 Like

I have tried this you solution but it did not work.
For Step 1: I run this command to see where pip is located on the system

frappe@erp:~$ pip show pip
Name: pip
Version: 9.0.1
Summary: The PyPA recommended tool for installing Python packages.
Home-page: https://pip.pypa.io/
Author: The pip developers
Author-email: python-virtualenv@groups.google.com
License: MIT
Location: /usr/local/lib/python2.7/dist-packages
Requires:

Then this to for update: pip install pip --upgrade

frappe@erp:~$ pip install pip --upgrade
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Requirement already up-to-date: pip in /usr/local/lib/python2.7/dist-packages

STEP 2: Frappe-bench Directory Python Virtual

frappe@erp:~/frappe-bench$ ./env/bin/pip install pip --upgrade
bash: ./env/bin/pip: No such file or directory

Actually the pip fill is missing on the /home/frappe/frappe-bench/env/bin/

Ohkay got it!

Reason why pip doesn’t exists inside virtual enviroment:
When you execute bench update, it automatically update your pip, but before updating its always required uninstalled your older pip version.Here unfortunately your pip version haven’t update and older has uninstalled.

So you’ve to install it manually in virtual environment:
Execute < ./env/bin/easy_install pip > inside frappe directory and try to upgrade pip in virtual environment and then try again with bench update to update bench.

2 Likes

Hello,
Thanks we are definately having some progress now. But bench update was unsuccessful. see my log

frappe@erp:~/frappe-bench$ bench update
INFO:bench.utils:updating bench
Already up-to-date.
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages
INFO:bench.app:pulling frappe
From https://github.com/frappe/frappe
 * branch            master     -> FETCH_HEAD
Already up-to-date.
INFO:bench.app:pulling erpnext
From https://github.com/frappe/erpnext
 * branch            master     -> FETCH_HEAD
Already up-to-date.
INFO:bench.app:pulling shopping_cart
From https://github.com/frappe/shopping-cart
 * branch            master     -> FETCH_HEAD
Already up-to-date.
Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages
/home/frappe/frappe-bench/env/bin/python: /home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/_mysql.so: wrong ELF class: ELFCLASS32

This mys[quote=“kdevloper, post:11, topic:19810, full:true”]
Hello,
Thanks we are definately having some progress now. But bench update was unsuccessful. see my log

frappe@erp:~/frappe-bench$ bench update
INFO:bench.utils:updating bench
Already up-to-date.
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages
INFO:bench.app:pulling frappe
From https://github.com/frappe/frappe
 * branch            master     -> FETCH_HEAD
Already up-to-date.
INFO:bench.app:pulling erpnext
From https://github.com/frappe/erpnext
 * branch            master     -> FETCH_HEAD
Already up-to-date.
INFO:bench.app:pulling shopping_cart
From https://github.com/frappe/shopping-cart
 * branch            master     -> FETCH_HEAD
Already up-to-date.
Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages
/home/frappe/frappe-bench/env/bin/python: /home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/_mysql.so: wrong ELF class: ELFCLASS32

[/quote]

This is currently mysql version:

frappe@erp:~/frappe-bench$ mysql --version
mysql  Ver 15.1 Distrib 5.5.42-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

I have Uninstalled Mysql inside the env and reinstalled it.

frappe@erp:~/frappe-bench$ ./env/bin/pip uninstall MySql-python
Successfully uninstalled MySQL-python-1.2.5
frappe@erp:~/frappe-bench$ ./env/bin/pip install MySql-python
Collecting MySql-python
Installing collected packages: MySql-python
Successfully installed MySql-python-1.2.5

Run Bench update, But I now get a new type or error

frappe@erp:~/frappe-bench$ bench update
INFO:bench.utils:updating bench
Already up-to-date.
remote: Counting objects: 64, done.
remote: Total 64 (delta 51), reused 51 (delta 51), pack-reused 13
Unpacking objects: 100% (64/64), done.
From https://github.com/frappe/frappe
   0a2edc9..e329962  develop    -> upstream/develop
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages
INFO:bench.app:pulling frappe
From https://github.com/frappe/frappe
 * branch            master     -> FETCH_HEAD
Already up-to-date.
INFO:bench.app:pulling erpnext
From https://github.com/frappe/erpnext
 * branch            master     -> FETCH_HEAD
Already up-to-date.
INFO:bench.app:pulling shopping_cart
From https://github.com/frappe/shopping-cart
 * branch            master     -> FETCH_HEAD
Already up-to-date.
/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS                      is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see h                     ttps://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring                      SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwar                     ning.
  InsecurePlatformWarning
Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages
/home/frappe/frappe-bench/env/bin/python: /home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/PIL/_imaging.so: wrong ELF class: ELFCLASS32
frappe@erp:~/frappe-bench$

I renamed(backup) the env folder
Then executed bench setup env
Then bench update
Here is my present error:

frappe@erp:~/frappe-bench$ bench update
INFO:bench.utils:updating bench
Already up-to-date.
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages
Requirement already satisfied: olefile in ./env/lib/python2.7/site-packages (from Pillow)
INFO:bench.app:pulling frappe
From https://github.com/frappe/frappe
 * branch            master     -> FETCH_HEAD
Already up-to-date.
INFO:bench.app:pulling erpnext
From https://github.com/frappe/erpnext
 * branch            master     -> FETCH_HEAD
Already up-to-date.
INFO:bench.app:pulling shopping_cart
From https://github.com/frappe/shopping-cart
 * branch            master     -> FETCH_HEAD
Already up-to-date.
Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-hOpk8Q/frappe/
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench==0.1', 'console_scripts', 'bench')()
  File "/home/frappe/bench-repo/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-repo/bench/commands/update.py", line 62, in update
    _update(pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, upgrade, force=force, reset=reset)
  File "/home/frappe/bench-repo/bench/commands/update.py", line 81, in _update
    update_requirements(bench_path=bench_path)
  File "/home/frappe/bench-repo/bench/utils.py", line 375, in update_requirements
    install_requirements(pip, req_file)
  File "/home/frappe/bench-repo/bench/utils.py", line 379, in install_requirements
    exec_cmd("{pip} install -q -r {req_file}".format(pip=pip, req_file=req_file))
  File "/home/frappe/bench-repo/bench/utils.py", line 127, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: ./env/bin/pip install -q -r ./apps/shopping_cart/requirements.txt
frappe@erp:~/frappe-bench$ ./env/bin/pip install mysql-python
Requirement already satisfied: mysql-python in ./env/lib/python2.7/site-packages
frappe@erp:~/frappe-bench$ ./env/bin/pip install -q -r ./apps/shopping_cart/requirements.txt
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-x2octS/frappe/

Its Architecture related error.
you are trying to install 32 bit lib on your 64 bit Operation System.

Which type of ERPNext setup are you using ?
a) Virtual Image
b) Or trying to install on Linux using sudo python setup.py --user frappe --production or --develop .

b) Ubuntu 14 production

After re creating env as above
I have solved this problem. Using the following command

./env/bin/easy_install mysql-python

./env/bin/pip install -e ./apps/frappe
./env/bin/pip install -e ./apps/erpnext
./env/bin/pip install -e ./apps/shopping_cart

Then bench update

Resolved
Thanks everyone

1 Like

This topic was automatically closed after 24 hours. New replies are no longer allowed.