Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PlatformIO installation fails #3239

Closed
lolwheel opened this issue Jul 6, 2022 · 3 comments
Closed

PlatformIO installation fails #3239

lolwheel opened this issue Jul 6, 2022 · 3 comments

Comments

@lolwheel
Copy link

lolwheel commented Jul 6, 2022

Hi, I've been a happy Platformio IDE user for a while. It just stopped working yesterday and I failed fix or even reinstall it so here are the repro steps for the clean install that fail for me.

  1. Download the latest VirtualBox image of Ubuntu 22.04 (from osboxes.com in my case) and spin up a brand new virtual machine.
  2. Make sure to update all packages to the latest version.
  3. Install build-essential and python3-venv packages via apt.
  4. Install vscode through official Microsoft dpkg repo, here is the full version reported by it:
Version: 1.68.1
Commit: 30d9c6cd9483b2cc586687151bcbcd635f373630
Date: 2022-06-15T02:58:26.441Z
Electron: 17.4.7
Chromium: 98.0.4758.141
Node.js: 16.13.0
V8: 9.8.177.13-electron.0
OS: Linux x64 5.15.0-40-generic
  1. Install Platformio IDE from the extensions.
  2. Watch the following errors in the VSCode console as the PIO IDE extension tries to bootstrap the installation:
