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

Running "hardware-check" reports "This script was called from a virtual environment, can not create a virtual environment again" error #232

Closed
gudaoxuri opened this issue Jan 17, 2024 · 2 comments

Comments

@gudaoxuri
Copy link

Environment

esp-idf : v5.1.2
Rust : 1.75.0
OS: Windows 11

Steps

  • Open ESP-IDF 5.1 CMD and go to the hardware-check directory
  • Execute cargo build

Error message

   Compiling compiler_builtins v0.1.103
   Compiling proc-macro2 v1.0.76
   Compiling unicode-ident v1.0.12
   Compiling core v0.0.0 (C:\Users\i\.rustup\toolchains\nightly-2023-11-14-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core)
   Compiling libc v0.2.150
   Compiling std v0.0.0 (C:\Users\i\.rustup\toolchains\nightly-2023-11-14-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std)
   Compiling serde v1.0.195
   Compiling windows_x86_64_msvc v0.48.5
   Compiling windows_x86_64_msvc v0.52.0
   Compiling memchr v2.7.1
   Compiling winapi v0.3.9
   Compiling crossbeam-utils v0.8.19
   Compiling syn v1.0.109
   Compiling regex-syntax v0.8.2
   Compiling glob v0.3.1
   Compiling windows_x86_64_msvc v0.42.2
   Compiling cfg-if v1.0.0
   Compiling rustversion v1.0.14
   Compiling anyhow v1.0.75
   Compiling aho-corasick v1.1.2
   Compiling libc v0.2.152
   Compiling rustix v0.38.30
   Compiling clang-sys v1.7.0
   Compiling log v0.4.20
   Compiling windows-targets v0.52.0
   Compiling stable_deref_trait v1.2.0
   Compiling windows-targets v0.48.5
   Compiling windows-sys v0.52.0
   Compiling as-slice v0.2.1
   Compiling windows-sys v0.48.0
   Compiling bstr v1.9.0
   Compiling thiserror v1.0.56
   Compiling once_cell v1.19.0
   Compiling minimal-lexical v0.2.1
   Compiling bitflags v2.4.1
   Compiling quote v1.0.35
   Compiling crossbeam-epoch v0.9.18
   Compiling heck v0.4.1
   Compiling syn v2.0.48
   Compiling semver v1.0.21
   Compiling serde_json v1.0.111
   Compiling crossbeam-deque v0.8.5
   Compiling nom v7.1.3
   Compiling aligned v0.4.1
   Compiling windows-targets v0.42.2
   Compiling cvt v0.1.2
   Compiling regex-automata v0.4.3
   Compiling bitflags v1.3.2
   Compiling itoa v1.0.10
   Compiling bindgen v0.63.0
   Compiling ryu v1.0.16
   Compiling either v1.9.0
   Compiling lazy_static v1.4.0
   Compiling windows-sys v0.45.0
   Compiling peeking_take_while v0.1.2
   Compiling shlex v1.2.0
   Compiling lazycell v1.3.0
   Compiling rustc-hash v1.1.0
   Compiling fastrand v2.0.1
   Compiling cc v1.0.83
   Compiling camino v1.1.6
   Compiling fnv v1.0.7
   Compiling autocfg v1.1.0
   Compiling winapi-util v0.1.6
   Compiling ident_case v1.0.1
   Compiling cmake v0.1.50
   Compiling unicode-xid v0.2.4
   Compiling same-file v1.0.6
   Compiling walkdir v2.4.0
   Compiling const_format_proc_macros v0.2.32
   Compiling errno v0.3.8
   Compiling libloading v0.8.1
   Compiling home v0.5.9
   Compiling normpath v1.1.1
   Compiling which v4.4.2
   Compiling fs_at v0.1.10
   Compiling cexpr v0.6.0
   Compiling tempfile v3.9.0
   Compiling globset v0.4.14
   Compiling regex v1.10.2
   Compiling ignore v0.4.22
   Compiling remove_dir_all v0.8.2
   Compiling filetime v0.2.23
   Compiling darling_core v0.20.3
   Compiling num-traits v0.2.17
   Compiling embassy-sync v0.3.0
   Compiling version_check v0.9.4
   Compiling globwalk v0.8.1
   Compiling uncased v0.9.9
   Compiling chrono v0.4.31
   Compiling strum_macros v0.24.3
   Compiling serde_derive v1.0.195
   Compiling thiserror-impl v1.0.56
   Compiling darling_macro v0.20.3
   Compiling num_enum_derive v0.7.2
   Compiling build-time v0.1.3
   Compiling darling v0.20.3
   Compiling enumset_derive v0.8.1
   Compiling strum v0.24.1
   Compiling rustc-std-workspace-core v1.99.0 (C:\Users\i\.rustup\toolchains\nightly-2023-11-14-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\rustc-std-workspace-core)
   Compiling alloc v0.0.0 (C:\Users\i\.rustup\toolchains\nightly-2023-11-14-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\alloc)
   Compiling rustc-demangle v0.1.23
   Compiling unwind v0.0.0 (C:\Users\i\.rustup\toolchains\nightly-2023-11-14-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\unwind)
   Compiling rustc-std-workspace-alloc v1.99.0 (C:\Users\i\.rustup\toolchains\nightly-2023-11-14-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\rustc-std-workspace-alloc)
   Compiling panic_abort v0.0.0 (C:\Users\i\.rustup\toolchains\nightly-2023-11-14-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\panic_abort)
   Compiling panic_unwind v0.0.0 (C:\Users\i\.rustup\toolchains\nightly-2023-11-14-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\panic_unwind)
   Compiling std_detect v0.1.5 (C:\Users\i\.rustup\toolchains\nightly-2023-11-14-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\stdarch\crates\std_detect)
   Compiling hashbrown v0.14.2
   Compiling cargo-platform v0.1.6
   Compiling envy v0.4.2
   Compiling toml v0.5.11
   Compiling rustc_version v0.4.0
   Compiling heapless v0.7.17
   Compiling embuild v0.31.4
   Compiling cargo_metadata v0.15.4
   Compiling toml-cfg v0.1.3
   Compiling proc_macro v0.0.0 (C:\Users\i\.rustup\toolchains\nightly-2023-11-14-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\proc_macro)
   Compiling nb v1.1.0
   Compiling byteorder v1.5.0
   Compiling futures-core v0.3.30
   Compiling futures-task v0.3.30
   Compiling pin-project-lite v0.2.13
   Compiling pin-utils v0.1.0
   Compiling futures-util v0.3.30
   Compiling nb v0.1.3
   Compiling embedded-hal v1.0.0-rc.1
   Compiling const_format v0.2.32
   Compiling enumset v1.1.3
   Compiling atomic-waker v1.1.2
   Compiling void v1.0.2
   Compiling hash32 v0.2.1
   Compiling embedded-io v0.6.1
   Compiling critical-section v1.1.2
   Compiling embedded-hal-nb v1.0.0-rc.1
   Compiling embedded-hal v0.2.7
   Compiling embedded-can v0.4.1
   Compiling num_enum v0.7.2
   Compiling no-std-net v0.5.0
   Compiling embassy-futures v0.1.1
   Compiling bytemuck v1.14.0
   Compiling esp-idf-sys v0.33.7
   Compiling esp-idf-hal v0.42.5
   Compiling esp-idf-svc v0.47.3
   Compiling wifi v0.1.0 (C:\embedded\common\lib\wifi)
   Compiling rgb-led v0.1.0 (C:\embedded\common\lib\rgb-led)
   Compiling rgb v0.8.37
   Compiling hardware-check v0.1.0 (C:\embedded\intro\hardware-check)
   Compiling embedded-svc v0.26.4
