Installation error on mac (manually)

Hi,

I am trying install manually on mac based on the instruction on this page. [https://github.com/frappe/bench](https://github.com/frappe/bench)
bench init frappe-bench && cd frappe-bench throws this error below.

Command "/Users/noussh/erpnext/frappe-bench/env/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/zm/g5x778jn37b6vz96vs6tzdb40000gn/T/pip-build-MYlP2H/mysql-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/zm/g5x778jn37b6vz96vs6tzdb40000gn/T/pip-uyIF6y-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/noussh/erpnext/frappe-bench/env/bin/../include/site/python2.7/mysql-python" failed with error code 1 in /private/var/folders/zm/g5x778jn37b6vz96vs6tzdb40000gn/T/pip-build-MYlP2H/mysql-python/
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/Users/noussh/erpnext/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/Users/noussh/erpnext/bench-repo/bench/commands/make.py", line 19, in init
    verbose=verbose, clone_from=clone_from)
  File "/Users/noussh/erpnext/bench-repo/bench/utils.py", line 56, in init
    get_app(frappe_path, branch=frappe_branch, bench_path=path, build_asset_files=False, verbose=verbose)
  File "/Users/noussh/erpnext/bench-repo/bench/app.py", line 73, in get_app
    install_app(app=app_name, bench_path=bench_path, verbose=verbose)
  File "/Users/noussh/erpnext/bench-repo/bench/app.py", line 103, in install_app
    find_links=find_links))
  File "/Users/noussh/erpnext/bench-repo/bench/utils.py", line 127, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: frappe-bench/env/bin/pip install -q  -e frappe-bench/apps/frappe

Can you share the trace of this:

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

Hi,

I get this error after running ./env/bin/pip install -q -e frappe-bench/apps/frappe inside frappe-bench folder.

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’m getting the same error. I previously installed frappe bench on my mac and it worked fine. I created a new bench for some different project and i’m getting the same error.

Is there a solution to this? I am also encountering a similar issue. Here is the full terminal output:

Arsyads-iMac-2:frappe arsyad$ sudo pip install -e bench-repo
The directory '/Users/arsyad/Library/Caches/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 '/Users/arsyad/Library/Caches/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.
Obtaining file:///Users/arsyad/Documents/Arsyad/work/python/frappe/bench-repo
Requirement already satisfied: Click in /usr/local/lib/python2.7/site-packages (from bench==4.1.0)
Requirement already satisfied: jinja2 in /usr/local/lib/python2.7/site-packages (from bench==4.1.0)
Requirement already satisfied: virtualenv in /usr/local/lib/python2.7/site-packages (from bench==4.1.0)
Requirement already satisfied: requests in /usr/local/lib/python2.7/site-packages (from bench==4.1.0)
Requirement already satisfied: honcho in /usr/local/lib/python2.7/site-packages (from bench==4.1.0)
Requirement already satisfied: psutil in /usr/local/lib/python2.7/site-packages (from bench==4.1.0)
Requirement already satisfied: python-crontab in /usr/local/lib/python2.7/site-packages (from bench==4.1.0)
Requirement already satisfied: semantic_version in /usr/local/lib/python2.7/site-packages (from bench==4.1.0)
Requirement already satisfied: GitPython==0.3.2.rc1 in /usr/local/lib/python2.7/site-packages (from bench==4.1.0)
Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib/python2.7/site-packages (from jinja2->bench==4.1.0)
Requirement already satisfied: python-dateutil in /usr/local/lib/python2.7/site-packages (from python-crontab->bench==4.1.0)
Requirement already satisfied: gitdb>=0.5.1 in /usr/local/lib/python2.7/site-packages (from GitPython==0.3.2.rc1->bench==4.1.0)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python2.7/site-packages (from python-dateutil->python-crontab->bench==4.1.0)
Requirement already satisfied: smmap>=0.8.5 in /usr/local/lib/python2.7/site-packages (from gitdb>=0.5.1->GitPython==0.3.2.rc1->bench==4.1.0)
Installing collected packages: bench
  Found existing installation: bench 4.1.0
    Uninstalling bench-4.1.0:
      Successfully uninstalled bench-4.1.0
  Running setup.py develop for bench
