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

Idf.py build -> python ImportError: cannot import name 'rest_of_line' from 'pyparsing'... (IDFGH-6867) #8489

Closed
3 tasks
Ampaex opened this issue Mar 2, 2022 · 18 comments
Labels
Resolution: Won't Do This will not be worked on Status: Done Issue is done internally

Comments

@Ampaex
Copy link

Ampaex commented Mar 2, 2022

Environment

  • Development Kit: None
  • Kit version (for WroverKit/PicoKit/DevKitC): none
  • Module or chip used: ESP32
  • IDF version (run git describe --tags to find it):
    v5.0-dev-1762-g6e0308d352
  • Build System: idf.py
  • Compiler version (run xtensa-esp32-elf-gcc --version to find it):
    (crosstool-NG esp-2021r2-patch3) 8.4.0
  • Operating System: Linux Debian testing
  • Using an IDE?: No, visual studio code. (I run idf.py command through bash console)
  • Power Supply: None

Problem Description

Lately, when I tried to compile, I got to the point where I get the later mentioned error. This could be previously "solved" by doing a fullclean and compiling again.
Right now this error is not being "solved" anymore and I cannot continue building my project without errors, it's not an error that indicates easily where is the problem or any way of fixing it.

Expected Behavior

To build the project

Actual Behavior

Gives the error near the end of compilation.

Steps to reproduce

  1. I really don't know what is causing it.

// If possible, attach a picture of your setup/wiring here.

Code to reproduce this issue

My code is really large and I don't know what is causing the problem.

Debug Logs

Executing action: all (aliases: build)
Running ninja in directory /home/antonio/Escritorio/Proyectos_GitHub/Autopiloto/LibelulaX/LibelulaXpilot/build
Executing "ninja all"...
[9/861] Generating ../../partition_table/partition-table.bin
Partition table binary generated. Contents:
*******************************************************************************
# ESP-IDF Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs,data,nvs,0x9000,24K,
phy_init,data,phy,0xf000,4K,
factory,app,factory,0x10000,1M,
*******************************************************************************
[280/861] Performing configure step for 'bootloader'
-- Found Git: /usr/bin/git (found version "2.34.1") 
-- The C compiler identification is GNU 8.4.0
-- The CXX compiler identification is GNU 8.4.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/antonio/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/antonio/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/antonio/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32
-- Project sdkconfig file /home/antonio/Escritorio/Proyectos_GitHub/Autopiloto/LibelulaX/LibelulaXpilot/sdkconfig
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of time_t
-- Check size of time_t - done
-- Adding linker script /home/antonio/esp/esp-idf/components/soc/esp32/ld/esp32.peripherals.ld
-- Adding linker script /home/antonio/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.ld
-- Adding linker script /home/antonio/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.api.ld
-- Adding linker script /home/antonio/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.libgcc.ld
-- Adding linker script /home/antonio/esp/esp-idf/components/esp_rom/esp32/ld/esp32.rom.newlib-funcs.ld
-- Adding linker script /home/antonio/esp/esp-idf/components/bootloader/subproject/main/ld/esp32/bootloader.ld
-- Adding linker script /home/antonio/esp/esp-idf/components/bootloader/subproject/main/ld/esp32/bootloader.rom.ld
-- Components: bootloader bootloader_support efuse esp32 esp_common esp_hw_support esp_rom esp_system esptool_py freertos hal log main micro-ecc newlib partition_table soc spi_flash xtensa
-- Component paths: /home/antonio/esp/esp-idf/components/bootloader /home/antonio/esp/esp-idf/components/bootloader_support /home/antonio/esp/esp-idf/components/efuse /home/antonio/esp/esp-idf/components/esp32 /home/antonio/esp/esp-idf/components/esp_common /home/antonio/esp/esp-idf/components/esp_hw_support /home/antonio/esp/esp-idf/components/esp_rom /home/antonio/esp/esp-idf/components/esp_system /home/antonio/esp/esp-idf/components/esptool_py /home/antonio/esp/esp-idf/components/freertos /home/antonio/esp/esp-idf/components/hal /home/antonio/esp/esp-idf/components/log /home/antonio/esp/esp-idf/components/bootloader/subproject/main /home/antonio/esp/esp-idf/components/bootloader/subproject/components/micro-ecc /home/antonio/esp/esp-idf/components/newlib /home/antonio/esp/esp-idf/components/partition_table /home/antonio/esp/esp-idf/components/soc /home/antonio/esp/esp-idf/components/spi_flash /home/antonio/esp/esp-idf/components/xtensa
-- Configuring done
-- Generating done
-- Build files have been written to: /home/antonio/Escritorio/Proyectos_GitHub/Autopiloto/LibelulaX/LibelulaXpilot/build/bootloader
[346/861] Performing build step for 'bootloader'
[1/97] Generating project_elf_src_esp32.c
[2/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/lldesc.c.obj
[3/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/i2c_periph.c.obj
[4/97] Building C object CMakeFiles/bootloader.elf.dir/project_elf_src_esp32.c.obj
[5/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/gpio_periph.c.obj
[6/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/lcd_periph.c.obj
[7/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/dac_periph.c.obj
[8/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/interrupts.c.obj
[9/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/adc_periph.c.obj
[10/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/ledc_periph.c.obj
[11/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/i2s_periph.c.obj
[12/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/rmt_periph.c.obj
[13/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/pcnt_periph.c.obj
[14/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/mcpwm_periph.c.obj
[15/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/rtc_io_periph.c.obj
[16/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/sdmmc_periph.c.obj
[17/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/sigmadelta_periph.c.obj
[18/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/timer_periph.c.obj
[19/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/sdio_slave_periph.c.obj
[20/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/spi_periph.c.obj
[21/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/uart_periph.c.obj
[22/97] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32/touch_sensor_periph.c.obj
[23/97] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/mpu_hal.c.obj
[24/97] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/efuse_hal.c.obj
[25/97] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/cpu_hal.c.obj
[26/97] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/esp32/efuse_hal.c.obj
[27/97] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/wdt_hal_iram.c.obj
[28/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_common_loader.c.obj
[29/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_clock_init.c.obj
[30/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_mem.c.obj
[31/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_random.c.obj
[32/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_common.c.obj
[33/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_random_esp32.c.obj
[34/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/bootloader_flash/src/bootloader_flash.c.obj
[35/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/secure_boot.c.obj
[36/97] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_clk.c.obj
[37/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_encrypt.c.obj
[38/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_partitions.c.obj
[39/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/bootloader_flash/src/flash_qio_mode.c.obj
[40/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_utility.c.obj
[41/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp_image_format.c.obj
[42/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/bootloader_flash/src/bootloader_flash_config_esp32.c.obj
[43/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_efuse.c.obj
[44/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_clock_loader.c.obj
[45/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_console_loader.c.obj
[46/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_console.c.obj
[47/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32/bootloader_soc.c.obj
[48/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_init.c.obj
[49/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_panic.c.obj
[50/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32/bootloader_sha.c.obj
[51/97] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/esp32/esp_efuse_table.c.obj
[52/97] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/esp32/esp_efuse_fields.c.obj
[53/97] Building C object esp-idf/micro-ecc/CMakeFiles/__idf_micro-ecc.dir/uECC_verify_antifault.c.obj
[54/97] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_fields.c.obj
[55/97] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/esp32/esp_efuse_utility.c.obj
[56/97] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32/bootloader_esp32.c.obj
[57/97] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_api.c.obj
[58/97] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/efuse_controller/keys/without_key_purposes/three_key_blocks/esp_efuse_api_key.c.obj
[59/97] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/compare_set.c.obj
[60/97] Building C object esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/esp_err.c.obj
[61/97] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/cpu_util.c.obj
[62/97] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_pm.c.obj
[63/97] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_utility.c.obj
[64/97] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_clk_init.c.obj
[65/97] Building C object esp-idf/xtensa/CMakeFiles/__idf_xtensa.dir/eri.c.obj
[66/97] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/chip_info.c.obj
[67/97] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_init.c.obj
[68/97] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_crc.c.obj
[69/97] Building C object esp-idf/xtensa/CMakeFiles/__idf_xtensa.dir/xt_trax.c.obj
[70/97] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_time.c.obj
[71/97] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_sys.c.obj
[72/97] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_sleep.c.obj
[73/97] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32/rtc_wdt.c.obj
[74/97] Building C object esp-idf/esp_common/CMakeFiles/__idf_esp_common.dir/src/esp_err_to_name.c.obj
[75/97] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_tjpgd.c.obj
[76/97] Building ASM object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_longjmp.S.obj
[77/97] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_uart.c.obj
[78/97] Building C object esp-idf/log/CMakeFiles/__idf_log.dir/log_noos.c.obj
[79/97] Building C object esp-idf/log/CMakeFiles/__idf_log.dir/log.c.obj
[80/97] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/bootloader_start.c.obj
[81/97] Building C object esp-idf/log/CMakeFiles/__idf_log.dir/log_buffers.c.obj
[82/97] Linking C static library esp-idf/log/liblog.a
[83/97] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_spiflash.c.obj
[84/97] Linking C static library esp-idf/esp_rom/libesp_rom.a
[85/97] Linking C static library esp-idf/esp_common/libesp_common.a
[86/97] Linking C static library esp-idf/xtensa/libxtensa.a
[87/97] Linking C static library esp-idf/esp_hw_support/libesp_hw_support.a
[88/97] Linking C static library esp-idf/esp_system/libesp_system.a
[89/97] Linking C static library esp-idf/efuse/libefuse.a
[90/97] Linking C static library esp-idf/bootloader_support/libbootloader_support.a
[91/97] Linking C static library esp-idf/hal/libhal.a
[92/97] Linking C static library esp-idf/micro-ecc/libmicro-ecc.a
[93/97] Linking C static library esp-idf/soc/libsoc.a
[94/97] Linking C static library esp-idf/main/libmain.a
[95/97] Linking C executable bootloader.elf
[96/97] Generating binary image from built executable
esptool.py v3.3-dev
Creating esp32 image...
Merged 1 ELF section
Successfully created esp32 image.
Generated /home/antonio/Escritorio/Proyectos_GitHub/Autopiloto/LibelulaX/LibelulaXpilot/build/bootloader/bootloader.bin
[97/97] cd /home/antonio/Escritorio/Proyectos_GitHub/Autopiloto/LibelulaX/LibelulaXpilot/build/bootloader/esp-idf/esptool_py && /home/antonio/.espressif/python_env/idf4.3_py3.9_env/bin/python /home/antonio/esp/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x1000 /home/antonio/Escritorio/Proyectos_GitHub/Autopiloto/LibelulaX/LibelulaXpilot/build/bootloader/bootloader.bin
Bootloader binary size 0x6390 bytes. 0xc70 bytes (11%) free.
[857/861] Generating ld/sections.ld
FAILED: esp-idf/esp_system/ld/sections.ld /home/antonio/Escritorio/Proyectos_GitHub/Autopiloto/LibelulaX/LibelulaXpilot/build/esp-idf/esp_system/ld/sections.ld 
cd /home/antonio/Escritorio/Proyectos_GitHub/Autopiloto/LibelulaX/LibelulaXpilot/build/esp-idf/esp_system && /home/antonio/.espressif/python_env/idf4.3_py3.9_env/bin/python /home/antonio/esp/esp-idf/tools/ldgen/ldgen.py --config /home/antonio/Escritorio/Proyectos_GitHub/Autopiloto/LibelulaX/LibelulaXpilot/sdkconfig --fragments-list "/home/antonio/esp/esp-idf/components/esp_ringbuf/linker.lf;/home/antonio/esp/esp-idf/components/driver/linker.lf;/home/antonio/esp/esp-idf/components/esp_pm/linker.lf;/home/antonio/esp/esp-idf/components/spi_flash/linker.lf;/home/antonio/esp/esp-idf/components/esp_phy/linker.lf;/home/antonio/esp/esp-idf/components/esp_system/linker.lf;/home/antonio/esp/esp-idf/components/esp_system/app.lf;/home/antonio/esp/esp-idf/components/esp_rom/linker.lf;/home/antonio/esp/esp-idf/components/hal/linker.lf;/home/antonio/esp/esp-idf/components/esp_event/linker.lf;/home/antonio/esp/esp-idf/components/esp_wifi/linker.lf;/home/antonio/esp/esp-idf/components/lwip/linker.lf;/home/antonio/esp/esp-idf/components/log/linker.lf;/home/antonio/esp/esp-idf/components/heap/linker.lf;/home/antonio/esp/esp-idf/components/soc/linker.lf;/home/antonio/esp/esp-idf/components/esp_hw_support/linker.lf;/home/antonio/esp/esp-idf/components/xtensa/linker.lf;/home/antonio/esp/esp-idf/components/esp_common/common.lf;/home/antonio/esp/esp-idf/components/esp_common/soc.lf;/home/antonio/esp/esp-idf/components/freertos/linker.lf;/home/antonio/esp/esp-idf/components/newlib/newlib.lf;/home/antonio/esp/esp-idf/components/newlib/system_libs.lf;/home/antonio/esp/esp-idf/components/app_trace/linker.lf;/home/antonio/esp/esp-idf/components/bt/linker.lf;/home/antonio/esp/esp-idf/components/esp_gdbstub/linker.lf;/home/antonio/esp/esp-idf/components/espcoredump/linker.lf" --input /home/antonio/esp/esp-idf/components/esp_system/ld/esp32/sections.ld.in --output /home/antonio/Escritorio/Proyectos_GitHub/Autopiloto/LibelulaX/LibelulaXpilot/build/esp-idf/esp_system/ld/sections.ld --kconfig /home/antonio/esp/esp-idf/Kconfig --env-file /home/antonio/Escritorio/Proyectos_GitHub/Autopiloto/LibelulaX/LibelulaXpilot/build/config.env --libraries-file /home/antonio/Escritorio/Proyectos_GitHub/Autopiloto/LibelulaX/LibelulaXpilot/build/ldgen_libraries --objdump /home/antonio/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-objdump
Traceback (most recent call last):
  File "/home/antonio/esp/esp-idf/tools/ldgen/ldgen.py", line 16, in <module>
    from ldgen.entity import EntityDB
  File "/home/antonio/esp/esp-idf/tools/ldgen/ldgen/entity.py", line 12, in <module>
    from pyparsing import (Group, Literal, OneOrMore, ParseException, SkipTo, Suppress, White, Word, ZeroOrMore, alphas,
ImportError: cannot import name 'rest_of_line' from 'pyparsing' (/home/antonio/.espressif/python_env/idf4.3_py3.9_env/lib/python3.9/site-packages/pyparsing.py)
ninja: build stopped: subcommand failed.
ninja failed with exit code 1

Other items if possible

  • sdkconfig file (attach the sdkconfig file from your project folder)
  • elf file in the build folder (note this may contain all the code details and symbols of your project.)
  • coredump (This provides stacks of tasks.)
@Ampaex Ampaex changed the title Idf.py building python ImportError: cannot import name 'rest_of_line' from 'pyparsing'... Idf.py build -> python ImportError: cannot import name 'rest_of_line' from 'pyparsing'... Mar 2, 2022
@espressif-bot espressif-bot added the Status: Opened Issue is new label Mar 2, 2022
@github-actions github-actions bot changed the title Idf.py build -> python ImportError: cannot import name 'rest_of_line' from 'pyparsing'... Idf.py build -> python ImportError: cannot import name 'rest_of_line' from 'pyparsing'... (IDFGH-6867) Mar 2, 2022
@dobairoland
Copy link
Collaborator

Hi @Ampaex. Are you switching between ESP-IDF versions or have multiple copies in your computer?

The above issue is caused by the fact that v5.0 is compatible with a different version of pyparsing package. If you run install.sh then it should install the right version.

@dobairoland
Copy link
Collaborator

In case it is still not working then please share the output of install.sh and . export.sh.

@Ampaex
Copy link
Author

Ampaex commented Mar 3, 2022

Thanks for your help, I have already tried yesterday to run multiple times install.sh and export.sh, invoking get_idf on each console I started. Finally I ended up returning to v4.4 and it seems to work fine.

@dobairoland
Copy link
Collaborator

Ok, I see. So I assume you don't want to experiment anymore.

Just for future reference the following error indicates that you are running the environment of ESP-IDF v4.3 but using the code of ESP-IDF v5.0:

ImportError: cannot import name 'rest_of_line' from 'pyparsing' (/home/antonio/.espressif/python_env/idf4.3_py3.9_env/lib/python3.9/site-packages/pyparsing.py)

This error happen usually when the IDF_PATH environment variable is set to a different directory with a different version of ESP-IDF.

@dobairoland
Copy link
Collaborator

The issue could be in your get_idf alias which could be linked to the wrong directory.

@Ampaex
Copy link
Author

Ampaex commented Mar 3, 2022

The thing is I only have one repository in "$HOME/esp/esp-idf" and didn't tried any version before, just cloned the master repository two weeks ago.
My export is: export IDF_PATH=~/esp/esp-idf
(in .bashrc)

@Ampaex
Copy link
Author

Ampaex commented Mar 3, 2022

Sorry for not being able to provide more information, I'm in a project and need the compiler working asap.

@dobairoland
Copy link
Collaborator

Ok, I understand. We can get back to this if and when you will experience this issue again.

@espressif-bot espressif-bot added Resolution: Won't Do This will not be worked on Status: Done Issue is done internally and removed Status: Opened Issue is new labels Mar 3, 2022
@ferbar
Copy link

ferbar commented Mar 8, 2022

python 3.6:

 ~/bin/esp/esp-idf   master ●  ./install.sh esp32
Detecting the Python interpreter
Checking "python" ...
Checking "python3" ...
Python 3.6.15
"python3" has been detected
Traceback (most recent call last):
  File "/home/chris/bin/esp/esp-idf/tools/install_util.py", line 70, in <module>
    main()
  File "/home/chris/bin/esp/esp-idf/tools/install_util.py", line 55, in main
    subparsers = parser.add_subparsers(dest='action', required=True)
  File "/usr/lib64/python3.6/argparse.py", line 1707, in add_subparsers
    action = parsers_class(option_strings=[], **kwargs)
TypeError: __init__() got an unexpected keyword argument 'required'

with virtualenv for python 3.9:
ERROR: This script was called from a virtual environment, can not create a virtual environment again

python 3.6:
removing the required=True in esp-idf/tools/install_util.py", line 55 fixes the install.sh
./install.sh esp32
=> ok

rm -rf build in the project folder

idf.py -p /dev/ttyUSB0 flash monitor

=> issue solved for me.

@lwshowl
Copy link

lwshowl commented Apr 8, 2022

facing the same error on windows , i have previously installed esp-idf lower version on the desktop folder ,after deleting it and removing all the path variables ,i reinstalled esp-idf v5.0 on another directory, after running install.ps1 and export.ps1 the output of the export shows that the right path viariable is added , but after checking the PATH ,i found out that the former path to the lower idf is added even if the IDF_PATH is correct, i manually added the right path , the error still exist
i dont know if this have anything to do with windows

@lwshowl
Copy link

lwshowl commented Apr 8, 2022

Traceback (most recent call last):
File "H:\esp-idf\tools\ldgen\ldgen.py", line 16, in
from ldgen.entity import EntityDB
File "H:\esp-idf\tools\ldgen\ldgen\entity.py", line 12, in
from pyparsing import (Group, Literal, OneOrMore, ParseException, SkipTo, Suppress, White, Word, ZeroOrMore, alphas,
ImportError: cannot import name 'rest_of_line' from 'pyparsing' (C:\Users\xy\AppData\Local\Programs\Python\Python39\lib\site-packages\pyparsing.py)
[2/8] Performing build step for 'bootloader'
[1/1] cmd.exe /C "cd /D H:\esp32\esp32_ble_sensor\build\bootloader\esp-idf\esptool_py && C:\Users\xy\AppData\Local\Programs\Python\Python39\python.exe H:/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x0 H:/esp32/esp32_ble_sensor/build/bootloader/bootloader.bin"
Bootloader binary size 0x4e30 bytes. 0x31d0 bytes (39%) free.
ninja: build stopped: subcommand failed.

@lwshowl
Copy link

lwshowl commented Apr 8, 2022

image
image

@dobairoland
Copy link
Collaborator

@lwshowl The issue is cause propably by the existence of the last item in your list (with idf4.4_py3.8).

@jonathanfoster
Copy link

jonathanfoster commented Oct 24, 2022

Just ran into this issue myself. I upgraded from v4.4 to v5.0, deleted the entire .espressif directory, and installed and exported. I didn't even have the previous IDF version installed.

I was able to resolve my issue by manually activating the idf5.0_py3.10_env (source ~/.espressif/python_env/idf5.0_py3.10_env/bin/activate), running a fullclean (idf.py fullclean), then building the bootloader and app separately.

The issue appears to have something to do with the Python virtual env selection.

@jonathanfoster
Copy link

Looks like this issue was resolved just a few days ago (#9993). Temporary workaround is idf.py fullclean before you build.

@cyberman54
Copy link

Windows / VS-Code / Platformio users, look here:
https://esp32.com/viewtopic.php?f=13&t=31744&p=109394#p108741

@davec25
Copy link

davec25 commented May 29, 2023

File "/home/dave/esp/esp-idf/tools/ldgen/ldgen.py", line 16, in

from ldgen.entity import EntityDB

File "/home/dave/esp/esp-idf/tools/ldgen/ldgen/entity.py", line 12, in

from pyparsing import (Group, Literal, OneOrMore, ParseException, SkipTo, Suppress, White, Word, ZeroOrMore, alphas,

ImportError: cannot import name 'rest_of_line' from 'pyparsing' (/home/dave/esp/esp-matter/connectedhomeip/connectedhomeip/.environment/pigweed-venv/lib/python3.10/site-packages/pyparsing.py)

ninja: build stopped: subcommand failed.

I did a idf.py fullclean before I ran this build. Getting this while trying to build generic_switch.

@swdcom
Copy link

swdcom commented Dec 6, 2023


ImportError: cannot import name 'rest_of_line' from 'pyparsing' (/home/dave/esp/esp-matter/connectedhomeip/connectedhomeip/.environment/pigweed-venv/lib/python3.10/site-packages/pyparsing.py)

Take a close look at your python environment path: It is pointing to the virtual environment Matter/ConnectedHomeIP generated. Try to figure out where you espressif setup put its own environment and try to activate that, as jonathanforster suggested.

It would be much much easier if espressif an matter could use just one and the same virtual environment for their python stuff!

swg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Won't Do This will not be worked on Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

9 participants