Errors with bench init

Details are posted here: bench init frappe-bench fails! · Issue #5161 · frappe/erpnext · GitHub

Alpine Linux 3.3 with wkhtmltopdf from edge repo.

Share, Python version, and all steps you followed.

$ python -V
Python 2.7.11

The steps followed are in the link in github. However:

and

@zenny
As your OS is not standardly supported by bench installer tool, I might need some more details.
can you post your shell screen history / output? enclose output inside code block it will be helpful.

I think its memory issue, you should, at least, have more than 1 GB of RAM with the appropriate amount of swap partition if on low memory system.

@yashodhan: It is not a resource issue as it has 8GB RAM allocated.

$ free -m
total used free shared buffers cached
Mem: 8005 1363 6642 0 43 1088
-/+ buffers/cache: 231 7774
Swap: 382 0 382

I posted all outputs in the github issue page as posted earlier. However, for your convenience I pasted at Recent snippets | Pastebin | Geany

Ok,

$ source ./home/zenny/frappe-bench/env/bin/activate
$ pip install mysql-python==1.2.5 --upgrade

then try initializing frappe bench, it seems you have failed to install dependencies before initializing frappe.

pip install part didn’t work because of lack of gcc in alpine. Alpine has musl instead of glibc, instead. That could be the reason?!

Log at: New snippet | Pastebin | Geany

UPDATE: Therefore, installed gcc and still no go.

Log at: New snippet | Pastebin | Geany

Try

cd frappe-bench
./env/bin/pip install -e frappe-bench/apps/frappe

And see what error appears.

@anand: Here is the output:

microfrappe1:~/frappe-bench$ source ./home/zenny/frappe-bench/env/bin/activate
ash: source: can’t open ‘./home/zenny/frappe-bench/env/bin/activate’
microfrappe1:~/frappe-bench$ source /home/zenny/frappe-bench/env/bin/activate
(env) microfrappe1:~/frappe-bench$ ./env/bin/pip install -e frappe-bench/apps/frappe
frappe-bench/apps/frappe should either be a path to a local project or a VCS url beginning with svn+, git+, hg+, or bzr+

I think you should start over. You seem to have faced errors at the start and instead of solving them, proceeded to the next step directly

Restarted the entire process as a ‘frappe’ user. Still not a thing changed! Huh…!

cd frappe-bench
./env/bin/pip install mysql-python==1.2.5 --upgrade

gave me http://picpaste.com/kgMR82Cx.png

“No matching distribution found for mysql-python==1.2.5”

microfrappe1:~$ sudo pip2 install -e bench-repo

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

[sudo] password for frappe:
Obtaining file:///home/frappe/bench-repo
Requirement already satisfied (use --upgrade to upgrade): Click in /usr/lib/python2.7/site-packages (from bench==2.0.0)
Requirement already satisfied (use --upgrade to upgrade): jinja2 in /usr/lib/python2.7/site-packages (from bench==2.0.0)
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /usr/lib/python2.7/site-packages (from bench==2.0.0)
Requirement already satisfied (use --upgrade to upgrade): requests in /usr/lib/python2.7/site-packages (from bench==2.0.0)
Requirement already satisfied (use --upgrade to upgrade): honcho in /usr/lib/python2.7/site-packages (from bench==2.0.0)
Requirement already satisfied (use --upgrade to upgrade): semantic-version in /usr/lib/python2.7/site-packages (from bench==2.0.0)
Requirement already satisfied (use --upgrade to upgrade): GitPython==0.3.2.rc1 in /usr/lib/python2.7/site-packages (from bench==2.0.0)
Requirement already satisfied (use --upgrade to upgrade): MarkupSafe in /usr/lib/python2.7/site-packages (from jinja2->bench==2.0.0)
Requirement already satisfied (use --upgrade to upgrade): gitdb>=0.5.1 in /usr/lib/python2.7/site-packages (from GitPython==0.3.2.rc1->bench==2.0.0)
Requirement already satisfied (use --upgrade to upgrade): smmap>=0.8.5 in /usr/lib/python2.7/site-packages (from gitdb>=0.5.1->GitPython==0.3.2.rc1->bench==2.0.0)
Installing collected packages: bench
Running setup.py develop for bench
Successfully installed bench-2.0.0
microfrappe1:~$ bench init frappe-bench
Already using interpreter /usr/bin/python
INFO:bench.app:getting app frappe
Cloning into ‘frappe’…
remote: Counting objects: 1591, done.
remote: Compressing objects: 100% (1466/1466), done.
remote: Total 1591 (delta 197), reused 651 (delta 75), pack-reused 0
Receiving objects: 100% (1591/1591), 9.80 MiB | 1.22 MiB/s, done.
Resolving deltas: 100% (197/197), done.
Checking connectivity… done.
installing frappe
INFO:bench.app:installing frappe
Command “/home/frappe/frappe-bench/env/bin/python -u -c “import setuptools, tokenize;file=‘/tmp/pip-build-QtWxZL/mysql-python/setup.py’;exec(compile(getattr(tokenize, ‘open’, open)(file).read().replace(‘\r\n’, ‘\n’), file, ‘exec’))” install --record /tmp/pip-r6zMYx-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/frappe/frappe-bench/env/include/site/python2.7/mysql-python” failed with error code 1 in /tmp/pip-build-QtWxZL/mysql-python/
Traceback (most recent call last):
File “/usr/bin/bench”, line 9, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/home/frappe/bench-repo/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/usr/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/usr/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/frappe/bench-repo/bench/commands/make.py”, line 17, in init
no_auto_update=no_auto_update, frappe_path=frappe_path, frappe_branch=frappe_branch, verbose=verbose)
File “/home/frappe/bench-repo/bench/utils.py”, line 62, in init
get_app(‘frappe’, frappe_path, branch=frappe_branch, bench=path, build_asset_files=False, verbose=verbose)
File “/home/frappe/bench-repo/bench/app.py”, line 56, in get_app
install_app(app, bench=bench, verbose=verbose)
File “/home/frappe/bench-repo/bench/app.py”, line 82, in install_app
find_links=find_links))
File “/home/frappe/bench-repo/bench/utils.py”, line 99, in exec_cmd
raise CommandFailedError(cmd)
bench.utils.CommandFailedError: frappe-bench/env/bin/pip install -q -e frappe-bench/apps/frappe
microfrappe1:~$ source ./home/frappe/frappe-bench/env/bin/activate
ash: source: can’t open ‘./home/frappe/frappe-bench/env/bin/activate’
microfrappe1:~$ source /home/frappe/frappe-bench/env/bin/activate
(env) microfrappe1:~$ pip install mysql-python==1.2.5 --upgrade
Collecting mysql-python==1.2.5
Using cached MySQL-python-1.2.5.zip
Building wheels for collected packages: mysql-python
Running setup.py bdist_wheel for mysql-python … error
Complete output from command /home/frappe/frappe-bench/env/bin/python -u -c “import setuptools, tokenize;file=‘/tmp/pip-build-z_wNkT/mysql-python/setup.py’;exec(compile(getattr(tokenize, ‘open’, open)(file).read().replace(‘\r\n’, ‘\n’), file, ‘exec’))” bdist_wheel -d /tmp/tmp5fYju2pip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying mysql_exceptions.py → build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/init.py → build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py → build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py → build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py → build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/release.py → build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/times.py → build/lib.linux-x86_64-2.7/MySQLdb
creating build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/init.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
running build_ext
building 'mysql’ extension
creating build/temp.linux-x86_64-2.7
gcc -fno-strict-aliasing -Os -fomit-frame-pointer -DNDEBUG -Os -fomit-frame-pointer -fPIC -Dversion_info=(1,2,5,‘final’,1) -D__version
=1.2.5 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o
_mysql.c:29:20: fatal error: Python.h: No such file or directory
#include “Python.h”

Googling the error got me: django - can't pip install mysql-python - Stack Overflow

I have all dependencies installed, fyi.

(env) frappe@microfrappe1:[~/frappe-bench]$ apk info | grep python
python
python-dev
(env) frappe@microfrappe1:[~/frappe-bench]$ apk info | grep mysql
py-mysqldb
(env) frappe@microfrappe1:[~/frappe-bench]$ apk info | grep mariadb
mariadb-common
mariadb
mariadb-client
mariadb-libs
mariadb-dev

Yet the error persists, even in new instances of bench.

frappe@microfrappe1:[~]$ source /home/frappe/frappe-bench/env/bin/activate
(env) frappe@microfrappe1:[~]$ cd frappe-bench/
(env) frappe@microfrappe1:[~/frappe-bench]$ ./env/bin/pip install mysql-python==1.2.5 --upgrade
Collecting mysql-python==1.2.5
Using cached MySQL-python-1.2.5.zip
Building wheels for collected packages: mysql-python
Running setup.py bdist_wheel for mysql-python … error
Complete output from command /home/frappe/frappe-bench/env/bin/python -u -c “import setuptools, tokenize;file=‘/tmp/pip-build-Xs0cXr/mysql-python/setup.py’;exec(compile(getattr(tokenize, ‘open’, open)(file).read().replace(‘\r\n’, ‘\n’), file, ‘exec’))” bdist_wheel -d /tmp/tmpM2qVAEpip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying mysql_exceptions.py → build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/init.py → build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py → build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py → build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py → build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/release.py → build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/times.py → build/lib.linux-x86_64-2.7/MySQLdb
creating build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/init.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
running build_ext
building 'mysql’ extension
creating build/temp.linux-x86_64-2.7
gcc -fno-strict-aliasing -Os -fomit-frame-pointer -DNDEBUG -Os -fomit-frame-pointer -fPIC -Dversion_info=(1,2,5,‘final’,1) -D__version
=1.2.5 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o
In file included from _mysql.c:29:0:
/usr/include/python2.7/Python.h:19:20: fatal error: limits.h: No such file or directory
compilation terminated.
error: command ‘gcc’ failed with exit status 1