Successfully installed bench
Arsyads-iMac-2:frappe arsyad$ bench init frappe-bench && cd frappe-bench
INFO:bench.utils:virtualenv -q env -p /usr/local/opt/python/bin/python2.7
Already using interpreter /usr/local/opt/python/bin/python2.7
INFO:bench.utils:./env/bin/pip -q install --upgrade pip
INFO:bench.utils:./env/bin/pip -q install wheel
INFO:bench.utils:./env/bin/pip -q install -e git+https://github.com/frappe/python-pdfkit.git#egg=pdfkit
INFO:bench.app:getting app frappe
INFO:bench.utils:git clone https://github.com/frappe/frappe.git   --origin upstream
Cloning into 'frappe'...
remote: Counting objects: 125758, done.
remote: Compressing objects: 100% (84/84), done.
remote: Total 125758 (delta 31), reused 0 (delta 0), pack-reused 125674
Receiving objects: 100% (125758/125758), 95.70 MiB | 4.91 MiB/s, done.
Resolving deltas: 100% (94467/94467), done.
('installing', u'frappe')
INFO:bench.app:installing frappe
INFO:bench.utils:frappe-bench/env/bin/pip install -q  -e frappe-bench/apps/frappe --no-cache-dir
Command "/Users/arsyad/Documents/Arsyad/work/python/frappe/frappe-bench/env/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/p6/yyn74c_d3cb3yppcz1cv_85w0000gn/T/pip-build-fuSHOQ/mysql-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/p6/yyn74c_d3cb3yppcz1cv_85w0000gn/T/pip-pB6eOJ-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/arsyad/Documents/Arsyad/work/python/frappe/frappe-bench/env/bin/../include/site/python2.7/mysql-python" failed with error code 1 in /private/var/folders/p6/yyn74c_d3cb3yppcz1cv_85w0000gn/T/pip-build-fuSHOQ/mysql-python/
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/Users/arsyad/Documents/Arsyad/work/python/frappe/bench-repo/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/Users/arsyad/Documents/Arsyad/work/python/frappe/bench-repo/bench/commands/make.py", line 19, in init
    verbose=verbose, clone_from=clone_from)
  File "/Users/arsyad/Documents/Arsyad/work/python/frappe/bench-repo/bench/utils.py", line 56, in init
    get_app(frappe_path, branch=frappe_branch, bench_path=path, build_asset_files=False, verbose=verbose)
  File "/Users/arsyad/Documents/Arsyad/work/python/frappe/bench-repo/bench/app.py", line 76, in get_app
    install_app(app=app_name, bench_path=bench_path, verbose=verbose)
  File "/Users/arsyad/Documents/Arsyad/work/python/frappe/bench-repo/bench/app.py", line 107, in install_app
    find_links=find_links))
  File "/Users/arsyad/Documents/Arsyad/work/python/frappe/bench-repo/bench/utils.py", line 130, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: frappe-bench/env/bin/pip install -q  -e frappe-bench/apps/frappe --no-cache-dir

And I also ran

./env/bin/pip install -q -e ~/Documents/Arsyad/work/python/frappe/frappe-bench/apps/frappe

And result is
Command "/Users/arsyad/Documents/Arsyad/work/python/frappe/frappe-bench/env/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/p6/yyn74c_d3cb3yppcz1cv_85w0000gn/T/pip-build-fkicED/mysql-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/p6/yyn74c_d3cb3yppcz1cv_85w0000gn/T/pip-3i4MVk-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/arsyad/Documents/Arsyad/work/python/frappe/frappe-bench/env/bin/../include/site/python2.7/mysql-python" failed with error code 1 in /private/var/folders/p6/yyn74c_d3cb3yppcz1cv_85w0000gn/T/pip-build-fkicED/mysql-python/