console.ts:137 [Extension Host] Error: PlatformIO Core has not been installed yet!	at u.value (/home/osboxes/.vscode/extensions/platformio.platformio-ide-2.5.0/node_modules/platformio-node-helpers/dist/index.js:1:800244)	at async S.check (/home/osboxes/.vscode/extensions/platformio.platformio-ide-2.5.0/dist/extension.js:1:4227)	at async /home/osboxes/.vscode/extensions/platformio.platformio-ide-2.5.0/dist/extension.js:1:27230
I @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
_doInvokeHandler @ rpcProtocol.ts:473
_invokeHandler @ rpcProtocol.ts:458
_receiveRequest @ rpcProtocol.ts:374
_receiveOneMessage @ rpcProtocol.ts:296
(anonymous) @ rpcProtocol.ts:161
invoke @ event.ts:575
deliver @ event.ts:779
fire @ event.ts:740
fire @ ipc.net.ts:638
_receiveMessage @ ipc.net.ts:958
(anonymous) @ ipc.net.ts:831
invoke @ event.ts:575
deliver @ event.ts:779
fire @ event.ts:740
acceptChunk @ ipc.net.ts:382
(anonymous) @ ipc.net.ts:338
L @ ipc.net.ts:60
emit @ node:events:390
addChunk @ node:internal/streams/readable:315
readableAddChunk @ node:internal/streams/readable:289
Readable.push @ node:internal/streams/readable:228
onStreamRead @ node:internal/stream_base_commons:199
log.ts:313   ERR [Extension Host] (node:4079) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `code --trace-deprecation ...` to show where the warning was created)
console.ts:137 [Extension Host] (node:4079) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.(Use `code --trace-deprecation ...` to show where the warning was created)
I @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
_doInvokeHandler @ rpcProtocol.ts:473
_invokeHandler @ rpcProtocol.ts:458
_receiveRequest @ rpcProtocol.ts:374
_receiveOneMessage @ rpcProtocol.ts:296
(anonymous) @ rpcProtocol.ts:161
invoke @ event.ts:575
deliver @ event.ts:779
fire @ event.ts:740
fire @ ipc.net.ts:638
_receiveMessage @ ipc.net.ts:958
(anonymous) @ ipc.net.ts:831
invoke @ event.ts:575
deliver @ event.ts:779
fire @ event.ts:740
acceptChunk @ ipc.net.ts:382
(anonymous) @ ipc.net.ts:338
L @ ipc.net.ts:60
emit @ node:events:390
addChunk @ node:internal/streams/readable:315
readableAddChunk @ node:internal/streams/readable:289
Readable.push @ node:internal/streams/readable:228
onStreamRead @ node:internal/stream_base_commons:199
console.ts:137 [Extension Host] Error: Could not find portable Python for linux_x86_64	at /home/osboxes/.vscode/extensions/platformio.platformio-ide-2.5.0/node_modules/platformio-node-helpers/dist/index.js:1:802771	at processTicksAndRejections (node:internal/process/task_queues:96:5)	at async u.value (/home/osboxes/.vscode/extensions/platformio.platformio-ide-2.5.0/node_modules/platformio-node-helpers/dist/index.js:1:802176)	at async S.install (/home/osboxes/.vscode/extensions/platformio.platformio-ide-2.5.0/dist/extension.js:1:4365)	at async /home/osboxes/.vscode/extensions/platformio.platformio-ide-2.5.0/dist/extension.js:1:27862
I @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
_doInvokeHandler @ rpcProtocol.ts:473
_invokeHandler @ rpcProtocol.ts:458
_receiveRequest @ rpcProtocol.ts:374
_receiveOneMessage @ rpcProtocol.ts:296
(anonymous) @ rpcProtocol.ts:161
invoke @ event.ts:575
deliver @ event.ts:779
fire @ event.ts:740
fire @ ipc.net.ts:638
_receiveMessage @ ipc.net.ts:958
(anonymous) @ ipc.net.ts:831
invoke @ event.ts:575
deliver @ event.ts:779
fire @ event.ts:740
acceptChunk @ ipc.net.ts:382
(anonymous) @ ipc.net.ts:338
L @ ipc.net.ts:60
emit @ node:events:390
addChunk @ node:internal/streams/readable:315
readableAddChunk @ node:internal/streams/readable:289
Readable.push @ node:internal/streams/readable:228
onStreamRead @ node:internal/stream_base_commons:199
log.ts:313   ERR [Extension Host] (node:4079) [DEP0147] DeprecationWarning: In future versions of Node.js, fs.rmdir(path, { recursive: true }) will be removed. Use fs.rm(path, { recursive: true }) instead
console.ts:137 [Extension Host] (node:4079) [DEP0147] DeprecationWarning: In future versions of Node.js, fs.rmdir(path, { recursive: true }) will be removed. Use fs.rm(path, { recursive: true }) instead
I @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
_doInvokeHandler @ rpcProtocol.ts:473
_invokeHandler @ rpcProtocol.ts:458
_receiveRequest @ rpcProtocol.ts:374
_receiveOneMessage @ rpcProtocol.ts:296
(anonymous) @ rpcProtocol.ts:161
invoke @ event.ts:575
deliver @ event.ts:779
fire @ event.ts:740
fire @ ipc.net.ts:638
_receiveMessage @ ipc.net.ts:958
(anonymous) @ ipc.net.ts:831
invoke @ event.ts:575
deliver @ event.ts:779
fire @ event.ts:740
acceptChunk @ ipc.net.ts:382
(anonymous) @ ipc.net.ts:338
L @ ipc.net.ts:60
emit @ node:events:390
addChunk @ node:internal/streams/readable:315
readableAddChunk @ node:internal/streams/readable:289
Readable.push @ node:internal/streams/readable:228
onStreamRead @ node:internal/stream_base_commons:199
console.ts:137 [Extension Host] runCommand /usr/bin/python3 (3) ['/home/osboxes/.platformio/.cache/tmp/get-platformio-1.1.2.py', 'check', 'python'] {spawnOptions: {…}, _id: '/usr/bin/python3-0.8541377785930802'}
console.ts:137 [Extension Host] runCommand /usr/bin/python3 ['/home/osboxes/.platformio/.cache/tmp/get-platformio-1.1.2.py'] {spawnOptions: {…}, _id: '/usr/bin/python3-0.16767135069423378'}
console.ts:137 [Extension Host] rejected promise not handled within 1 second: RequestError: connect ECONNREFUSED 127.0.0.1:8036
I @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
_doInvokeHandler @ rpcProtocol.ts:473
_invokeHandler @ rpcProtocol.ts:458
_receiveRequest @ rpcProtocol.ts:374
_receiveOneMessage @ rpcProtocol.ts:296
(anonymous) @ rpcProtocol.ts:161
invoke @ event.ts:575
deliver @ event.ts:779
fire @ event.ts:740
fire @ ipc.net.ts:638
_receiveMessage @ ipc.net.ts:958
(anonymous) @ ipc.net.ts:831
invoke @ event.ts:575
deliver @ event.ts:779
fire @ event.ts:740
acceptChunk @ ipc.net.ts:382
(anonymous) @ ipc.net.ts:338
L @ ipc.net.ts:60
emit @ node:events:390
addChunk @ node:internal/streams/readable:315
readableAddChunk @ node:internal/streams/readable:289
Readable.push @ node:internal/streams/readable:228
onStreamRead @ node:internal/stream_base_commons:199
console.ts:137 [Extension Host] stack trace: RequestError: connect ECONNREFUSED 127.0.0.1:8036	at ClientRequest.<anonymous> (/home/osboxes/.vscode/extensions/platformio.platformio-ide-2.5.0/node_modules/got/dist/source/core/index.js:970:111)	at Object.onceWrapper (node:events:510:26)	at ClientRequest.emit (node:events:402:35)	at ClientRequest.emit (node:domain:475:12)	at ClientRequest.origin.emit (/home/osboxes/.vscode/extensions/platformio.platformio-ide-2.5.0/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)	at Socket.socketErrorListener (node:_http_client:447:9)	at Socket.emit (node:events:390:28)	at Socket.emit (node:domain:475:12)	at emitErrorNT (node:internal/streams/destroy:157:8)	at emitErrorCloseNT (node:internal/streams/destroy:122:3)	at processTicksAndRejections (node:internal/process/task_queues:83:21)	at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1161:16)
I @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
_doInvokeHandler @ rpcProtocol.ts:473
_invokeHandler @ rpcProtocol.ts:458
_receiveRequest @ rpcProtocol.ts:374
_receiveOneMessage @ rpcProtocol.ts:296
(anonymous) @ rpcProtocol.ts:161
invoke @ event.ts:575
deliver @ event.ts:779
fire @ event.ts:740
fire @ ipc.net.ts:638
_receiveMessage @ ipc.net.ts:958
(anonymous) @ ipc.net.ts:831
invoke @ event.ts:575
deliver @ event.ts:779
fire @ event.ts:740
acceptChunk @ ipc.net.ts:382
(anonymous) @ ipc.net.ts:338
L @ ipc.net.ts:60
emit @ node:events:390
addChunk @ node:internal/streams/readable:315
readableAddChunk @ node:internal/streams/readable:289
Readable.push @ node:internal/streams/readable:228
onStreamRead @ node:internal/stream_base_commons:199
mainThreadExtensionService.ts:79 [[object Object]]connect ECONNREFUSED 127.0.0.1:8036
$onExtensionRuntimeError @ mainThreadExtensionService.ts:79
_doInvokeHandler @ rpcProtocol.ts:473
_invokeHandler @ rpcProtocol.ts:458
_receiveRequest @ rpcProtocol.ts:374
_receiveOneMessage @ rpcProtocol.ts:296
(anonymous) @ rpcProtocol.ts:161
invoke @ event.ts:575
deliver @ event.ts:779
fire @ event.ts:740
fire @ ipc.net.ts:638
_receiveMessage @ ipc.net.ts:958
(anonymous) @ ipc.net.ts:831
invoke @ event.ts:575
deliver @ event.ts:779
fire @ event.ts:740
acceptChunk @ ipc.net.ts:382
(anonymous) @ ipc.net.ts:338
L @ ipc.net.ts:60
emit @ node:events:390
addChunk @ node:internal/streams/readable:315
readableAddChunk @ node:internal/streams/readable:289
Readable.push @ node:internal/streams/readable:228
onStreamRead @ node:internal/stream_base_commons:199
mainThreadExtensionService.ts:80 RequestError: connect ECONNREFUSED 127.0.0.1:8036
	at ClientRequest.<anonymous> (/home/osboxes/.vscode/extensions/platformio.platformio-ide-2.5.0/node_modules/got/dist/source/core/index.js:970:111)
	at Object.onceWrapper (node:events:510:26)
	at ClientRequest.emit (node:events:402:35)
	at ClientRequest.emit (node:domain:475:12)
	at ClientRequest.origin.emit (/home/osboxes/.vscode/extensions/platformio.platformio-ide-2.5.0/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)
	at Socket.socketErrorListener (node:_http_client:447:9)
	at Socket.emit (node:events:390:28)
	at Socket.emit (node:domain:475:12)
	at emitErrorNT (node:internal/streams/destroy:157:8)
	at emitErrorCloseNT (node:internal/streams/destroy:122:3)
	at processTicksAndRejections (node:internal/process/task_queues:83:21)
	at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1161:16)

