antlr4
antlr4 copied to clipboard
Getting Started install instructions lead to TimeoutError on WSL2
trafficstars
Following the instructions in https://github.com/antlr/antlr4/blob/4.13.2/doc/getting-started.md,
- I first created a miniconda environment for antlr and then proceeded with installing antlr4-tools:
conda create --prefix /home/lan/miniconda3/envs/antlr python=3.11
conda activate /home/lan/miniconda3/envs/antlr
python3 -m pip install antlr4-tools
- I then attempted to install the java app with
antlr4
and that produced the following error log:
Traceback (most recent call last):
File "/home/lan/miniconda3/envs/antlr/bin/antlr4", line 8, in <module>
sys.exit(tool())
^^^^^^
File "/home/lan/miniconda3/envs/antlr/lib/python3.11/site-packages/antlr4_tool_runner.py", line 141, in tool
run_cli('org.antlr.v4.Tool')
File "/home/lan/miniconda3/envs/antlr/lib/python3.11/site-packages/antlr4_tool_runner.py", line 132, in run_cli
args, version = process_args()
^^^^^^^^^^^^^^
File "/home/lan/miniconda3/envs/antlr/lib/python3.11/site-packages/antlr4_tool_runner.py", line 126, in process_args
args.version or os.environ.get("ANTLR4_TOOLS_ANTLR_VERSION") or latest_version()
^^^^^^^^^^^^^^^^
File "/home/lan/miniconda3/envs/antlr/lib/python3.11/site-packages/antlr4_tool_runner.py", line 27, in latest_version
with urlopen(f"https://search.maven.org/solrsearch/select?q=a:antlr4-master+g:org.antlr", timeout=10) as response:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lan/miniconda3/envs/antlr/lib/python3.11/urllib/request.py", line 216, in urlopen
return opener.open(url, data, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lan/miniconda3/envs/antlr/lib/python3.11/urllib/request.py", line 519, in open
response = self._open(req, data)
^^^^^^^^^^^^^^^^^^^^^
File "/home/lan/miniconda3/envs/antlr/lib/python3.11/urllib/request.py", line 536, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lan/miniconda3/envs/antlr/lib/python3.11/urllib/request.py", line 496, in _call_chain
result = func(*args)
^^^^^^^^^^^
File "/home/lan/miniconda3/envs/antlr/lib/python3.11/urllib/request.py", line 1391, in https_open
return self.do_open(http.client.HTTPSConnection, req,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lan/miniconda3/envs/antlr/lib/python3.11/urllib/request.py", line 1352, in do_open
r = h.getresponse()
^^^^^^^^^^^^^^^
File "/home/lan/miniconda3/envs/antlr/lib/python3.11/http/client.py", line 1395, in getresponse
response.begin()
File "/home/lan/miniconda3/envs/antlr/lib/python3.11/http/client.py", line 325, in begin
version, status, reason = self._read_status()
^^^^^^^^^^^^^^^^^^^
File "/home/lan/miniconda3/envs/antlr/lib/python3.11/http/client.py", line 286, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lan/miniconda3/envs/antlr/lib/python3.11/socket.py", line 706, in readinto
return self._sock.recv_into(b)
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lan/miniconda3/envs/antlr/lib/python3.11/ssl.py", line 1314, in recv_into
return self.read(nbytes, buffer)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/lan/miniconda3/envs/antlr/lib/python3.11/ssl.py", line 1166, in read
return self._sslobj.read(len, buffer)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TimeoutError: The read operation timed out
The suspect line is the following:
with urlopen(f"https://search.maven.org/solrsearch/select?q=a:antlr4-master+g:org.antlr", timeout=10) as response:
I am unable to curl nor access this URL in my browser. However, I saw instructions on StackOverflow from user kaby76 (https://stackoverflow.com/q/78059474) to instead run
antlr -v 4.13.1
and that did allow me to acquire the CLI tool:
antlr4 -v 4.13.1
ANTLR Parser Generator Version 4.13.1
-o ___ specify output directory where all output is generated
-lib ___ specify location of grammars, tokens files
-atn generate rule augmented transition network diagrams
-encoding ___ specify grammar file encoding; e.g., euc-jp
-message-format ___ specify output style for messages in antlr, gnu, vs2005
-long-messages show exception details when available for errors and warnings
-listener generate parse tree listener (default)
-no-listener don't generate parse tree listener
-visitor generate parse tree visitor
-no-visitor don't generate parse tree visitor (default)
-package ___ specify a package/namespace for the generated code
-depend generate file dependencies
-D<option>=value set/override a grammar-level option
-Werror treat warnings as errors
-XdbgST launch StringTemplate visualizer on generated code
-XdbgSTWait wait for STViz to close before continuing
-Xforce-atn use the ATN simulator for all predictions
-Xlog dump lots of logging info to antlr-timestamp.log
-Xexact-output-dir all output goes into -o dir regardless of paths/package
Thanks, Mohammed