I noticed this issue when trying to run pip
commands on my WSL2
Ubuntu-20.04
machine that it would take a long time to run anything. I finally narrowed it down to when pip
is importing the keyring
module.
Python 3.8.5 (default, May 27 2021, 13:30:53)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> def import_keyring():
... time_start = time.time()
... import keyring
... print(f"Keyring took {time.time() - time_start} seconds to load")
...
>>> import_keyring()
Keyring took 400.4930064678192 seconds to load
looking at the process explorer, it seems there is a child process that it is waiting for:
dbus-launch --autolaunch <32 character hex string> --binary-syntax --close-stderr
the dbus-launch command itself does not seem to have any child processes, so I used strace
to see where it's hanging:
connect(3, {sa_family=AF_INET, sin_port=htons(6000), sin_addr=inet_addr("<my main machine's IP>")}, 16) = 0
It looks to be trying to connect to the host windows computer on port 6000 and failing? Now I'm just at a loss of what is happening and why it's taking so long to fail. Any help appreciated!
I had this ready to ask when finally clicked on what port 6000
meant. I tried setting up X server on Windows for WSL2
to use a long time ago.
Either get the X server working or unset your DISPLAY
environment variable and this should clear it right up.
export DISPLAY=
Hope this helps anyone else running into this obscure issues!