Failed building wheel for mysql-python
Running setup.py clean for mysql-python
Failed to build mysql-python
Installing collected packages: mysql-python
Running setup.py install for mysql-python … error
Complete output from command /home/frappe/frappe-bench/env/bin/python -u -c “import setuptools, tokenize;file=‘/tmp/pip-build-Xs0cXr/mysql-python/setup.py’;exec(compile(getattr(tokenize, ‘open’, open)(file).read().replace(‘\r\n’, ‘\n’), file, ‘exec’))” install --record /tmp/pip-PkZLe8-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/frappe/frappe-bench/env/include/site/python2.7/mysql-python:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying mysql_exceptions.py → build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/init.py → build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py → build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py → build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py → build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/release.py → build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/times.py → build/lib.linux-x86_64-2.7/MySQLdb
creating build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/init.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py → build/lib.linux-x86_64-2.7/MySQLdb/constants
running build_ext
building 'mysql’ extension
creating build/temp.linux-x86_64-2.7
gcc -fno-strict-aliasing -Os -fomit-frame-pointer -DNDEBUG -Os -fomit-frame-pointer -fPIC -Dversion_info=(1,2,5,‘final’,1) -D__version
=1.2.5 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o
In file included from _mysql.c:29:0:
/usr/include/python2.7/Python.h:19:20: fatal error: limits.h: No such file or directory
compilation terminated.
error: command ‘gcc’ failed with exit status 1

----------------------------------------

Command “/home/frappe/frappe-bench/env/bin/python -u -c “import setuptools, tokenize;file=‘/tmp/pip-build-Xs0cXr/mysql-python/setup.py’;exec(compile(getattr(tokenize, ‘open’, open)(file).read().replace(‘\r\n’, ‘\n’), file, ‘exec’))” install --record /tmp/pip-PkZLe8-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/frappe/frappe-bench/env/include/site/python2.7/mysql-python” failed with error code 1 in /tmp/pip-build-Xs0cXr/mysql-python/

bump!

This seems to be very bug pertaining to alpinelinux. It is important in the pretext that docker is moving officially to alpinelinux (https://www.brianchristner.io/docker-is-moving-to-alpine-linux/).

https://github.com/frappe/erpnext/issues/5161#issuecomment-207822979

@zenny I have no idea why this is failing. You will have to figure this out using the alpine linux forums, mysql-python issues list or stackoverflow.

This is the first I heard of Alpine Linux. Even mariadb officially does not support it right now:
Download MariaDB Server - MariaDB.org. So you can understand our helplessness too :frowning:

I think what is missing is libmariadbclient-dev which is a mariadb equivalent of libmysqlclient-dev. This is required for mysql-python. Try installing this. It might solve the problem.

@anand I guess it there is no such package called libmariadbclient-dev in alpine. I guess mariadb-dev package contains the dev libs for the client, too.

root@microfrappe1:[~]# apk search mariadb
mariadb-bench-10.1.12-r1
mariadb-10.1.12-r1
mariadb-doc-10.1.12-r1
mariadb-libs-10.1.12-r1
mariadb-client-10.1.12-r1
mariadb-dev-10.1.12-r1
acf-mariadb-0.2.0-r1
mariadb-test-10.1.12-r1
mariadb-common-10.1.12-r1

mariadb per se works fine in alpine.

Agreed, but mysql-python which is required doesn’t get installed.

Try installing mysql-python using alpine’s installer instead of using pip.

@anand If I am not wrong, I feel you missed something about which i have posted in one of the replies above.

In alpine, mysql-python is called py-mysqldb which is already installed.

So this has to do with something else, I guess.

@zenny I am not sure of this. There’s another library called pymysql - GitHub - PyMySQL/PyMySQL: Pure Python MySQL Client. Alpine might be getting this library.

GitHub - PyMySQL/PyMySQL: Pure Python MySQL Client This seems to be a client, not a replacement of mysql-python. Just guessing.