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

[BUG] check_esptool.py does not find esptool if it was installed with pipx #15690

Open
1 task done
artdeell opened this issue Jan 24, 2025 · 3 comments
Open
1 task done
Labels
Arch: xtensa Issues related to the Xtensa architecture Area: Build system OS: Linux Issues related to Linux (building system, etc) Type: Bug Something isn't working

Comments

@artdeell
Copy link

Description / Steps to reproduce the issue

Debian ships an outdated version of esptool (4.7.0), so i use pipx to have a more up-to-date version of it installed. Sadly it appears that the check_esptool.py script doesn't detect the esptool installation managed by pipx.

On which OS does this issue occur?

[OS: Linux]

What is the version of your OS?

Debian Sid (unstable)

NuttX Version

12.7.0

Issue Architecture

[Arch: xtensa]

Issue Area

[Area: Build System]

Host information

There doesn't seem to be such a target? Make ouputs an error message when trying make host_info

Verification

  • I have verified before submitting the report.
@artdeell artdeell added the Type: Bug Something isn't working label Jan 24, 2025
@github-actions github-actions bot added Arch: xtensa Issues related to the Xtensa architecture Area: Build system OS: Linux Issues related to Linux (building system, etc) labels Jan 24, 2025
@acassis
Copy link
Contributor

acassis commented Jan 26, 2025

I have esptool 4.7.0 installed from apt and 4.8.dev4 installed using pip and it detects my version as 4.8.dev4

@artdeell
Copy link
Author

I have esptool 4.7.0 installed from apt and 4.8.dev4 installed using pip and it detects my version as 4.8.dev4

using pip on debian results in this error:

error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.
    
    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.
    
    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.
    
    See /usr/share/doc/python3.13/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

So to not (possibly) break my system, i use pipx, which puts installed packages into a python venv and puts them onto the PATH of my current user. This seems to break the detection in check_esptool.py

Maybe would be better to check for esptool presence by attempting to invoke it?

@fdcavalcanti
Copy link
Contributor

fdcavalcanti commented Jan 29, 2025

Try "which pip" on your terminal. See if it shows two pip installations.
If it shows more than one, I recommend you uninstall the esptool 4.7.0 since it is outdated anyway.

The error you showed is very clear. Newer versions of Python which comes with newer OSes won't let you install Python packages without a virtual environment.

What I recommend, is that you create a Python virtual environment for NuttX, install esptool there and source it when building NuttX.

This creates a venv called "venv" on your current directory:

python3 -m venv venv
source venv/bin/activate
pip install esptool

Then just source the venv before running make.

source <path_to_venv>/bin/activate
make

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arch: xtensa Issues related to the Xtensa architecture Area: Build system OS: Linux Issues related to Linux (building system, etc) Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants