# Help building editor on Mac, Python 3 required?

**URL:** <https://forum.defold.com/t/help-building-editor-on-mac-python-3-required/67661>\
**Category:** Source Code\
**Created:** [February 26, 2021, 8:10pm UTC](https://forum.defold.com/t/help-building-editor-on-mac-python-3-required/67661 "2021-02-26T20:10:55Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![beldenfox](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/b/35a633/32.png) [@beldenfox](https://forum.defold.com/u/beldenfox)\
**Post date:** [February 26, 2021, 8:10pm UTC](https://forum.defold.com/t/help-building-editor-on-mac-python-3-required/67661/1 "2021-02-26T20:10:55Z")

</div>

I’m trying to build the editor on my Mac running Big Sur. When I try to grab external packages:

```
python2 ./scripts/build.py install_ext --platform=x86_64-darwin --package-path=./mystuff

```

I end up seeing lot of Python syntax errors, samples below.

```
File "build/bdist.macosx-11.2-x86_64/egg/pip/_internal/self_outdated_check.py", line 184
  pip_cmd = f"{sys.executable} -m pip"

File "/Users/martinfox/Programs/defold/defold/tmp/dynamo_home/ext/lib/python/pip-21.0.1-py2.7.egg/pip/_internal/configuration.py", line 167
  raise ConfigurationError(f"No such key - {key}")

```

All of the syntax errors involve f-strings which are a Python 3.6 feature according to my friendly neighborhood search engine (I’m not a Python coder). The Defold documentation states that the required Python version is 2.7.

(Note: I get the same problem if I drop the --platform option. And despite what the documentation shows the build.py script insists on having a --package-path specified.)

How do I get past this? Is the only option to install Python 3.6+?

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [February 27, 2021, 6:42am UTC](https://forum.defold.com/t/help-building-editor-on-mac-python-3-required/67661/2 "2021-02-27T06:42:05Z")

</div>

> [@beldenfox](#):
>
> How do I get past this? Is the only option to install Python 3.6+?

No, don’t install Python 3. Have you followed all of the setup steps?

---

<div class="post-metadata">

**Author:** ![beldenfox](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/b/35a633/32.png) [@beldenfox](https://forum.defold.com/u/beldenfox)\
**Post date:** [February 27, 2021, 5:45pm UTC](https://forum.defold.com/t/help-building-editor-on-mac-python-3-required/67661/3 "2021-02-27T17:45:36Z")

</div>

I believe I’ve followed the setup steps, there aren’t that many before invoking build.py to grab the external packages.

The same errors can be duplicated outside of the Defold build process, just try to install pip.

```
mkdir blah
PYTHONPATH=./blah python -m easy_install -d blah pip

```

On my Mac this command pulls down pip 21.0.1 which dropped support for Python 2 in January of this year.

---

<div class="post-metadata">

**Author:** ![beldenfox](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/b/35a633/32.png) [@beldenfox](https://forum.defold.com/u/beldenfox)\
**Post date:** [February 27, 2021, 6:47pm UTC](https://forum.defold.com/t/help-building-editor-on-mac-python-3-required/67661/4 "2021-02-27T18:47:26Z")

</div>

Worked around this by altering build.py to explicitly request pip 20.3.4

```
run.env_command(self._form_env(), ['python', '-m', 'easy_install', '-q', '-d', join(self.ext, 'lib', 'python'), 'pip==20.3.4'])

```

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [February 28, 2021, 9:15am UTC](https://forum.defold.com/t/help-building-editor-on-mac-python-3-required/67661/5 "2021-02-28T09:15:05Z")

</div>

Ah, good catch!  
Sorry you had to deal with this!  
At least it tells us that we’re being force to move towards python3 soon(-ish).

---

<div class="post-metadata">

**Author:** ![beldenfox](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/b/35a633/32.png) [@beldenfox](https://forum.defold.com/u/beldenfox)\
**Post date:** [February 28, 2021, 10:27pm UTC](https://forum.defold.com/t/help-building-editor-on-mac-python-3-required/67661/6 "2021-02-28T22:27:58Z")

</div>

Do you want me to open an issue on this?

I’ve run into some other problems for which I’ve found work-arounds. In build.py the MacOS SDK is hard-coded to 10.15 and the XcodeDefault is hard-coded at 12.1. Since my Mac and Xcode are both up-to-date I have MacOS11.1 and XcodeDefault12.4 respectively.

In editor/project.clj it calls for codox 0.9.3 which doesn’t seem to be available on clojars. I slammed the version to 0.10.7 to get past this.

I am blocked when I try to build the editor with pre-built engine binaries. In editor/tasks/leiningen/init.clj it slurps in the VERSION file and then issues a git rev-list command using that string. It looks like the VERSION file was bumped up to 1.2.180 but there is no corresponding git tag so the git command fails. I could use some guidance on how to proceed with this one.

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [March 1, 2021, 7:50am UTC](https://forum.defold.com/t/help-building-editor-on-mac-python-3-required/67661/7 "2021-03-01T07:50:20Z")

</div>

Thanks, we already have a ticket for [updating Python](https://github.com/defold/defold/issues/5454).

As for the “work arounds”, it’s currently the way we do this too. Since we update so rarely, and it’s only 2-3 places to change, we haven’t prioritised improving it.  
However, since newcomers often find this tricky, I think we should improve on it, to detect what version is currently installed.

> it slurps in the VERSION

Hmm, that version file should only be used when building stable releases.  
On dev, we have the alpha version, 1.2.180, and that one isn’t released to the stable channel. On the `stable` channel, we have version 1.2.179.  
I think the problem is that it doesn’t pickup the fact that it should run towards the alpha channel.  
I suspect we’ve changed something in our build scripts to fix something, and forgot to upgrade this part.

However, do you require the locally built engine or are you good with using the prebuilt engine?  
If you are ok using the prebuilt version, we recommend using the `editor-dev` branch. That’s where we develop editor-only fixes, (e.g. it’s not file format changes to the engine), and it gets published as soon as we push something to it.

---

<div class="post-metadata">

**Author:** ![beldenfox](https://forum-defold.b-cdn.net/letter_avatar_proxy/v4/letter/b/35a633/32.png) [@beldenfox](https://forum.defold.com/u/beldenfox)\
**Post date:** [March 1, 2021, 4:51pm UTC](https://forum.defold.com/t/help-building-editor-on-mac-python-3-required/67661/8 "2021-03-01T16:51:55Z")

</div>

I should have been clearer, do you want me to enter tickets for the spot fixes I’ve had to make? Specifically asking for an older version of pip and a newer version of codox.

I’m fine with hand-editing build.py to bump the SDK version numbers, it would just be nice if this was documented in the README. I could enter a ticket on that also if you want.

I will switch to a different branch for now, I don’t need to be on the dev branch as I learn the system. I hadn’t even noticed that git defaulted to dev instead of master when I cloned.

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [March 1, 2021, 4:58pm UTC](https://forum.defold.com/t/help-building-editor-on-mac-python-3-required/67661/9 "2021-03-01T16:58:46Z")

</div>

> [@beldenfox](#):
>
> Specifically asking for an older version of pip and a newer version of codox.

Yes, please!
