ssh chispa git clone git@github.com:trebisky/Spectro.git cd Spectro ./guiThe first thing that arises is that I need "wx", so ...
brew install wxpythonThis pulls in 14 packages.
Now I need "serial" for python. You would think that "brew install pyserial" would just work, but there are some weird issues for no apparent reason.
Just using "pip3" scolds me that my environment is managed outside of pip (namely by brew). I try "brew install serial" and this installs a serial "cask", but python is still lost.
The recommendation is to use a virtual enviroment.
Not knowing any better, I gave it a try.
brew install pipx pipx install pyserial pipx ensurepathThe last command adds /Users/tom/.local/bin to the PATH environment variable, which apparently is important. I need to log out and back in again to get the new PATH. After doing this, it is again looking for wxpython. And using "pipx install wxpython" gives some crazy error about building wheels.
Here is an "explanation" of pipx. It all sounds nice, sort of, if it only worked. On a moments reflection, any intelligent person will realize that we already have too many package managers, and there is no sense in adding yet another, especially when it does not work
So, away with it!brew uninstall pipxThis is a good first step perhaps, but it still has roots and has left its dirty footprints all over my nice clean floor. We can also do this:
rm -rf .localWe also edit .bashrc to get rid of the addition to our PATH. We do the same for .bash_profile
brew uninstall wxpython brew install wxpythonBut still "import wx" from inside python3 fails. We abandon all this and learn how to use virtual environments.
I'll go with a rant at this point. This kind of thing is one of the weak points of python, as well as other parts of the open source world. Fragmentation is bad. A multitude of package managers (here we have brew, pip, pipx, as well as the regular software installed by Apple) that cannot get along with each other spells misery for evryone. No doubt someone is busy right now working on yet another package manager for python.
cd ~/Spectro python3 -m venv venv source venv/bin/activate (venv) tom@chispa: pip install --upgrade pip pip install wxpython pip install pyserialThis is easy and it works.
I plug the device into my linux system, and see:
Oct 10 16:40:19 trona kernel: usb 1-1.3: new full-speed USB device number 77 using ehci-pci Oct 10 16:40:19 trona kernel: usb 1-1.3: New USB device found, idVendor=067b, idProduct=23a3, bcdDevice= 3.05 Oct 10 16:40:19 trona kernel: usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3 Oct 10 16:40:19 trona kernel: usb 1-1.3: Product: USB-Serial Controller Oct 10 16:40:19 trona kernel: usb 1-1.3: Manufacturer: Prolific Technology Inc. Oct 10 16:40:19 trona kernel: usb 1-1.3: SerialNumber: DCBBb132J03 Oct 10 16:40:19 trona kernel: usbcore: registered new interface driver pl2303 Oct 10 16:40:19 trona kernel: usbserial: USB Serial support registered for pl2303 Oct 10 16:40:19 trona kernel: pl2303 1-1.3:1.0: pl2303 converter detected Oct 10 16:40:19 trona kernel: usb 1-1.3: pl2303 converter now attached to ttyUSB0So it is based on a Prolific pl2303 chip. Apparently Apple doesn't include a driver for this like linux does. I have to go find it and figure out how to install it.
I need to go to the Apple App store. I click on the apple at the upper left corner. This gives a menu with "App store" easy to find. I type "prolific serial" into the search entry and among the things it finds I see PL2303 serial. I select "get", then "install". I see the applications icon in the Doc hop up and down. (Lucky me).
I find "Prolific Serial" among the applications and select it. It will apparently install the driver for one time use right now -- or (as it coaches me) I can enable it in "Login items and extensions", which is certainly a good idea. It gives me a button to go to System Settings and there it is with a switch alongside, which I enable.
I plug it in and type:
ls -lrt /dev crw-rw-rw- 1 root wheel 0x9000006 Oct 10 16:54 tty.PL2303G-USBtoUART130 crw-rw-rw- 1 root wheel 0x9000007 Oct 10 16:54 cu.PL2303G-USBtoUART130A suggestion is to do this -- and we may need to because MacOS may assign a different name each time we plug it in.
ls /dev/{cu,tty}.P*
source venv/bin/activate ./guiAnd now we do.