PlatformIO Community

Install PlatformIO on VScode failure

Today I got a message about Support for ESP-IDF 4.1

I hit install and get this error ???

Error: Error: Traceback (most recent call last):
  File "c:\users\donvu\.platformio\penv\lib\site-packages\platformio\__main__.py", line 109, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "c:\users\donvu\.platformio\penv\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "c:\users\donvu\.platformio\penv\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "c:\users\donvu\.platformio\penv\lib\site-packages\platformio\commands\__init__.py", line 44, in invoke
    return super(PlatformioCLI, self).invoke(ctx)
  File "c:\users\donvu\.platformio\penv\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\users\donvu\.platformio\penv\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\users\donvu\.platformio\penv\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "c:\users\donvu\.platformio\penv\lib\site-packages\platformio\commands\home\command.py", line 78, in cli
    contrib_dir = get_core_package_dir("contrib-piohome")
  File "c:\users\donvu\.platformio\penv\lib\site-packages\platformio\package\manager\core.py", line 37, in get_core_package_dir
    assert pm.install(spec)
  File "c:\users\donvu\.platformio\penv\lib\site-packages\platformio\package\manager\_install.py", line 49, in install
    spec, silent=silent, skip_dependencies=skip_dependencies, force=force
  File "c:\users\donvu\.platformio\penv\lib\site-packages\platformio\package\manager\_install.py", line 99, in _install
    pkg = self.install_from_registry(spec, search_filters, silent=silent)
  File "c:\users\donvu\.platformio\penv\lib\site-packages\platformio\package\manager\_registry.py", line 83, in install_from_registry
    package = self.fetch_registry_package(spec)
  File "c:\users\donvu\.platformio\penv\lib\site-packages\platformio\package\manager\_registry.py", line 144, in fetch_registry_package
    result = regclient.get_package(self.pkg_type, spec.owner, spec.name)
  File "c:\users\donvu\.platformio\penv\lib\site-packages\platformio\clients\registry.py", line 136, in get_package
    cache_valid="1h",
  File "c:\users\donvu\.platformio\penv\lib\site-packages\platformio\clients\http.py", line 145, in fetch_json_data
    return json.loads(result)
  File "C:\Users\donvu\AppData\Local\Programs\Python\Python37\Lib\json\__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "C:\Users\donvu\AppData\Local\Programs\Python\Python37\Lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\donvu\AppData\Local\Programs\Python\Python37\Lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

============================================================

An unexpected error occurred. Further steps:

* Verify that you have the latest version of PlatformIO using
  `pip install -U platformio` command

* Try to find answer in FAQ Troubleshooting section
  https://docs.platformio.org/page/faq.html

* Report this problem to the developers
  https://github.com/platformio/platformio-core/issues

============================================================


	at c:\Users\donvu\.vscode\extensions\platformio.platformio-ide-1.10.0\node_modules\platformio-node-helpers\dist\index.js:1:11965
	at ChildProcess.d (c:\Users\donvu\.vscode\extensions\platformio.platformio-ide-1.10.0\node_modules\platformio-node-helpers\dist\index.js:1:8215)
	at ChildProcess.emit (events.js:203:13)
	at ChildProcess.cp.emit (c:\Users\donvu\.vscode\extensions\platformio.platformio-ide-1.10.0\node_modules\platformio-node-helpers\node_modules\cross-spawn\lib\enoent.js:34:29)
	at maybeClose (internal/child_process.js:1021:16)
	at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)

What does this mean and how do I fix it ??

see

Maybe you have PIO core version 4 installed (check pio --version), but the new Espressif32 paltform version needs PIO 5.

1 Like

Could you run pio system prune and restart VSCode?

PS C:\Users\donvu> pio --version
PlatformIO, version 5.0.0
PS C:\Users\donvu> pio system prune
WARNING! This will remove:

  • cached API requests
  • cached package downloads
  • temporary data
    Do you want to continue? [y/N]: y
    Total reclaimed space: 29.89MB
    PS C:\Users\donvu>

To be clear, this was a new install of VSC and a new install of PIO from the Extensions Menu.

I re-installed PIO from the Extensions menu and there are no errors !!

Thank You

Would some one please explain what this command does.

See https://docs.platformio.org/en/latest/core/userguide/system/cmd_prune.html

I also have the same problem … Tring to make new install but have no luck. See this error when I try to build project

Can you still post your exact error message?

Executing task: C:\Users\user\.platformio\penv\Scripts\platformio.exe run <

