So you bought a Raspberry Pico, hoping to upgrade your Arduino workflow to 32 bit, but you ran into problems almost immediately? Join the club…
When I tried to upload a simple sketch, I got an error message “Unable to build drive list”. The cause of this is simple, but fairly deeply rooted.
Short answer:
Cause: Your windows PATH has become corrupted, and is missing key references. This causes the compilation tools to fail as a result
Solution:
- Open the Environment Variables utility.
- In the System variables section, edit the PATH.
- Add the following individual lines back to the Path variable:
%SystemRoot%\system32\WBEM
C:\Windows\system32\WBEM
C:\Windows\system32
C:\Windows
C:\Windows\System32\WindowsPowerShell\v1.0\
C:\Program Files\PowerShell\7\
C:\Windows\System32\OpenSSH\
%UserProfile%\AppData\Local\Microsoft\WindowsAppsNote: If any of those are already there, don’t duplicate them.
- Now, save your changes, and close the Environment Variables utility.
- Close the Arduino IDE and relaunch.
- Try uploading your sketch again
Longer Answer:
The error that I was getting in the Arduino IDE was fairly obtuse: “Unable to build drive list”.
After a lot of digging, I narrowed this down. The python script that runs is in ~\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\2.5.0\tools\uf2conv.py
The error message above is caused by the failure of a command in that script. If you remove the exception handling you see the real error:
File "D:\obj\Windows-Release\37win32_Release\msi_python\zip_win32\subprocess.py", line 395, in check_output
File "D:\obj\Windows-Release\37win32_Release\msi_python\zip_win32\subprocess.py", line 472, in run
File "D:\obj\Windows-Release\37win32_Release\msi_python\zip_win32\subprocess.py", line 775, in init
File "D:\obj\Windows-Release\37win32_Release\msi_python\zip_win32\subprocess.py", line 1178, in _execute_child
FileNotFoundError: [WinError 2] The system cannot find the file specified
This is where things can easily start to get confusing. The debug symbols referencing the D drive are a red herring. Ignore them. However, the final line is correct: the system really cannot find the file!What is actually going on, is that the script uses the python module called “subprocess”, and tries to execute a number of commands. The file that it is unable to find is actually in reference to a call to launch powershell. Normally, powershell should be able to be launched from a command prompt (CMD), simply by typing “powershell” and hitting return. However, when I tried this in a command prompt, this was not working – very strange! What this actually indicated was a much deeper root issue: my Windows Path variable had become corrupted, which causes a series of failures in the Python 3 script, and eventually resulting in that error, when trying to upload a sketch in the Arduino IDE.
This was a very weird problem, and none of the many many forum posts I came across were able to pin down the root cause, hence this post. Hope this helps someone!
JoeK
Thank you!
Had the same problem with missing %PATH% entries.
admin
Awesome! That makes me really happy to hear it — thanks for commenting!
Amaldev
Hi, I had the same issue. Turns out it was a powershell issue.
I just needed to add the following to the path. Not all the things you mentioned.
C:\Windows\System32\WindowsPowerShell\v1.0\
I had raised a ticket for this on arduino-pico core and error message has now been corrected.
Thanks a lot for letting us know about this fix. I was totally lost for ideas till I stumbled upon this this post.
admin
Thanks for sharing Amaldev 🙂 — and thanks for taking it one step further to get the bug fixed properly!! 👏👏
Alfonso Favoretti Fonsseca
A dica das variáveis de ambiente funcionou perfeitamente para mim. Resposta do IDE Arduino após compilação:
Resetting COM5
Converting to uf2, output size: 142336, start address: 0x2000
Scanning for RP2040 devices
Flashing E: (RPI-RP2)
Wrote 142336 bytes to E:/NEW.UF2
Obrigado!!