I am using macOS Mojave and trying to run the following:
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import optim
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from pyvirtualdisplay import Display
from IPython import display as ipythondisplay
from IPython.display import clear_output
from pathlib import Path
import random, os.path, math, glob, csv, base64, itertools, sys
import gym
from gym.wrappers import Monitor
from pprint import pprint
# The following code is will be used to visualize the environments.
def show_video(directory):
html = []
for mp4 in Path(directory).glob("*.mp4"):
video_b64 = base64.b64encode(mp4.read_bytes())
html.append('''<video alt="{}" autoplay
loop controls style="height: 400px;">
<source src="data:video/mp4;base64,{}" type="video/mp4" />
</video>'''.format(mp4, video_b64.decode('ascii')))
ipythondisplay.display(ipythondisplay.HTML(data="<br>".join(html)))
display = Display(visible=0, size=(1400, 900))
display.start();
But when I try to run the above, I get the following error:
---------------------------------------------------------------------------
XStartTimeoutError Traceback (most recent call last)
<ipython-input-1-73a977c6bd7e> in <module>
31
32 display = Display(visible=0, size=(1400, 900))
---> 33 display.start();
34
35 def make_seed(seed):
/usr/local/lib/python3.7/site-packages/pyvirtualdisplay/abstractdisplay.py in start(self)
166 if not ok:
167 msg = 'Failed to start X on display "%s" (xdpyinfo check failed).'
--> 168 raise XStartTimeoutError(msg % d)
169 return self
170
XStartTimeoutError: Failed to start X on display ":1001" (xdpyinfo check failed).
The only close thing I get is Why am I getting this message from xauth: “timeout in locking authority file /home//.Xauthority”?
which is not really what I am facing here. How can I fix this issue?