PyCharm error on running debugger having installed with "snap"


I have upgraded from PyCharm 2017.3 under Ubuntu 17.04/10 to PyCharm 2018.2 under Ubuntu 18.04.  Previously I installed PyCharm via "manual" download & unzip.  This time I followed a post ( which suggested installing it via

sudo snap install pycharm-community --classic

The installation works OK.  However, every time I start the debugger I now get two occurrences (in Console window) of error:

QStandardPaths: XDG_RUNTIME_DIR points to non-existing path '/run/user/1000/snap.pycharm-community', please create it with 0700 permissions.

(The application uses Qt/PyQt, hence "QStandardPaths" is referenced during its start-up.)

XDG_RUNTIME_DIR is supposed to be an existing directory for temporary file storage.  Outside of PyCharm mine is already set by the system to /run/user/1000.  That directory exists and is usable.

I should not need to create the sub-directory either manually or by a script.  If I do create it, of course it gets deleted during logon/reboot (it's a temporary directory, something must clean it out completely).

It seems that PyCharm debugger alters this environment variable to append the snap.pycharm-community before launching the executable session.  That must come from the way I installed this time.  Either PyCharm should not alter that variable, or if it wants to use a "neat" sub-directory like this it should surely create it itself before launch.

Either: where/why it is altering the variable/not creating this directory

Or: should I uninstall the snap install way I did it and go back to re-installing PyCharm "manually" to avoid the issue




The first link,, from 5 days ago is by me!  As you can see, I posted there to explain the behaviour and check why Qt cares about it.  When it came to sorting out why it has the extra "pycharm-community" appended to it which does yet exist, as you can see they referred me to the PyCharm forum :)

I have read through the second post, as best I can.  I do not think it applies to my situation.  There the problem seems to be with the user's top-level XDG temporary directory, in /run/user/<user-id> directory.  That is fine for me:

ls -ld /run/user /run/user/1000
drwxr-xr-x  3 root root  60 Oct 30 07:49 /run/user
drwx------ 12 jon  jon  280 Oct 30 12:42 /run/user/1000

The problem is the error message which complains about


That directory does not exist.  Creating it manually does not survive across login/reboot.

If I write a one-line (two, actually!) python program:

import os

and run it outside PyCharm, say in a terminal on my desktop, the value is


acceptable to all programs.  However, if I run it from within PyCharm --- both via Run or Debug --- I get


which does not exist.

Now, I do not doubt that this is a result of installing this time via

sudo snap install pycharm-community --classic

but the question is: where/how/what can I do about it/should I uninstall PyCharm and re-install not using snap?  It is PyCharm's documentation installation guide which I obeyed to try the snap install approach, not mine!  I would have thought this problem would arise for anyone following that, at least under my Ubuntu 18.04.  I don't know if you have the facilities to try it (I did an absolutely default Ubuntu install).






Please see The problem is not on PyCharm side indeed. This is the 3rd party problem. You could communicate right in the comments of the issue.


@Sergey Karpov

Thank you, that's great.  I did Google for `XDG_RUNTIME_DIR` & `snap`, but somehow did not come across that thread.

There is a lot for me to read there, understand & consider, but you have given me the thread I need, thanks.


For anyone reading this.  As @Sergey Karpov said, this turns out not to be a PyCharm issue per se but rather a Linux snap one.  It is snap which changes the environment variable when PyCharm is installed & launched via snap.  A sample post about the problem behaviour is :

> It was previously agreed to that snappy should set XDG_RUNTIME_DIR to /run/user/`id -u`/snap.$SNAP_NAME and create the directory[1][2]. Today, snappy sets XDG_RUNTIME_DIR but does not yet create the directory (the directory seems to be created by gtk3 apps at least).

So outside of gtk3 it will go wrong as per my post.  Which leaves all the references on the web stating that the best way to install PyCharm for Linux/Ubuntu etc. is via snap being unhelpful....


Please sign in to leave a comment.