The last ECONNREFUSED error is logged many more times and the installation is stuck at that point, here's the screenshot of the window in that state:

image

Cleaning up the VSCode/PIO data by running rm -rf .vscode .platformio .config/Code doesn't change anything either.
My Python version is following:

$ python3 --version
Python 3.10.4

Let me know if you need any more information, happy to provide.

@ivankravets
Copy link
Member

Please ignore ECONNREFUSED warnings. What is the end of the log? Could you close VSCode and try installation script https://docs.platformio.org/en/latest/core/installation/methods/installer-script.html#super-quick-macos-linux ? Does it work?

@lolwheel
Copy link
Author

lolwheel commented Jul 6, 2022

Hmm so something really weird is going on on my system.

I left the virtual machine running by accident and when I got back, the installation was finished!
Then, another PIO operation timed out which was the original reason why I decided to reinstall PIO.

I tried to use the script you provided and it "failed" in a weird way too. It only worked after me pressing Ctrl-C three times. After the third Ctrl-C, wget was launched and the installation proceeded. I looked under the hood of get-platformio.py bootstrap and it seems like every download using Python library just gets stuck. This is probably the original reason behind why my PIO installation started hanging.

I verified this through running some of the commands from get-platform.py in the python3 interactive session.
It seems like the networking calls get stuck at the socked level, I hit Ctrl-C maybe 10 seconds after issuing a request 3 times and got the same exception stack:

