# How to install Psychopy 2022.2.5 on Ubuntu 22.10

**URL:** <https://discourse.psychopy.org/t/how-to-install-psychopy-2022-2-5-on-ubuntu-22-10/32765>\
**Category:** Blog\
**Tags:** linux, installation\
**Created:** [January 12, 2023, 7:37pm UTC](https://discourse.psychopy.org/t/how-to-install-psychopy-2022-2-5-on-ubuntu-22-10/32765 "2023-01-12T19:37:15Z")\
**Posts on this page:** 1\
**Page:** 1

<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:** [January 12, 2023, 7:37pm UTC](https://discourse.psychopy.org/t/how-to-install-psychopy-2022-2-5-on-ubuntu-22-10/32765/1 "2023-01-12T19:37:15Z")

</div>

Perhaps I should start by saying that _I would not recommend setting up a computer to run experiments in a non-LTS release of Ubuntu_, since you get less time of support and need to upgrade it more often (which may break things that are working). Nevertheless, _I like to have the most recent version of the OS_ installed in my notebook, which I frequently use to create and test experiments.

So, if that is also your case, let me show you how to install PsychoPy 2022.2.5 on Ubuntu 22.10.

- If you are looking for an LTS installation, please follow [this instructions](https://discourse.psychopy.org/t/how-to-install-psychopy-2022-2-4-on-ubuntu-22-04-using-virtualenv/30125).

Here, I’ll show how to _compile Python 3.8_ on Ubuntu 22.10, so that you can use the most up-to-date Ubuntu and still be able to work with PsychoPy.

> “Wouldn’t it be easier to use the [deadsnakes PPA](https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa)?”

In fact it would but, as it turns out, we can’t. The PPA is provided for LTS versions of Ubuntu only.

> “But, then, couldn’t you just use [conda](https://docs.conda.io/en/latest/)?”

Yes. But what is the fun in it 😉  
Kidding apart, I prefer using `virtualenv` to manage virtual environments.  
So, keep in mind that there is, at least, one alternative to what I’m describing here.

### First, make sure your system is up-to-date:

> sudo apt update  
> sudo apt upgrade

### Let’s install the packages we’ll need along the way.

> sudo apt install swig libpulse-dev libasound2-dev libgtk-3-dev git libwebkit2gtk-4.0-dev libxcb-xinerama0 libegl1-mesa virtualenv wget checkinstall build-essential libreadline-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev

- wget checkinstall build-essential libreadline-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev **are needed to download and compile Python 3.8**

- virtualenv **will be needed to create the virtual environment**

- swig, libpulse-dev and libasound2-dev are needed to install pocketsphinx libgtk-3-dev and libwebkit2gtk-4.0-dev **are needed to build wxPython**

- git **is required to save .psyexp file using Builder**

- libxcb-xinerama0 libegl1-mesa **are required to solve an error that prevents Builder from running experiments**

### Python 3.8

Download Python 3.8

> sudo wget [https://www.python.org/ftp/python/3.8.16/Python-3.8.16.tgz](https://www.python.org/ftp/python/3.8.16/Python-3.8.16.tgz)

Extract the compressed file you’ve downloaded:

> sudo tar xzf Python-3.8.16.tgz

Enter the folder you’ve just extracted:

> cd Python-3.8.16

The compilation of Python 3.8 will take two steps only. First, we make sure everything we need is there (`configure`) and then we send the files to where they belong (`make install`). If you really need to know more about this process I recommend [going here](https://thoughtbot.com/blog/the-magic-behind-configure-make-make-install).

> ./configure --enable-optimizations

I’ll use `altinstall` instead of install so that the **system’s Python installation remains untouched**.

> sudo make altinstall

To check if everything worked, type:

> python3.8 --version

If it shows “Python 3.8.16” you are good to go.

### Create a virtual environment with Python 3.8 and install PsychoPy

Let’s create a virtual environment called `psychopy-py38` inside of a folder called `Environments`

> virtualenv --python /usr/local/bin/python3.8 ~/Environments/psychopy-py38

Activate the virtual environment so you can install and configure PsychoPy inside it

> cd Environments  
> source psychopy-py38/bin/activate

First, we need to update deprecated `pip` and `setuptools`, and install `attrdict`:

> pip install pip setuptools -U  
> pip install attrdict

Now, lets install PsychoPy 2022.2.5.  
During this step, xwPython will be compiled. It takes around 30 minutes - go for a walk 😉

> pip install psychopy==2022.2.5

Now you should be able to run PsychoPy.

> psychopy --builder &

When you run it for the first time, a popup will tell you that `psychtoolbox` needs further configuration. The same steps are described [here](https://discourse.psychopy.org/t/how-to-install-psychopy-2022-1-4-on-ubuntu-22-04/29450) in case you miss it and want to find them again.

It is also recommended that you go to Properties → Audio and change “Audio library” to “ptb” (i.e. to use psychtoolbox).

Login to pavlovia from Builder is not working. It’s not a new issue, actually - there’s a thread on this problem [here](https://discourse.psychopy.org/t/error-message-when-syncing-experiments-from-psychopy-builder-to-pavlovia/21558/15). Therefore, I’ve been using [gitg](https://flathub.org/apps/details/org.gnome.gitg) to sync my projects with gitlab / pavlovia. If you want to know more about it, leave a comment here.

Builder still crashes when typing a dollar sign into a text component. It is an old bug that came back (it’s a tough bug…). To get rid of it, follow [this instructions](https://discourse.psychopy.org/t/possible-bug-builder-crashes-when-typing-a-dollar-sign-into-a-text-component/24451/20).

The next time you need PsychoPy, just open the terminal and type

> source Environments/psychopy-py38/bin/activate  
> psychopy --builder &

Just a reminder: you _must_ leave the terminal open, otherwise you will shutdown PsychoPy Builder with the terminal.

That’s it!  
I hope it helps 🙂
