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 Report]: using any spaces in filepath breaks ESP-IDF usage (VSC-921) #742

Closed
toybuilder opened this issue Jun 11, 2022 · 18 comments · Fixed by #761 or #1159
Closed

[Bug Report]: using any spaces in filepath breaks ESP-IDF usage (VSC-921) #742

toybuilder opened this issue Jun 11, 2022 · 18 comments · Fixed by #761 or #1159
Labels
bug-report Bug Report from users on Github (don't use this tag manually, its supposed to be used via the issue)

Comments

@toybuilder
Copy link

tl/dr; Fails horribly if you have any spaces in your filepath.

As someone that is still new with VS Code and with VSC+ESP-IDF, I had a frustrating time getting VSC+ESP-IDF to work. After spending about three hours, I finally got it to work.

There is one critical aspect in my experience: I had a space in my file path. Because I wanted to use ESP-IDF with a project for a client, the working directory included the client name which has a space in it.

This apparently was breaking the device-target selection and menuconfig operation. The error messages were cryptic and generally unhelpful. When trying to debug the menuconfig not working, the output session for menuconfig would close before I could read its contents.

I uninstalled and reinstalled the ESP-IDF extension a few times. I even uninstalled my standard ESP-IDF (the one launched from the desktop) and tried again.

It was only when I tried to open the example in a new directory that it worked. And it wasn't the path length.

That was three (or more) hours down the drain.

Perhaps it serves me right to use spaces in a path with coding tools. But I've had Arduino projects under the same client's directory which worked fine with Arduino-ESP32 (via Arduino), so I had no reason to believe that the VSC ESP32 tools wouldn't work in that same folder.

Now that I've gotten past this single detail that was proving to be a critical tripping point, I happily watched the build process run and build successfully.

To reproduce this, go through the steps of setting up the example Blink project, but in a directory with a space somewhere in the filepath.

Setting device-target yields:
image
-- Building ESP-IDF components for target esp32 -- Project sdkconfig file C:/Users/joech/esp/x 1/blink/sdkconfig Traceback (most recent call last): File "C:/Users/joech/esp/esp-idf/tools/kconfig_new/confgen.py", line 640, in <module> main() File "C:/Users/joech/esp/esp-idf/tools/kconfig_new/confgen.py", line 260, in main config = kconfiglib.Kconfig(args.kconfig) File "C:\Espressif\python_env\idf4.4_py3.8_env\lib\site-packages\kconfiglib.py", line 947, in __init__ self._init(filename, warn, warn_to_stderr, encoding) File "C:\Espressif\python_env\idf4.4_py3.8_env\lib\site-packages\kconfiglib.py", line 1085, in _init self._parse_block(None, self.top_node, self.top_node).next = None File "C:\Espressif\python_env\idf4.4_py3.8_env\lib\site-packages\kconfiglib.py", line 2982, in _parse_block prev = self._parse_block(None, parent, prev) File "C:\Espressif\python_env\idf4.4_py3.8_env\lib\site-packages\kconfiglib.py", line 2970, in _parse_block raise KconfigError( kconfiglib.KconfigError: C:/Users/joech/esp/x 1/blink/build/kconfigs_projbuild.in:6: 'C:/Users/joech/esp/x' not found (in 'source "C:/Users/joech/esp/x"'). Check that environment variables are set correctly (e.g. $srctree, which is unset or blank). Also note that unset environment variables expand to the empty string. CMake Error at C:/Users/joech/esp/esp-idf/tools/cmake/kconfig.cmake:266 (message): Failed to run confgen.py

Attempting to run menuconfig yields a progress-bar that gets stuck:
image

I would have expected things to work with spaces in the filepath; or at least some kind of warning/error complaining about the space.

FWIW, this is on Windows 10 with VSC 1.68.0, ESP-IDF 1.4.0

@toybuilder toybuilder added the bug-report Bug Report from users on Github (don't use this tag manually, its supposed to be used via the issue) label Jun 11, 2022
@github-actions github-actions bot changed the title [Bug Report]: using any spaces in filepath breaks ESP-IDF usage [Bug Report]: using any spaces in filepath breaks ESP-IDF usage (VSC-921) Jun 11, 2022
@brianignacio5
Copy link
Collaborator

We are very sorry for the trouble. The thing is, ESP-IDF itself still doesn't fully work with spaces in it so the extension also doesn't support spaces.. Arduino built is different so they do support it.

We will add space validation now, but at some point we will support spaces in environment variables, ESP-IDF and tools.

@toybuilder
Copy link
Author

Even before fixing the tools to add the space validation, it would be very helpful if your documentation is more explicit about spaces in the filepath. As someone is following along on the "getting started" step-by-step procedure, having a small warning about spaces would go a long way to avoid the pain of trying to figure out why things aren't working.

@toybuilder
Copy link
Author

toybuilder commented Jun 19, 2022

Oh, I just discovered today that the Git master branch of the IDF documentation includes a notice about not having spaces in the path -- apparently added about two months ago! However, I didn't see that as I was working off documentation for the stable 4.4.1 release version!

EDIT: Never mind, it's there. I just missed it while I was overwhelmed during my initial readings...

@github-actions
Copy link

This issue has been marked as stale since there are no activities, and this will be closed in 5 days if there are no further activities

@github-actions github-actions bot added the stale Stale PR or Issue label Jul 11, 2022
@brianignacio5 brianignacio5 removed the stale Stale PR or Issue label Jul 11, 2022
@Teneppa
Copy link

Teneppa commented May 16, 2023

I still have this issue when trying to install the Espressif IDF extension to VSCode. I have a space in my Windows username and the installation fails because of that.

Also there is a bug in the IDF_TOOL_PATH folder selection, if it fails because of the whitespace in path it can't be changed anymore. But if I open the ESP-IDF Setup again and change it right away then it lets me change the path.

@nweaver
Copy link

nweaver commented Jun 12, 2024

Issue still remains. Are there any intents to actually fix this? This is especially painful when the user account itself has spaces in the name.

@brianignacio5
Copy link
Collaborator

Did you try the latest master installer here ? We added spaces fix in #1159

@nweaver
Copy link

nweaver commented Jun 13, 2024

Used the extension from the VSCode extension collection, did not download directly.

@brianignacio5 brianignacio5 linked a pull request Jun 13, 2024 that will close this issue
5 tasks
@brianignacio5
Copy link
Collaborator

The next release v1.8.0 in marketplace will have these changes, but we are testing it right now since we added many new things.

@Ishan-Sharma-17
Copy link

image

Hi, has the issue been fixed yet? If not, is there any workaround this, since my username itself contains spaces

@brianignacio5
Copy link
Collaborator

It should already be fixed @Ishan-Sharma-17

@Ishan-Sharma-17
Copy link

Do you know why I could still be getting this error? I am using the Visual Studio code extension

@brianignacio5
Copy link
Collaborator

brianignacio5 commented Dec 12, 2024

The reason is that white spaces are not supported for the ESP-IDF Tools directory path. This could generate issues while building the project because it is not supported by some tools themselves.

@Ishan-Sharma-17
Copy link

Is there any workaround? My laptop username contains a space and I can't really change my laptop username

@brianignacio5
Copy link
Collaborator

You can use another location like C:\esp\.espressif

@Ishan-Sharma-17
Copy link

So espressif does not need to be installed in the same directory as visual studio code?

@brianignacio5
Copy link
Collaborator

No it doesn't. There are settings in the vscode extension (idf.toolsPath and idf.espIdfPath) saved in settings.json that are used to find where ESP-IDF and ESP-IDF Tools are located.

@Ishan-Sharma-17
Copy link

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-report Bug Report from users on Github (don't use this tag manually, its supposed to be used via the issue)
Projects
None yet
5 participants