BradenM / micropy-cli

Micropython Project Management Tool with VSCode support, Linting, Intellisense, Dependency Management, and more!
https://micropy-cli.readthedocs.io
MIT License
313 stars 25 forks source link

Running the cli command fails with trace #288

Closed ShocKwav3 closed 2 years ago

ShocKwav3 commented 2 years ago

Hi,

I am fairly new to micropython development and so far it's great. I was trying to setup the micropy-cli in order to get my vscode stop complaining about those errors. Unfortunately, I can't run the any command micropy-cli. They fails with the following error trace:


Traceback (most recent call last):
  File "/Users/ferojother/Library/Python/3.10/bin/micropy", line 5, in <module>
    from micropy.cli import cli
  File "/Users/ferojother/Library/Python/3.10/lib/python/site-packages/micropy/__init__.py", line 18, in <module>
    from micropy import data, lib, project, stubs, utils
  File "/Users/ferojother/Library/Python/3.10/lib/python/site-packages/micropy/project/__init__.py", line 5, in <module>
    from . import modules
  File "/Users/ferojother/Library/Python/3.10/lib/python/site-packages/micropy/project/modules/__init__.py", line 9, in <module>
    from .templates import TemplatesModule
  File "/Users/ferojother/Library/Python/3.10/lib/python/site-packages/micropy/project/modules/templates.py", line 7, in <module>
    from micropy.project.template import TemplateProvider
  File "/Users/ferojother/Library/Python/3.10/lib/python/site-packages/micropy/project/template.py", line 11, in <module>
    from jinja2 import Environment, FileSystemLoader
  File "/Users/ferojother/Library/Python/3.10/lib/python/site-packages/jinja2/__init__.py", line 12, in <module>
    from .environment import Environment
  File "/Users/ferojother/Library/Python/3.10/lib/python/site-packages/jinja2/environment.py", line 25, in <module>
    from .defaults import BLOCK_END_STRING
  File "/Users/ferojother/Library/Python/3.10/lib/python/site-packages/jinja2/defaults.py", line 3, in <module>
    from .filters import FILTERS as DEFAULT_FILTERS  # noqa: F401
  File "/Users/ferojother/Library/Python/3.10/lib/python/site-packages/jinja2/filters.py", line 13, in <module>
    from markupsafe import soft_unicode
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/Users/ferojother/Library/Python/3.10/lib/python/site-packages/markupsafe/__init__.py)

Any pointers on how I can fix this?

Thanks.

BradenM commented 2 years ago

Hi @ShocKwav3, thanks for the report. Looks like micropy got bit by https://github.com/pallets/jinja/issues/1585.

Will have a fix out soon. Thanks.

lukich48 commented 2 years ago

@ShocKwav3 you can downgrade markupsafe to version 2.0.1 while fix is preparing

pip install --upgrade markupsafe==2.0.1

BradenM commented 2 years ago

@ShocKwav3 @lukich48

This should be fixed in the latest release candidate (v4.0.0.rc.1). Would be awesome if any of you guys could give it a try and let me know of any issues :smile:

Do note that (as of now) the v4 candidate does not support creating stubs on Windows when using python 3.10 (anything <=3.9 is supported). This is due to rshell depending on pyreadline, which breaks on windows w/ py 3.10.

That said, I am working on a big improvement to how micropy talks with pyboards with support for using either rshell or https://github.com/Carglglz/upydevice as backends. This will support windows+py3.10 and (in the future) bridge into new features such as #228 / #107. Aiming to have this out prior to a final v4 release.