Traceback (most recent call last):
  File "c:\users\user\.platformio\penv\lib\site-packages\platformio\__main__.py", line 109, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "c:\users\user\.platformio\penv\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "c:\users\user\.platformio\penv\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "c:\users\user\.platformio\penv\lib\site-packages\platformio\commands\__init__.py", line 44, in invoke
    return super(PlatformioCLI, self).invoke(ctx)
  File "c:\users\user\.platformio\penv\lib\site-packages\click\core.py", line 1256, in invoke
    Command.invoke(self, ctx)
  File "c:\users\user\.platformio\penv\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\users\user\.platformio\penv\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "c:\users\user\.platformio\penv\lib\site-packages\click\decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "c:\users\user\.platformio\penv\lib\site-packages\platformio\__main__.py", line 63, in cli
    maintenance.on_platformio_start(ctx, force, caller)
  File "c:\users\user\.platformio\penv\lib\site-packages\platformio\maintenance.py", line 44, in on_platformio_start
    telemetry.on_command()
  File "c:\users\user\.platformio\penv\lib\site-packages\platformio\telemetry.py", line 292, in on_command
    resend_backuped_reports()
  File "c:\users\user\.platformio\penv\lib\site-packages\platformio\telemetry.py", line 443, in resend_backuped_reports
    tm = app.get_state_item("telemetry", {})
  File "c:\users\user\.platformio\penv\lib\site-packages\platformio\app.py", line 187, in get_state_item
    with State() as state:
  File "c:\users\user\.platformio\penv\lib\site-packages\platformio\app.py", line 90, in __init__
    self.path = join(get_project_core_dir(), "appstate.json")
  File "c:\users\user\.platformio\penv\lib\site-packages\platformio\project\helpers.py", line 51, in get_project_core_dir
    join(get_project_dir(), "platformio.ini")
  File "c:\users\user\.platformio\penv\lib\site-packages\platformio\project\config.py", line 447, in get_instance
    instance = {"mtime": mtime, "config": ProjectConfig(path)}
  File "c:\users\user\.platformio\penv\lib\site-packages\platformio\project\config.py", line 102, in __init__
    self.read(path, parse_extra)
  File "c:\users\user\.platformio\penv\lib\site-packages\platformio\project\config.py", line 114, in read
    self._parser.read(path)
  File "C:\Users\user\.platformio\python3\lib\configparser.py", line 696, in read
    self._read(fp, filename)
  File "C:\Users\user\.platformio\python3\lib\configparser.py", line 1014, in _read
    for lineno, line in enumerate(fp, start=1):
  File "C:\Users\user\.platformio\python3\lib\encodings\cp1251.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 426: character maps to <undefined>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\user\.platformio\python3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\user\.platformio\python3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\user\.platformio\penv\Scripts\platformio.exe\__main__.py", line 7, in <module>
  File "c:\users\user\.platformio\penv\lib\site-packages\platformio\__main__.py", line 115, in main
    maintenance.on_platformio_exception(e)
  File "c:\users\user\.platformio\penv\lib\site-packages\platformio\maintenance.py", line 71, in on_platformio_exception
    telemetry.on_exception(e)
  File "c:\users\user\.platformio\penv\lib\site-packages\platformio\telemetry.py", line 322, in on_exception
    send_exception(description, is_fatal)
  File "c:\users\user\.platformio\penv\lib\site-packages\platformio\telemetry.py", line 394, in send_exception
    mp = MeasurementProtocol()
  File "c:\users\user\.platformio\penv\lib\site-packages\platformio\telemetry.py", line 74, in __init__
    self["cid"] = app.get_cid()
  File "c:\users\user\.platformio\penv\lib\site-packages\platformio\app.py", line 252, in get_cid
    cid = get_state_item("cid")
  File "c:\users\user\.platformio\penv\lib\site-packages\platformio\app.py", line 187, in get_state_item
    with State() as state:
  File "c:\users\user\.platformio\penv\lib\site-packages\platformio\app.py", line 90, in __init__
    self.path = join(get_project_core_dir(), "appstate.json")
  File "c:\users\user\.platformio\penv\lib\site-packages\platformio\project\helpers.py", line 51, in get_project_core_dir
    join(get_project_dir(), "platformio.ini")
  File "c:\users\user\.platformio\penv\lib\site-packages\platformio\project\config.py", line 447, in get_instance
    instance = {"mtime": mtime, "config": ProjectConfig(path)}
  File "c:\users\user\.platformio\penv\lib\site-packages\platformio\project\config.py", line 102, in __init__
    self.read(path, parse_extra)
  File "c:\users\user\.platformio\penv\lib\site-packages\platformio\project\config.py", line 114, in read
    self._parser.read(path)
  File "C:\Users\user\.platformio\python3\lib\configparser.py", line 696, in read
    self._read(fp, filename)
  File "C:\Users\user\.platformio\python3\lib\configparser.py", line 1014, in _read
    for lineno, line in enumerate(fp, start=1):
  File "C:\Users\user\.platformio\python3\lib\encodings\cp1251.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 426: character maps to <undefined>
The terminal process "C:\Users\user\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

The config parser cannot parse a certain character.

  1. Does your username contain non-ASCII characters, e.g. kryrillic ones?
  2. Does any of platformio.ini contain non-ASCII characters?

This problem occurs when PlatformIO attempts to load an empty JSON file, e.g. .platformio/packages/framework-arduinoststm32@4.10900.200819/.piopm.

Such empty files are result of a package update process.

You can remove empty .piopm files from your installation /.platformio/packages/