Also ran:

bench --version
4.1.0

Any help is appreciated!

@darnpunk looks like the issue is mysql-python not installed, this thread might help

1 Like

I have installed mysql-python but now I am getting another error:

Command “python setup.py egg_info” failed with error code 1 in /private/var/folders/p6/yyn74c_d3cb3yppcz1cv_85w0000gn/T/pip-build-o3iS5S/mysql-python/

Also when I run bench mysql it shows Error: No such command “mysql”. I have mariadb installed. Here is my pip list

ansible (2.0.2.0) asn1crypto (0.22.0) bench (4.1.0, /Users/arsyad/Documents/Arsyad/work/python/frappe/bench-repo) cffi (1.10.0) click (6.7) cryptography (1.8.1) enum34 (1.1.6) gitdb (0.6.4) GitPython (0.3.2rc1) honcho (1.0.1) idna (2.5) ipaddress (1.0.18) Jinja2 (2.9.6) MarkupSafe (1.0) meld3 (1.0.2) MySQL-python (1.2.5) paramiko (2.1.2) pbr (3.0.0) pip (9.0.1) psutil (5.2.2) pyasn1 (0.2.3) pycparser (2.17) pycrypto (2.6.1) python-crontab (2.2.0) python-dateutil (2.6.0) PyYAML (3.12) requests (2.13.0) semantic-version (2.6.0) setuptools (32.1.0) six (1.10.0) smmap (0.9.0) stevedore (1.21.0) supervisor (3.3.1) virtualenv (15.1.0) virtualenv-clone (0.2.6) virtualenvwrapper (4.7.2) wheel (0.29.0)
Here is my brew list:

cmake                   
icu4c                   
mariadb                 
node                    
pkg-config              
readline                
sqlite
gdbm                    
libevent               
mysql-connector-c       
openssl                 
python                  
redis

Is there a way to uninstall everything and start again?

Regards,
Arsyad

It is working now. I missed one command which is xcode-select --install. After which I needed to do

brew remove mysql
brew install mariadb

pip uninstall MySQL-python
pip install MySQL-python

After that installing works. I created a new site and set developer_mode = 1. However, during the setup wizard, I noticed that it only asks to setup country, a user and nothing else. And when I go to the Desk, there are only 3 icons. Tools, Email Inbox and Developer.

When I ran the easy install on a VM, the setup wizard asks for more information like Company name, supplier and so on. The Desk on the VM download also had more icons. Is that how it is meant to be?

Hi @darnpunk

bench install-app erpnext under frappe-bench folder

Thanks

I already did that but somehow it doesn’t work. Should I delete the database and the frappe-bench folder and reinstall again?

@darnpunk

bench --site site_name reinstall

Thanks

The command works but I still don’t see the icons (e.g. Accounting, Invoicing etc). I also tried removing erpnext, added back and reinstall the site.

It is as if erpnext app doesn’t get installed. In the terminal this is what I see:

bench --site boxcows.local reinstall
This will wipe your database. Are you sure you want to reinstall? [y/N]: y
Installing frappe...
Updating DocTypes for frappe        : [========================================]
Updating country info               : [========================================]
Set Administrator password: 
Re-enter Administrator password:
*** Scheduler is enabled ***

I was expecting to see “Installing erpnext” as well. Or is that it?

@darnpunk

From the frappe-bench folder you need to do
1. bench get-app erpnext 2. bench --site boxcows.local install-app erpnext

Once you have completed the above you will then commence the setup steps.

However, if you had already began the setup process before installing ERPNext, the system will ask you to reinstall again as it will require a fresh install of frappe.

That works and I can see more steps now during the Setup Wizard. However, I always see “There were errors” messages.

And in console there is only these:

localStorage cleared
desk.min.js:147 Cleared App Cache.
desk.min.js:181 localStorage cleared
Failed to load resource: net::ERR_EMPTY_RESPONSE
jquery.min.js:4 POST http://127.0.0.1:8000/ net::ERR_EMPTY_RESPONSE

