Python3 and MySQL-python

I’m facing a terminal error on frappe init using python3 on mac that I can’t quite figure out. frappe_io seems to expect MySQL-python, but as I understand it that library isn’t available for python3. Any tips on how to proceed?

installing frappe_ioxxxxxx frappe_io
INFO:bench.utils:frappe-bench/env/bin/pip install -q  -e frappe-bench/apps/frappe_io --no-cache-dir
Command "python egg_info" failed with error code 1 in /private/var/folders/t9/7z0p020138s20gj3ymh069f00000gp/T/pip-install-m1ylw1dd/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/xxxxxx/bench-repo/bench/", line 40, in cli
  File "/Users/xxxxxx/Library/Python/3.7/lib/python/site-packages/click/", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/Users/xxxxxx/Library/Python/3.7/lib/python/site-packages/click/", line 717, in main
    rv = self.invoke(ctx)
  File "/Users/xxxxxx/Library/Python/3.7/lib/python/site-packages/click/", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/xxxxxx/Library/Python/3.7/lib/python/site-packages/click/", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/xxxxxx/Library/Python/3.7/lib/python/site-packages/click/", line 555, in invoke
    return callback(*args, **kwargs)
  File "/Users/xxxxxx/bench-repo/bench/commands/", line 30, in init
    python 		 = python)
  File "/Users/xxxxxx/bench-repo/bench/", line 75, in init
    get_app(frappe_path, branch=frappe_branch, bench_path=path, build_asset_files=False, verbose=verbose)
  File "/Users/xxxxxx/bench-repo/bench/", line 141, in get_app
    branch= 'master', postprocess = False)
  File "/Users/xxxxxx/bench-repo/bench/", line 135, in get_app
    install_app(app=app_name, bench_path=bench_path, verbose=verbose)
  File "/Users/xxxxxx/bench-repo/bench/", line 179, in install_app
  File "/Users/xxxxxx/bench-repo/bench/", line 159, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: frappe-bench/env/bin/pip install -q  -e frappe-bench/apps/frappe_io --no-cache-dir

Hello @peterg

Check your whether there is something wrong with the codebase.

1 Like

Thanks for responding!

Any tips on what I should be looking for? I re-obtained and re-installed the bench-repo thinking that might be the problem, but no luck

Here’s what my bench-repo/ looks like:

computername:bench-repo username$ cat
from setuptools import setup, find_packages
import re, ast

# get version from __version__ variable in bench/
_version_re = re.compile(r'__version__\s+=\s+(.*)')

with open('requirements.txt') as f:
	install_requires ='\n')

with open('bench/', 'rb') as f:
	version = str(ast.literal_eval('utf-8')).group(1)))

	description='Metadata driven, full-stack web framework',
	author='Frappe Technologies',

and here’s my version output

computername:bench-repo username$ bench --version

try this

1 Like

Thanks Prashant, that (plus a ton of manual installing in pip) got me a bit farther. Now, I’m facing an invalid syntax error:

17:46:45 watch.1          | yarn run v1.10.1
17:46:46 watch.1          | $ node rollup/watch.js
17:46:46 web.1            | Traceback (most recent call last):
17:46:46 web.1            |   File "/Users/xxxxxx/frappe-bench/apps/frappe/frappe/utils/", line 66, in get_app_commands
17:46:46 web.1            |     app_command_module = importlib.import_module(app + '.commands')
17:46:46 web.1            |   File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/", line 127, in import_module
17:46:46 web.1            |     return _bootstrap._gcd_import(name[level:], package, level)
17:46:46 web.1            |   File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
17:46:46 web.1            |   File "<frozen importlib._bootstrap>", line 983, in _find_and_load
17:46:46 web.1            |   File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
17:46:46 web.1            |   File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
17:46:46 web.1            |   File "<frozen importlib._bootstrap_external>", line 728, in exec_module
17:46:46 web.1            |   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
17:46:46 web.1            |   File "/Users/xxxxxx/frappe-bench/apps/frappe/frappe/commands/", line 83, in <module>
17:46:46 web.1            |     commands = get_commands()
17:46:46 web.1            |   File "/Users/xxxxxx/frappe-bench/apps/frappe/frappe/commands/", line 77, in get_commands
17:46:46 web.1            |     from .site import commands as site_commands
17:46:46 web.1            |   File "/Users/xxxxxx/frappe-bench/apps/frappe/frappe/commands/", line 8, in <module>
17:46:46 web.1            |     from frappe.limits import update_limits, get_limits
17:46:46 web.1            |   File "/Users/xxxxxx/frappe-bench/apps/frappe/frappe/", line 5, in <module>
17:46:46 web.1            |     from frappe.installer import update_site_config
17:46:46 web.1            |   File "/Users/xxxxxx/frappe-bench/apps/frappe/frappe/", line 20, in <module>
17:46:46 web.1            |     from import render
17:46:46 web.1            |   File "/Users/xxxxxx/frappe-bench/apps/frappe/frappe/website/", line 7, in <module>
17:46:46 web.1            |     import frappe.sessions
17:46:46 web.1            |   File "/Users/xxxxxx/frappe-bench/apps/frappe/frappe/", line 18, in <module>
17:46:46 web.1            |     from frappe.utils.change_log import get_change_log
17:46:46 web.1            |   File "/Users/xxxxxx/frappe-bench/apps/frappe/frappe/utils/", line 14, in <module>
17:46:46 web.1            |     import git
17:46:46 web.1            |   File "/usr/local/lib/python3.7/site-packages/git/", line 33, in <module>
17:46:46 web.1            |     from git.config import GitConfigParser
17:46:46 web.1            |   File "/usr/local/lib/python3.7/site-packages/git/", line 190
17:46:46 web.1            |     except IOError, e:
17:46:46 web.1            |                   ^
17:46:46 web.1            | SyntaxError: invalid syntax

I suspect this has something to do with my GitPython verison. Bench won’t run without version, but if that’s installed Frappe issues a warning that it needs version 2.1.11. Any sense of how I might proceed?

I managed to get the bench to start after manually editing some of the GitPython dependencies in requirements.txt, but when I tried to access the site the setup wizard was entirely borked. I suspect the installation really never completed properly.

I’m still stuck on the original error with frappe init. Bench seems to be trying to install MySQL-python in the process of setting up frappe_io, but that library doesn’t exist for python3. The only reference I can find to MySQL-python is in bench-repo/playbooks/macosx.yml, but even if I comment it out bench still tries to install it during the frappe_io setup process.

Not sure what else to do at this point.

The problem here, I’ve since discovered, is that frappe_io is trying to install a completely unrelated application for some reason.

Specifically, it’s trying to pull from GitHub - grafos-ml/frappe: Recommendations Serving Engine using python, which is a recommendation system backend with absolutely no relationship to the Frappe we know and love.

I don’t understand pip well enough to know why it’s looking for this grafos-ml package instead of the frappe I want, and I don’t have any idea how to fix it. I’ve been stuck on this for two weeks now, and it has completely stymied my dev system :frowning:

1 Like