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

Problems running vscode_dist #51

Open
eblis opened this issue Oct 12, 2024 · 3 comments
Open

Problems running vscode_dist #51

eblis opened this issue Oct 12, 2024 · 3 comments
Assignees

Comments

@eblis
Copy link

eblis commented Oct 12, 2024

I tried to run ufbt vscode_dist and had a few issues.

  • It does not work with Python 3.9, where the docs I saw said it will work with Python >= 3.7.
    • The problem is that it uses the | notation for multiple types, instead of Union[a, b]. It work on Python 3.11 though
  • Missing library ansi, it's not marked as a dependency, had to manually install.
  • Missing library scons, it's not marked as a dependency, had to manually install.

After all these issues it's failing with this error:

Cleaning up temp toolchain path..
Extracting Windows toolchain..moving..An error occurred
Access to the path 'C:\Users\<user>\.ufbt\current\gcc-arm-none-eabi-12.3-x86_64-windows-flipper' is denied.
Please close VSCode and any other programs that may be using the toolchain and try again.
scons: Entering directory `C:\Users\<user>\.ufbt\current\scripts\ufbt'
scons: *** Toolchain binary arm-none-eabi-ar not found in PATH.  Stop.
@hedger
Copy link
Member

hedger commented Oct 12, 2024

It does not work with Python 3.9, where the docs I saw said it will work with Python >= 3.7.

  1. ufbt requires Python 3.8, as stated in the package manifest and readme. Could you please point out where exactly does it mention Python 3.7?

The problem is that it uses the | notation for multiple types

Please provide stack trace for that error.

  1. ufbt downloads and unpacks the SDK, which in turn sets up the environment using pre-built toolchain it downloads. Both ansi and scons packages are in that toolchain and do not require any manual installation.

Please provide more information on your configuration, commands you are executing, and error messages you're getting.

@hedger hedger self-assigned this Oct 12, 2024
@eblis
Copy link
Author

eblis commented Oct 12, 2024

I am using poetry for dependency management and venv. It will automatically create a venv for the "project" and keep python dependencies contained to that venv.

I installed ufbt using poetry add ufbt in a poetry environment for Python 3.9.13 set up with pyenv - this should grab all dependencies listed for ufbt. I remembered reading Python >=3.7, but still, 3.9 should be ok since it's saying 3.8 is minimum.

Running poetry run ufbt vscode_dist i have the following error:

Cleaning up temp toolchain path..
Extracting Windows toolchain..moving..An error occurred
Access to the path 'C:\Users\<user>\.ufbt\current\gcc-arm-none-eabi-12.3-x86_64-windows-flipper' is denied.
Please close VSCode and any other programs that may be using the toolchain and try again.
C:\Users\<user>\AppData\Local\pypoetry\Cache\virtualenvs\flipper-qIvlI9iJ-py3.9\Scripts\python.exe: No module named SCons

So I installed poetry add scons.
At one point I got a similar error for ansi package so I also installed ansi package. Trying to reproduce it just now I didn't get the error again, but I didn't start with a fresh env, so maybe that's why.

Running poetry run ufbt vscode_dist i have the following error:

Cleaning up temp toolchain path..
Extracting Windows toolchain..moving..An error occurred
Access to the path 'C:\Users\<user>\.ufbt\current\gcc-arm-none-eabi-12.3-x86_64-windows-flipper' is denied.
Please close VSCode and any other programs that may be using the toolchain and try again.
scons: Entering directory `C:\Users\<user>\.ufbt\current\scripts\ufbt'
TypeError: unsupported operand type(s) for |: '_CallableType' and 'NoneType':
  File "C:\Users\<user>\.ufbt\current\scripts\ufbt\SConstruct", line 46:
    from fbt.appmanifest import FlipperApplication, FlipperAppType
  File "C:\Users\<user>\.ufbt\current\scripts\fbt\appmanifest.py", line 246:
    class AppBuildset:
  File "C:\Users\<user>\.ufbt\current\scripts\fbt\appmanifest.py", line 284:
    message_writer: Callable | None = None,

The | notation isn't available in 3.9 either, so we switch to Python 3.11

pyenv local 3.11.6
poetry env use python
poetry install

Which brings us to the final error:

Cleaning up temp toolchain path..
Extracting Windows toolchain..moving..An error occurred
Access to the path 'C:\Users\<user>\.ufbt\current\gcc-arm-none-eabi-12.3-x86_64-windows-flipper' is denied.
Please close VSCode and any other programs that may be using the toolchain and try again.
scons: Entering directory `C:\Users\<user>\.ufbt\current\scripts\ufbt'
scons: *** Toolchain binary arm-none-eabi-ar not found in PATH.  Stop.

I get the same error even if I enter the venv shell with poetry shell and then run the vscode_dist command.

@hedger
Copy link
Member

hedger commented Oct 12, 2024

It seems that poetry does something that conflicts with the way ufbt sets up its environment.

ufbt itself has minimal dependencies (a single oslex package) and had been verified to be functional when being installed using pipx. I suggest you either use pipx or basic venv for setting up ufbt. Please check if that works on your system.

We'll investigate poetry compatibility.

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