I didn’t check the boxes “Create a website” and “Add sample records”.

Do i need to re-install or configure to use domain?

How/what is the configuration like at the moment and yes maybe a reinstall might be better, easier to determine if there are any issues.

I tried with Firefox and I don’t see the ERR_EMPTY_RESPONSE. But after a while of waiting during setup wizard, it just returns message “There were errors”. No messages inside console.

Here are my configurations:

pip list
ansible (2.0.2.0)
appdirs (1.4.3)
asn1crypto (0.22.0)
bench (4.1.0, /Users/arsyad/Documents/Arsyad/work/python/frappe/bench-repo)
cffi (1.10.0)
click (6.7)
cryptography (1.8.1)
enum34 (1.1.6)
gitdb (0.6.4)
GitPython (0.3.2rc1)
honcho (1.0.1)
idna (2.5)
ipaddress (1.0.18)
Jinja2 (2.9.6)
MarkupSafe (1.0)
meld3 (1.0.2)
MySQL-python (1.2.5)
packaging (16.8)
paramiko (2.1.2)
pbr (3.0.0)
pip (9.0.1)
psutil (5.2.2)
pyasn1 (0.2.3)
pycparser (2.17)
pycrypto (2.6.1)
pyparsing (2.2.0)
python-crontab (2.2.0)
python-dateutil (2.6.0)
PyYAML (3.12)
requests (2.13.0)
semantic-version (2.6.0)
setuptools (35.0.1)
six (1.10.0)
smmap (0.9.0)
stevedore (1.21.0)
supervisor (3.3.1)
virtualenv (15.1.0)
virtualenv-clone (0.2.6)
virtualenvwrapper (4.7.2)
wheel (0.29.0)    

brew list --versions
cmake 3.8.0
gdbm 1.13
icu4c 58.2
libevent 2.0.22
mariadb 10.1.22
node 7.9.0
openssl 1.0.2k
pkg-config 0.29.2
python 2.7.13
readline 7.0.3_1
redis 3.0.3
sqlite 3.18.0

bench --version
4.1.0

ERPNext is version 8.0.20
Frappe is version 8.0.27

I have tried to reinstall site, reinstalled bench, reinstalled erpnext, clear cache and restarted my computer. Still somehow cannot get through the setup wizard.

I managed to get it to work. Not sure what happened. I did a bench update again, reinstalled the site again and used Firefox to do the setup wizard. This time round I used localhost instead of 127.0.0.1.

Not sure if that made the difference. Now it works fine and I can see all the icons. :sunglasses:

1 Like

@darnpunk

Hey that’s awesome, glad to know that you have it working.

2 Likes

I am encountering errors again and really need help. Been at the issue for weeks now. Few weeks ago I tried to update my bench but encountered an error which I posted here - Error when running bench update (MacOS)

Since nothing works, I uninstalled mariadb. Here are the commands I ran:

brew remove mariah
brew install mariadb

pip uninstall MySQL-python
pip install MySQL-python

After I ran this, I can’t get the last command done. It shows me the error below:

pip install MySQL-python
Collecting MySQL-python
  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 /usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/p6/yyn74c_d3cb3yppcz1cv_85w0000gn/T/pip-build-CQikXQ/MySQL-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /var/folders/p6/yyn74c_d3cb3yppcz1cv_85w0000gn/T/tmpxEGSa9pip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.12-x86_64-2.7
  copying _mysql_exceptions.py -> build/lib.macosx-10.12-x86_64-2.7
  creating build/lib.macosx-10.12-x86_64-2.7/MySQLdb
  copying MySQLdb/__init__.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb
  copying MySQLdb/converters.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb
  copying MySQLdb/connections.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb
  copying MySQLdb/cursors.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb
  copying MySQLdb/release.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb
  copying MySQLdb/times.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb
  creating build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
  copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
  copying MySQLdb/constants/CR.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
  copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
  copying MySQLdb/constants/ER.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
  copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
  copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
  copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
  running build_ext
  building '_mysql' extension
  creating build/temp.macosx-10.12-x86_64-2.7
  clang -fno-strict-aliasing -fno-common -dynamic -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mariadb/10.2.6/include/mysql -I/usr/local/Cellar/mariadb/10.2.6/include/mysql/.. -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.12-x86_64-2.7/_mysql.o
  In file included from _mysql.c:44:
  /usr/local/Cellar/mariadb/10.2.6/include/mysql/my_config.h:286:11: warning: 'SIZEOF_SIZE_T' macro redefined [-Wmacro-redefined]
    #define SIZEOF_SIZE_T  SIZEOF_LONG
            ^
  /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/include/python2.7/pymacconfig.h:43:17: note: previous definition is here
  #        define SIZEOF_SIZE_T           8
                  ^
  _mysql.c:266:44: warning: unused variable 's' [-Wunused-variable]
          char **cmd_args_c=NULL, **groups_c=NULL, *s;
                                                    ^
  _mysql.c:267:21: warning: unused variable 'groupc' [-Wunused-variable]
          int cmd_argc=0, i, groupc;
                             ^
  _mysql.c:267:18: warning: unused variable 'i' [-Wunused-variable]
          int cmd_argc=0, i, groupc;
                          ^
  _mysql.c:268:53: warning: unused variable 'item' [-Wunused-variable]
          PyObject *cmd_args=NULL, *groups=NULL, *ret=NULL, *item;
                                                             ^
  _mysql.c:351:3: warning: unused label 'finish' [-Wunused-label]
    finish:
    ^~~~~~~
  _mysql.c:267:6: warning: unused variable 'cmd_argc' [-Wunused-variable]
          int cmd_argc=0, i, groupc;
              ^
  _mysql.c:1589:10: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
          if (how < 0 || how >= sizeof(row_converters)) {
              ~~~ ^ ~
  _mysql.c:1943:47: warning: incompatible pointer types passing 'MYSQL *' (aka 'struct st_mysql *') to parameter of type 'MYSQL_RES *' (aka 'struct st_mysql_res *') [-Wincompatible-pointer-types]
          return PyInt_FromLong((long)mysql_num_fields(&(self->connection)));
                                                       ^~~~~~~~~~~~~~~~~~~
  /usr/local/Cellar/mariadb/10.2.6/include/mysql/mysql.h:470:50: note: passing argument to parameter 'res' here
  unsigned int STDCALL mysql_num_fields(MYSQL_RES *res);
                                                   ^
  _mysql.c:2005:42: error: no member named 'reconnect' in 'struct st_mysql'
          if ( reconnect != -1 ) self->connection.reconnect = reconnect;
                                 ~~~~~~~~~~~~~~~~ ^
  _mysql.c:2085:3: error: too few arguments to function call, expected 2, have 1
                  );
                  ^
  /usr/local/Cellar/mariadb/10.2.6/include/mysql/mysql.h:518:1: note: 'mysql_shutdown' declared here
  int             STDCALL mysql_shutdown(MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level);
  ^
  9 warnings and 2 errors generated.
  error: command 'clang' 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 /usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/p6/yyn74c_d3cb3yppcz1cv_85w0000gn/T/pip-build-CQikXQ/MySQL-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/p6/yyn74c_d3cb3yppcz1cv_85w0000gn/T/pip-vDYZ9W-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.12-x86_64-2.7
    copying _mysql_exceptions.py -> build/lib.macosx-10.12-x86_64-2.7
    creating build/lib.macosx-10.12-x86_64-2.7/MySQLdb
    copying MySQLdb/__init__.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb
    copying MySQLdb/converters.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb
    copying MySQLdb/connections.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb
    copying MySQLdb/cursors.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb
    copying MySQLdb/release.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb
    copying MySQLdb/times.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb
    creating build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
    copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
    copying MySQLdb/constants/CR.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
    copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
    copying MySQLdb/constants/ER.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
    copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
    copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
    copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
    running build_ext
    building '_mysql' extension
    creating build/temp.macosx-10.12-x86_64-2.7
    clang -fno-strict-aliasing -fno-common -dynamic -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mariadb/10.2.6/include/mysql -I/usr/local/Cellar/mariadb/10.2.6/include/mysql/.. -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.12-x86_64-2.7/_mysql.o
    In file included from _mysql.c:44:
    /usr/local/Cellar/mariadb/10.2.6/include/mysql/my_config.h:286:11: warning: 'SIZEOF_SIZE_T' macro redefined [-Wmacro-redefined]
      #define SIZEOF_SIZE_T  SIZEOF_LONG
              ^
    /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/include/python2.7/pymacconfig.h:43:17: note: previous definition is here
    #        define SIZEOF_SIZE_T           8
                    ^
    _mysql.c:351:3: warning: unused label 'finish' [-Wunused-label]
      finish:
      ^~~~~~~
    _mysql.c:267:21: warning: unused variable 'groupc' [-Wunused-variable]
            int cmd_argc=0, i, groupc;
                               ^
    _mysql.c:266:44: warning: unused variable 's' [-Wunused-variable]
            char **cmd_args_c=NULL, **groups_c=NULL, *s;
                                                      ^
    _mysql.c:267:6: warning: unused variable 'cmd_argc' [-Wunused-variable]
            int cmd_argc=0, i, groupc;
                ^
    _mysql.c:267:18: warning: unused variable 'i' [-Wunused-variable]
            int cmd_argc=0, i, groupc;
                            ^
    _mysql.c:268:53: warning: unused variable 'item' [-Wunused-variable]
            PyObject *cmd_args=NULL, *groups=NULL, *ret=NULL, *item;
                                                               ^
    _mysql.c:1589:10: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
            if (how < 0 || how >= sizeof(row_converters)) {
                ~~~ ^ ~
    _mysql.c:1943:47: warning: incompatible pointer types passing 'MYSQL *' (aka 'struct st_mysql *') to parameter of type 'MYSQL_RES *' (aka 'struct st_mysql_res *') [-Wincompatible-pointer-types]
            return PyInt_FromLong((long)mysql_num_fields(&(self->connection)));
                                                         ^~~~~~~~~~~~~~~~~~~
    /usr/local/Cellar/mariadb/10.2.6/include/mysql/mysql.h:470:50: note: passing argument to parameter 'res' here
    unsigned int STDCALL mysql_num_fields(MYSQL_RES *res);
                                                     ^
    _mysql.c:2005:42: error: no member named 'reconnect' in 'struct st_mysql'
            if ( reconnect != -1 ) self->connection.reconnect = reconnect;
                                   ~~~~~~~~~~~~~~~~ ^
    _mysql.c:2085:3: error: too few arguments to function call, expected 2, have 1
                    );
                    ^
    /usr/local/Cellar/mariadb/10.2.6/include/mysql/mysql.h:518:1: note: 'mysql_shutdown' declared here
    int             STDCALL mysql_shutdown(MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level);
    ^
    9 warnings and 2 errors generated.
    error: command 'clang' failed with exit status 1
    
    ----------------------------------------
Command "/usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/p6/yyn74c_d3cb3yppcz1cv_85w0000gn/T/pip-build-CQikXQ/MySQL-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/p6/yyn74c_d3cb3yppcz1cv_85w0000gn/T/pip-vDYZ9W-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/p6/yyn74c_d3cb3yppcz1cv_85w0000gn/T/pip-build-CQikXQ/MySQL-python/

It looks as if there is an error in the script. I even tried uninstalling Xcode command line tools and reinstalling it back. And ran the commands again. Still the same error.

I am running MacOS Sierra. Any help is greatly appreciated!

I followed steps listed here to get MySQL-python installed - python - Installing mysqlclient for mariadb on mac os for python3 - Stack Overflow