# Psychopy 2021.2.3-1 fails to start

**URL:** <https://discourse.psychopy.org/t/psychopy-2021-2-3-1-fails-to-start/27067>\
**Category:** Other\
**Tags:** installation\
**Created:** [January 28, 2022, 6:57pm UTC](https://discourse.psychopy.org/t/psychopy-2021-2-3-1-fails-to-start/27067 "2022-01-28T18:57:49Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![daniel.e.shub](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/daniel.e.shub/32/4609_2.png) [@daniel.e.shub](https://discourse.psychopy.org/u/daniel.e.shub)\
**Post date:** [January 28, 2022, 6:57pm UTC](https://discourse.psychopy.org/t/psychopy-2021-2-3-1-fails-to-start/27067/1 "2022-01-28T18:57:50Z")

</div>

I recently upgraded to Python 3.10.2 on Arch Linux and now Psychopy 2021.2.3-1 crashes on start up with:

```auto
  ...
  File "/usr/lib/python3.10/site-packages/macropy/activate.py", line 4, in <module>
    macropy.activate()
  File "/usr/lib/python3.10/site-packages/macropy/ __init__.py", line 18, in activate
    from .core import hquotes # noqa
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1002, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 945, in _find_spec
  File "/usr/lib/python3.10/site-packages/macropy/core/import_hooks.py", line 147, in find_spec
    code, tree = self.expand_macros(source, origin, spec)
  File "/usr/lib/python3.10/site-packages/macropy/core/import_hooks.py", line 113, in expand_macros
    return compile(tree, filename, "exec"), new_tree
TypeError: required field "lineno" missing from alias

```

I am running macropy version 1.1.0b2 and `import macropy.activate` gives the same error. This seems to be the latest version of macropy, but there is a [bug report](https://github.com/lihaoyi/macropy/issues/103) from a year ago that macropy does not work with Python 3.8+. I am pretty sure I used Psychopy with Python 3.8 and 3.9, so I am lost.

I feel like I am missing something obvious.

---

<div class="post-metadata">

**Author:** ![Becca](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/becca/32/34260_2.png) [@Becca](https://discourse.psychopy.org/u/Becca)\
**Post date:** [January 28, 2022, 10:26pm UTC](https://discourse.psychopy.org/t/psychopy-2021-2-3-1-fails-to-start/27067/2 "2022-01-28T22:26:17Z")

</div>

> [@daniel.e.shub](#):
>
> 2021.2.3-1

Is this the standalone version installed from [PsychoPy.org](http://PsychoPy.org)?

---

<div class="post-metadata">

**Author:** ![daniel.e.shub](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/daniel.e.shub/32/4609_2.png) [@daniel.e.shub](https://discourse.psychopy.org/u/daniel.e.shub)\
**Post date:** [January 28, 2022, 10:46pm UTC](https://discourse.psychopy.org/t/psychopy-2021-2-3-1-fails-to-start/27067/3 "2022-01-28T22:46:28Z")

</div>

No, it is essentially an install built from the 2021.2.3 source tarball ([https://github.com/psychopy/psychopy/archive/2021.2.3.tar.gz](https://github.com/psychopy/psychopy/archive/2021.2.3.tar.gz)) using `python setup.py install`

Looking into it more, my guess is it is related to the fact that the recommended Python version is 3.6 (which is now past end of life) and that 3.10 is just not supported. I am installing now into a virtual environment with Python 3.9 and checking to see if PsychoPy will pass all the unit tests.

---

<div class="post-metadata">

**Author:** ![bastosfh](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/bastosfh/32/13713_2.png) [@bastosfh](https://discourse.psychopy.org/u/bastosfh)\
**Post date:** [June 1, 2022, 10:25pm UTC](https://discourse.psychopy.org/t/psychopy-2021-2-3-1-fails-to-start/27067/4 "2022-06-01T22:25:59Z")

</div>

Hi @daniel.e.shub and @Becca,

Is there any news related to this error message?

I managed to install PsychoPy on Ubuntu 22.04 without any errors (i.e. satisfying all dependencies) but, when I try to run it, nothing happens.

The contents of `last_app_load.log` is this:

> Error while compiling file /home/flavio/.local/lib/python3.10/site-packages/macropy/core/hquotes.py  
> Traceback (most recent call last):  
> File “/home/flavio/.local/lib/python3.10/site-packages/macropy/core/import\_hooks.py”, line 113, in expand\_macros  
> return compile(tree, filename, “exec”), new\_tree  
> TypeError: required field “lineno” missing from alias  
> Traceback (most recent call last):  
> File “/home/flavio/.local/bin/psychopy”, line 8, in   
> sys.exit(main())  
> File “/home/flavio/.local/lib/python3.10/site-packages/psychopy/app/psychopyApp.py”, line 98, in main  
> start\_app()  
> File “/home/flavio/.local/lib/python3.10/site-packages/psychopy/app/psychopyApp.py”, line 26, in start\_app  
> app = startApp(showSplash=showSplash)  
> File “/home/flavio/.local/lib/python3.10/site-packages/psychopy/app/ **init**.py”, line 84, in startApp  
> from psychopy.app.\_psychopyApp import PsychoPyApp  
> File “/home/flavio/.local/lib/python3.10/site-packages/psychopy/app/\_psychopyApp.py”, line 21, in   
> from . import themes  
> File “/home/flavio/.local/lib/python3.10/site-packages/psychopy/app/themes/ **init**.py”, line 1, in   
> from .\_themes import ThemeMixin, IconCache  
> File “/home/flavio/.local/lib/python3.10/site-packages/psychopy/app/themes/\_themes.py”, line 18, in   
> from …experiment import components  
> File “/home/flavio/.local/lib/python3.10/site-packages/psychopy/experiment/ **init**.py”, line 19, in   
> from .params import getCodeFromParamStr, Param  
> File “/home/flavio/.local/lib/python3.10/site-packages/psychopy/experiment/params.py”, line 25, in   
> from . import py2js  
> File “/home/flavio/.local/lib/python3.10/site-packages/psychopy/experiment/py2js.py”, line 21, in   
> from psychopy.experiment.py2js\_transpiler import translatePythonToJavaScript  
> File “/home/flavio/.local/lib/python3.10/site-packages/psychopy/experiment/py2js\_transpiler.py”, line 13, in   
> from metapensiero.pj.api import translates  
> File “/home/flavio/.local/lib/python3.10/site-packages/metapensiero/pj/api.py”, line 21, in   
> from . import transformations  
> File “/home/flavio/.local/lib/python3.10/site-packages/metapensiero/pj/transformations/ **init**.py”, line 11, in   
> import macropy.activate  
> File “/home/flavio/.local/lib/python3.10/site-packages/macropy/activate.py”, line 4, in   
> macropy.activate()  
> File “/home/flavio/.local/lib/python3.10/site-packages/macropy/ **init**.py”, line 18, in activate  
> from .core import hquotes # noqa  
> File “”, line 1027, in \_find\_and\_load  
> File “”, line 1002, in \_find\_and\_load\_unlocked  
> File “”, line 945, in \_find\_spec  
> File “/home/flavio/.local/lib/python3.10/site-packages/macropy/core/import\_hooks.py”, line 147, in find\_spec  
> code, tree = self.expand\_macros(source, origin, spec)  
> File “/home/flavio/.local/lib/python3.10/site-packages/macropy/core/import\_hooks.py”, line 113, in expand\_macros  
> return compile(tree, filename, “exec”), new\_tree  
> TypeError: required field “lineno” missing from alias  
> 0.1405 DEBUG Opening message catalog /home/flavio/.local/lib/python3.10/site-packages/psychopy/localization/…/app/locale/pt\_BR/LC\_MESSAGE/messages.mo for locale pt\_BR  
> 0.1406 DEBUG Locale for ‘pt\_BR’ not found. Using default.

I’m working on a “how to”, but got stuck there.  
I appreciate any guesses/clues/pointers 🙂

---

<div class="post-metadata">

**Author:** ![daniel.e.shub](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/daniel.e.shub/32/4609_2.png) [@daniel.e.shub](https://discourse.psychopy.org/u/daniel.e.shub)\
**Post date:** [June 7, 2022, 7:10pm UTC](https://discourse.psychopy.org/t/psychopy-2021-2-3-1-fails-to-start/27067/5 "2022-06-07T19:10:28Z")

</div>

I can get past the macropy issue ([What is the state of Python 3.10 support? - #2 by jon](https://discourse.psychopy.org/t/what-is-the-state-of-python-3-10-support/27303/2)) by using the unreleased version of javascripthon ([metapensiero.pj/CHANGES.rst at master · metapensiero/metapensiero.pj · GitHub](https://github.com/metapensiero/metapensiero.pj/blob/master/CHANGES.rst)) that does not depend on macropy. I still cannot get the newest versions of PsychoPy to run on Linux with Python 3.10.

---

<div class="post-metadata">

**Author:** ![DestyNova](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/destynova/32/34382_2.png) [@DestyNova](https://discourse.psychopy.org/u/DestyNova)\
**Post date:** [June 8, 2022, 1:26am UTC](https://discourse.psychopy.org/t/psychopy-2021-2-3-1-fails-to-start/27067/6 "2022-06-08T01:26:24Z")

</div>

Hey Daniel, I saw your tip on the Github issue. Thanks so much. I was able to get past that error, then ran into some issues with wxPython. I built a source wheel, which was necessary the last time I tried this, for some reason I’ve forgotten:

```auto
 pip install -U \
    -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-22.04 \
    wxPython

```

Then came the horrible part: I had to go through some of the PsychoPy and WxPython files and make some manual changes to do with wx functions no longer accepting `float` values. I just wrapped all offending expressions in `int(...)` and replaced real divisions with integer division (i.e. `x /= 2` → `x //= 2`).  
I should probably try to generate a diff, but I just edited them in place and kept relaunching until it worked.  
The files that needed changing were:

```nohighlight
~/.local/lib/python3.10/site-packages/wx/lib/agw/aui/auibook.py
~/.local/lib/python3.10/site-packages/wx/lib/agw/aui/tabart.py
~/.local/lib/python3.10/site-packages/wx/lib/agw/advancedsplash.py
~/.local/lib/python3.10/site-packages/psychopy/app/builder/builder.py
~/.local/lib/python3.10/site-packages/psychopy/app/psychopyApp.py

```

Hope this helps. If you have more trouble let me know and I’ll take another look.

---

<div class="post-metadata">

**Author:** ![daniel.e.shub](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/daniel.e.shub/32/4609_2.png) [@daniel.e.shub](https://discourse.psychopy.org/u/daniel.e.shub)\
**Post date:** [June 8, 2022, 4:27pm UTC](https://discourse.psychopy.org/t/psychopy-2021-2-3-1-fails-to-start/27067/7 "2022-06-08T16:27:13Z")

</div>

I have no idea how anyone has gotten PsychoPy to work with Python 3.10. The issue is not wx, but a change in Python ([Issue 37999: No longer use implicit convertion to int with loss - Python tracker](https://bugs.python.org/issue37999)). The changes you made to the wx files (and then some) are probably already available upstream ([Fix a bunch of Python 3.10 issues with pure-Python classes and demos · wxWidgets/Phoenix@173d079 · GitHub](https://github.com/wxWidgets/Phoenix/commit/173d0796810bb65de9bdfdc6941d24a04628f6c2)) but not released yet.

You should definitely report the bug (or a PR) on Git. A diff would be helpful. My concern is that these issues are hidden in sections of code not covered by starting the app or the unit tests.

---

<div class="post-metadata">

**Author:** ![DestyNova](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/destynova/32/34382_2.png) [@DestyNova](https://discourse.psychopy.org/u/DestyNova)\
**Post date:** [June 8, 2022, 5:45pm UTC](https://discourse.psychopy.org/t/psychopy-2021-2-3-1-fails-to-start/27067/8 "2022-06-08T17:45:29Z")

</div>

I see. Well, PsychoPy is working for me fine now in Python 3.10 with those changes, although I’m only using it for one existing program. It was a faff though, and I was tempted to give up halfway through.

[edit]  
Looking at that Python issue, that really does seem like a huge breaking change. I’m surprised there wasn’t more discussion on the issue.