osboxes@osboxes:~$ python3
Python 3.10.4 (main, Apr  2 2022, 09:04:19) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> resp = requests.get("https://raw.githubusercontent.com/platformio/platformio-core-installer/master/get-platformio.py", stream=True)
^CTraceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/requests/api.py", line 76, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3/dist-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3/dist-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 382, in _make_request
    self._validate_conn(conn)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 1012, in _validate_conn
    conn.connect()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 353, in connect
    conn = self._new_conn()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 169, in _new_conn
    conn = connection.create_connection(
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 86, in create_connection
    sock.connect(sa)
KeyboardInterrupt

Using the network monitor, I see the traffic blip in both directions and when I add timeout=1 argument to the requests.get call, the result comes successful!

osboxes@osboxes:~$ python3
Python 3.10.4 (main, Apr  2 2022, 09:04:19) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> resp = requests.get("https://raw.githubusercontent.com/platformio/platformio-core-installer/master/get-platformio.py", stream=True, timeout=1)
>>> import io
>>> for chunk in resp.iter_content(chunk_size=io.DEFAULT_BUFFER_SIZE):
...   print(chunk)
... 
b'# Copyright (c) 2...... <all of the content is there>

I'm at a loss here. Do you have any idea?
This doesn't seem to be host networking issue as wget succeeds at fetching the script just fine. My OS installation is brand spanking new so I'm out of ideas for now.

@lolwheel
Copy link
Author

lolwheel commented Jul 6, 2022

Okay some more details:

$ netstat -tp
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp    82412      0 osboxes.lan:36626       cdn-185-199-109-1:https ESTABLISHED 12513/python3       
tcp        0      0 osboxes.lan:54848       banjo.canonical.co:http TIME_WAIT   -                   
tcp6       0      1 osboxes:34586           2606:50c0:8000::1:https SYN_SENT    12513/python3

the tcp6 is stuck in SYN_SENT while the regular IPv4 socket has a bunch of data stuck in its receiving buffer. I might have some ipv6 issues on the network. Disabling ipv6 fixes the PlatformIO installer script but the Build and Intellisense index rebuild still hang.

Edit: OK the rest was also my fault, I had a faulty custom PIO script that was likely blocking the analysis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants