Can't import pyserial or serial in python 3.4 2017-03 Debian

I tried to import serial or pyserial in python 3.4 to no avail:

debian@beaglebone:~$ python3
Python 3.4.2 (default, Oct 8 2014, 14:38:51)
[GCC 4.9.1] on linux
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import serial
Traceback (most recent call last):
File “”, line 1, in
ImportError: No module named ‘serial’
>>> import pyserial
Traceback (most recent call last):
File “”, line 1, in
ImportError: No module named ‘pyserial’

If I use python 2.7, then I can import serial but not pyserial:

debian@beaglebone:~$ python
Python 2.7.9 (default, Aug 13 2016, 17:56:53)
[GCC 4.9.2] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import pyserial
Traceback (most recent call last):
File “”, line 1, in
ImportError: No module named pyserial
>>> import serial
>>> ser = serial.Serial()

If I list modules with pip, I see pyserial:

debian@beaglebone:~$ pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
Adafruit-BBIO (1.0.3)
astroid (1.2.1)
blinker (1.3)
cffi (0.8.6)
chardet (2.3.0)
colorama (0.3.2)
cryptography (0.6.1)
dropbox (8.0.0)
Flask (0.10.1)
html5lib (0.999)
itsdangerous (0.24)
iw-parse (0.0.2)
Jinja2 (2.7.3)
logilab-common (0.62.0)
MarkupSafe (0.23)
ndg-httpsclient (0.3.2)
pip (9.0.1)
ply (3.4)
pyasn1 (0.1.7)
PyBBIO (0.10)
pycparser (2.10)
pygobject (3.14.0)
pyinotify (0.9.4)
pylint (1.3.1)
pyOpenSSL (0.14)
pyserial (3.3)
requests (2.13.0)
serbus (1.0.5)
setuptools (5.5.1)
six (1.8.0)
urllib3 (1.9.1)
Werkzeug (0.9.6)
wheel (0.24.0)

If I try to upgrade pyserial, I get error saying that I’ve already got the latest:

debian@beaglebone:~$ sudo pip install --upgrade pyserial
[sudo] password for debian:
Requirement already up-to-date: pyserial in /usr/local/lib/python2.7/dist-packages

Again, my goal is to user serial port on BBB preferably on Python 3.4 instead of 2.7. Right now, importing doesn’t work for serial and pyserial in 3.4. Thanks

On Tue, 27 Jun 2017 22:36:47 -0700 (PDT),
zliudr@gmail.com declaimed the following:

If I try to upgrade pyserial, I get error saying that I've already got the
latest:

*debian@beaglebone:~$ sudo pip install --upgrade pyserial[sudo] password
for debian: Requirement already up-to-date: pyserial in
/usr/local/lib/python2.7/dist-packages*
Again, my goal is to user serial port on BBB preferably on Python 3.4
instead of 2.7. Right now, importing doesn't work for serial and pyserial
in 3.4. Thanks

  Your default for pip is python2.7; you need to force it to run using
python3.4 in order to have it install the module in the 3.4 library.

  Unfortunately, I've not used pip enough to know how to do that; maybe
search for a 3.4 specific pip executable ("which pip" and then change any
2.7 in the path to 3.4)?

The python module in pyserial is called serial, so no mystery there.

To run a version of pip for your python3.4 you can use “python3 -m pip [pip args]”.

Thanks but this command produces an error:

debian@beaglebone:~$ python3 -m pip list
/usr/bin/python3: No module named pip

How do I install a pip3 or pip for python3? I tried a few combinations with apt-get and couldn’t find what to install. I thought that BBB is probably not optimized to run python3 code otherwise these facilities should have been in place for the average python person.

Best,

I think I figured this out. I needed to install pip3 aka python3-pip using apt-get. I’ve never done that my whole time using python on any OS. It took me a while to get the combination of python, pip, a dash, and 3 in the right order to get it to install. What’s the preferred programming language on BBB platform?

What’s the preferred programming language on BBB platform?