The following warnings were emitted during compilation:

warning: esp-idf-sys@0.33.7: (esp-idf-sys) Too long output directory: `\\?\C:\embedded\intro\hardware-check\target\riscv32imc-esp-espidf\debug\build\esp-idf-sys-24e6894e056be4c0\out`. Shorten your project path down to no more than 10 characters (or use WSL2 and its native Linux filesystem). Note that tricks like Windows `subst` do NOT work!
warning: esp-idf-sys@0.33.7: Configuring first supported MCU 'esp32c3' derived from the build target 'riscv32imc-esp-espidf' supporting MCUs [esp32c3, esp32c2]; explicitly specify an MCU to resolve this ambiguity
warning: esp-idf-sys@0.33.7: Ignoring activated esp-idf environment: ESP_IDF_TOOLS_INSTALL_DIR != fromenv
warning: esp-idf-sys@0.33.7: Ignoring configuration setting `ESP_IDF_VERSION` (Tag v5.1): custom esp-idf repository detected via $IDF_PATH

error: failed to run custom build command for `esp-idf-sys v0.33.7`

Caused by:
  process didn't exit successfully: `C:\embedded\intro\hardware-check\target\debug\build\esp-idf-sys-54c971eee2ea9354\build-script-build` (exit code: 1)
  --- stdout
  cargo:warning=(esp-idf-sys) Too long output directory: `\\?\C:\embedded\intro\hardware-check\target\riscv32imc-esp-espidf\debug\build\esp-idf-sys-24e6894e056be4c0\out`. Shorten your project path down to no more than 10 characters (or use WSL2 and its native Linux filesystem). Note that tricks like Windows `subst` do NOT work!
  cargo:rerun-if-env-changed=ESP_IDF_TOOLS_INSTALL_DIR
  cargo:rerun-if-env-changed=ESP_IDF_SDKCONFIG
  cargo:rerun-if-env-changed=ESP_IDF_SDKCONFIG_DEFAULTS
  cargo:rerun-if-env-changed=MCU
  cargo:rerun-if-env-changed=ESP_IDF_SYS_ROOT_CRATE
  cargo:rerun-if-env-changed=ESP_IDF_VERSION
  cargo:rerun-if-env-changed=ESP_IDF_REPOSITORY
  cargo:rerun-if-env-changed=ESP_IDF_CMAKE_GENERATOR
  cargo:rerun-if-env-changed=IDF_PATH
  cargo:rerun-if-env-changed=EXTRA-COMPONENTS
  cargo:rerun-if-env-changed=ESP_IDF_COMPONENTS
  cargo:rerun-if-env-changed=ESP_IDF_COMPONENT_MANAGER
  cargo:warning=Configuring first supported MCU 'esp32c3' derived from the build target 'riscv32imc-esp-espidf' supporting MCUs [esp32c3, esp32c2]; explicitly specify an MCU to resolve this ambiguity
  cargo:warning=Ignoring activated esp-idf environment: ESP_IDF_TOOLS_INSTALL_DIR != fromenv
  cargo:warning=Ignoring configuration setting `ESP_IDF_VERSION` (Tag v5.1): custom esp-idf repository detected via $IDF_PATH

  --- stderr
  Build configuration: BuildConfig {
      esp_idf_tools_install_dir: Some(
          Global,
      ),
      esp_idf_sdkconfig: None,
      esp_idf_sdkconfig_defaults: Some(
          [
              "C:\\embedded\\intro\\hardware-check\\./sdkconfig.defaults",
          ],
      ),
      mcu: None,
      native: NativeConfig {
          esp_idf_version: Some(
              Tag(
                  "v5.1",
              ),
          ),
          esp_idf_repository: None,
          esp_idf_cmake_generator: None,
          idf_path: Some(
              "C:\\Espressif\\frameworks\\esp-idf-v5.1.2",
          ),
          extra_components: [],
          esp_idf_components: None,
          esp_idf_component_manager: None,
      },
      esp_idf_sys_root_crate: None,
  }
  Using custom user-supplied esp-idf repository at 'C:\Espressif\frameworks\esp-idf-v5.1.2' (detected from env variable `IDF_PATH`)
  ERROR: This script was called from a virtual environment, can not create a virtual environment again
  Error: Could not install esp-idf

  Caused by:
      command '"python" "C:\\Espressif\\frameworks\\esp-idf-v5.1.2\\tools\\idf_tools.py" "--idf-path" "C:\\Espressif\\frameworks\\esp-idf-v5.1.2" "--non-interactive" "install-python-env"' exited with non-zero status code 1

But the “Hello World” program is fine ( https://esp-rs.github.io/book/writing-your-own-application/generate-project/esp-idf-template.html )

What can I do to solve this?

@SergioGasquez
Copy link
Member

Please, try following the instructions in https://esp-rs.github.io/std-training/02_2_software.html#rust-toolchain and don't use an activated ESP-IDF, unless you are willing to modify the .cargo/config.toml of the projects (See https://github.com/esp-rs/esp-idf-sys/blob/master/BUILD-OPTIONS.md#esp_idf_tools_install_dir-esp_idf_tools_install_dir)

@gudaoxuri
Copy link
Author

Please, try following the instructions in https://esp-rs.github.io/std-training/02_2_software.html#rust-toolchain and don't use an activated ESP-IDF, unless you are willing to modify the .cargo/config.toml of the projects (See https://github.com/esp-rs/esp-idf-sys/blob/master/BUILD-OPTIONS.md#esp_idf_tools_install_dir-esp_idf_tools_install_dir)

It's working. Thanks.

@github-project-automation github-project-automation bot moved this from Todo to Done in esp-rs Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants