How to fix PyVISA "No module named 'serial.tools'"
Problem:
You want to use an ASRL (serial) instrument in PyVISA, but when you run
example.sh
python3 -m visa info
you get this output even though you have serial
installed:
example.txt
ASRL INSTR:
Please install PySerial (>=3.0) to use this resource type.
No module named 'serial.tools'
Solution
You have installed serial
but you need to install pyserial
- they are not the same!
First you need to remove the system package python3-serial
if installed. Example for Ubuntu/Debian:
example.sh
sudo apt remove python3-serial
and also remove the pip serial
package if installed
example.sh
pip uninstall serial
Then install pyserial
:
example.sh
pip install -U pyserial
You can check if PySerial is installed properly using
example.sh
python3 -m visa info
It should show you
example.txt
ASRL INSTR: Available via PySerial (3.4)
once pyserial
is installed correctly!
***Note:***The commands above are for Python 3.x. In case you are still using Python 2.x use pip2
instead of pip
and use python-serial
instead of python3-serial
as APT package name.
Check out similar posts by category:
Electronics, Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow