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
esptool fails on MacOS Big Sur preview: Failure to import serial.tools.list_ports #509
Comments
same issue here. NB, putting --port /dev/tty.usbserial-xxxxxxxx flash-id gives the same error. Thanks so much, I should know better than to upgrade my primary machine! |
Hi, esptool maintainer here. The underlying issue seems to be that The documentation suggests it's still supported and is synonymous with NULL, so replacing it will NULL (either always or in response to this ValueError) may be a fix? (Or may just result in a more important symbol failing to import.) I don't have a MacOS install I can check this on right now, but I'm following up with some colleagues who do. |
I’m a MacOS user with dev tools although I’m not a Mac dev per se - let me know how I can help if that adds value 👍
… On 27 Jun 2020, at 07:46, Angus Gratton ***@***.***> wrote:
Hi,
esptool maintainer here.
The underlying issue seems to be that kIOMasterPortDefault is no longer a defined symbol in the iokit library. Possibly it's been moved to a compile-time only constant instead of a library symbol...?
The documentation suggests it's still supported and is synonymous with NULL, so replacing it will NULL (either always or in response to this ValueError) may be a fix? (Or may just result in a more important symbol failing to import.)
I don't have a MacOS install I can check this on right now, but I'm following up with some colleagues who do.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
I tried setting pyserial/serial/tools/list_ports_osx.py Line 34 in 3a6ae5a
That resulting in the following AttributeError:
|
It looks like this is most likely the issue (the downstream espressif/esptool#540 issue is referenced there) is: https://bugs.python.org/issue41179 From the macOS Big Sur release notes (https://developer.apple.com/documentation/macos-release-notes/macos-big-sur-11-beta-release-notes):
|
The problem can be "ctypes" lib, for origin... |
…view References: #540 pyserial/pyserial#509 The fix will probably come in a Python update before the Big Sur final release, there is a bundle of PRs including an apparent fix for the underlying issue here: https://bugs.python.org/issue41100
Download: https://github.com/espressif/esptool/blob/cb2060c0d768da38c9aa463e315e187a91f761f8/esptool.py |
@dbartelmus I tried this |
The patch works, however the path may be different. The actual path of the esptool.py is displayed on the build log. |
Folks, please keep in mind that this issue is on the (pyserial is the library that esptool uses to access the serial port, and the error is coming from that library. However the pyserial maintainers aren't expected to know anything about esptool and most of this discussion is totally off topic for pyserial.) The issue in esptool is here, and a workaround has been committed to the esptool development version already (see linked comment). There is also some discussion in that issue about how to apply this change to Arduino for ESP32: @jeksys Would you be able to please edit the title of this issue to something like "Failure to import serial.tools.list_ports on MacOS Big Sur preview"? It may help guide esptool users to the other issue. |
@jeksys Sorry, I didn't explain well enough: I mean to remove the mention of "esptool" from the title. Because the problem on the pyserial side is not really to do with esptool, the steps to reproduce are as simple as installing pyserial and then doing run |
I'm not confused by the esptool, I've actually used it myself ;-) The issue seems to be the same as #518 |
…view References: #540 pyserial/pyserial#509 The fix will probably come in a Python update before the Big Sur final release, there is a bundle of PRs including an apparent fix for the underlying issue here: https://bugs.python.org/issue41100
I've put up a PR to address this in pyserial. |
Doesn't work for me. I get this error in Arduino: Any other things I could try? |
Can you confirm that pyserial is installed one your device? |
Yes. I even updated it just now to be certain. Here's what Terminal says: |
Arduino has own copy of Python libraries in different location. I don't have Arduino installed currently, so you must find proper path by yourself. |
A better fix for this is to install a new version of Python with brew, which has been patched, this fixes it when using esptool.py directly, but esptool through Arduino also requires replacing the binary esptool in the Arduino ESP32 package with the source script. Since I upgraded rather than doing a fresh install, I had another bug where brew failed because the Command Line Tools was too old, but software update thought it was current. So had to delete the old CommandLineTools in /Library/Developer/CommandLineTools. I also reinstalled Xcode to be safe. After deleting the CommandLineTools directory, do Then if you don't have it, get Homebrew (at http://brew.sh/), and do
This should then install a non-broken Python, you'll probably have to add You may need to install pyserial with To fix Arduino, you'll need to download the esptool.py source here: https://github.com/espressif/esptool/blob/master/esptool.py Open This might be enough to fix it. If you still get the same Credit to Loumikas below for the last part! Hope that helps someone. |
It has already been fixed in Python's repo (by Apple themselves) but it seems Apple are shipping an old version pf Python in Big Sur without the fix... |
I got it to work by installing pre-release version of pyserial with pip: |
I just did that... and I also did What am I doing wrong? |
I could be wrong, but it might be situation where epstool.py (in your case located /Users/Username/Library/Arduino15/packages/esp32/tools/esptool_py/2.6.1/esptool.py ) is using a different python interpreter, which has an older version of pyserial. If you open epstool.py and check first line, it should tell you which interpreter is being used. For example: Then you could try directly invoking that python interpreter and seeing if following works: If you get an error, then that means that particular interpreter does not have the pre-release version of pyserial installed. If that happens to be the case, you will need to install it e.g. NOTE: I am using |
Right! My first line in esptool.py is this: So then I tried what you said and got this:
I guess this is an error... now I'm trying to figure out what exactly I need to type in to get this to work but my path is quite different to yours, so I tried this but I'm obviously doing something wrong:
I'm sorry I'm not a programmer by any definition, any chance you could just write down something I could copy paste into Terminal? |
This worked!! Thank you so much. I tried a variation of this before but I must have used the wrong path. Wow I thought this was never going to work. |
No probs, glad it worked! :) I'll edit my original comment to clarify for others. |
I think you need |
should be fixed by v3.5 |
Heyyy, fork/exec /Users/Mxy/Library/Arduino15/packages/esp32/tools/esptool_py/2.6.1/esptool: no such file or directory |
woo, found it was problem with extension. However i get a new error saying that permission denied ;(( |
You probably need to use
|
thanks for the fast reply! i forgot to add that... Traceback (most recent call last): |
i changed to the USBtoUART port and it worked!! |
Good to hear you fixed it! Looks like you probably had a terminal window open with screen or something similar using the port already. Maybe Arduino’s serial monitor, though that usually deactivates upon upload |
This worked for me! My esptool location was a little different, I'm using 'portable', and I didn't need to enable the execute bit, it was already on. Thanks for the instructions. |
This appears to be fixed in version 3.5 of pyserial. I did a |
Thanks for posting this, this got me working on Big Sur after pulling my hair out. I followed all the instructions but skipped this step
I can now flash and update my firmware. |
Force pyserial version 3.5+ because 3.4 and earlier versions fail on Big Sur with Python 3.8. pyserial bug: pyserial/pyserial#509 Bug tracking Python 3.9 support in LUCI/CIPD: crbug.com/1176014 Change-Id: I87a057e668394329655a8e75e1e17c98182f3a14 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/32126 Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com> Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com> Reviewed-by: Mark Rawling <mwr@google.com> Reviewed-by: Anthony DiGirolamo <tonymd@google.com>
As an M1 Big Sur user, I found the similar issue when I ran Traceback (most recent call last):
[......]
ValueError: dlsym(RTLD_DEFAULT, kIOMasterPortDefault): symbol not found However, when I navigated to /Users/p.xing/Library/Arduino15/packages/esp32/tools/esptool_py I found I actually have v3.0.0 esptool (Arduino IDE v1.8.13) installed instead of the 2.6.1 one. So, just incase you have the same situation. You can follow the below instructions to fix the issue.
|
hello, I am getting in line with this issue... When I try to upload code anyways I get this error message:
I am working on BigSur 11.4 , Arduino 1.8.15 and using the AI-Thinker ESP32 Cam connect through an FTDI Board. Does anyone have an idea what I did wrong? thanks in advance |
A file initialised with a dot is usually hidden in Finder by default in macOS, which is why you can't find it. So to modify it, you could use echo "#esptool v3.0 \nexport PATH="\$PATH:/Users/$USER/Library/Arduino15/packages/esp32/tools/esptool_py/3.0.0"" >> ~/.zshrc |
Got it working with a different board, so it must have something to do with the ftdi |
I have solved the issue for Arduino on MacOS with the error related to no serial by below steps:
then Arduino started working as the issue was that python delivered with Xcode had no serial module installed |
as indicated @homonto done same thing Monterey on mac M1 just
|
esptool fails on calling pyserial on MacOS Big Sur with dlsym(RTLD_DEFAULT, kIOMasterPortDefault): symbol not found (#540)
esptool.py chip_id
See reported issue for esptool
espressif/esptool#540 (comment)
The text was updated successfully, but these errors were encountered: