Python Forum
Failed attempt to install pyserial
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Failed attempt to install pyserial
#1
I got pyserial-3.4.tar.gz from https://pypi.python.org/pypi/pyserial .
I untarred it.
As root, I changed to its directory and ran
python setup.py install
and got the output listed at the end.
I didn't see any complaints.
From another command line, not as root, I tried to import serial interactively:
Error:
[hennebry@localhost ~]$ python Python 2.6.6 (r266:84292, Aug 18 2016, 15:13:37) [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> imort serial File "<stdin>", line 1 imort serial ^ SyntaxError: invalid syntax >>> import serial Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.6/site-packages/serial/__init__.py", line 11, in <module> import importlib ImportError: No module named importlib >>>
How much damage did I do?
Can I fix it?
Is this a Python 2/3 thing?
For some reason,
I was under the impression that pyserial was Python 2/3 agnostic.
I'm on Python 2 because that is what centos 6 has.
Output:
[root@localhost pyserial-3.4]# python setup.py install running install running build running build_py creating build creating build/lib creating build/lib/serial copying serial/rs485.py -> build/lib/serial copying serial/serialwin32.py -> build/lib/serial copying serial/serialposix.py -> build/lib/serial copying serial/win32.py -> build/lib/serial copying serial/serialcli.py -> build/lib/serial copying serial/serialutil.py -> build/lib/serial copying serial/rfc2217.py -> build/lib/serial copying serial/serialjava.py -> build/lib/serial copying serial/__init__.py -> build/lib/serial creating build/lib/serial/tools copying serial/tools/hexlify_codec.py -> build/lib/serial/tools copying serial/tools/list_ports_common.py -> build/lib/serial/tools copying serial/tools/list_ports.py -> build/lib/serial/tools copying serial/tools/list_ports_windows.py -> build/lib/serial/tools copying serial/tools/list_ports_osx.py -> build/lib/serial/tools copying serial/tools/list_ports_posix.py -> build/lib/serial/tools copying serial/tools/miniterm.py -> build/lib/serial/tools copying serial/tools/__init__.py -> build/lib/serial/tools copying serial/tools/list_ports_linux.py -> build/lib/serial/tools creating build/lib/serial/urlhandler copying serial/urlhandler/protocol_hwgrep.py -> build/lib/serial/urlhandler copying serial/urlhandler/protocol_rfc2217.py -> build/lib/serial/urlhandler copying serial/urlhandler/protocol_serve-rfc2217.py -> build/lib/serial/urlhandler copying serial/urlhandler/protocol_spy.py -> build/lib/serial/urlhandler copying serial/urlhandler/protocol_loop.py -> build/lib/serial/urlhandler copying serial/urlhandler/protocol_alt.py -> build/lib/serial/urlhandler copying serial/urlhandler/protocol_socket.py -> build/lib/serial/urlhandler copying serial/urlhandler/__init__.py -> build/lib/serial/urlhandler creating build/lib/serial/threaded copying serial/threaded/__init__.py -> build/lib/serial/threaded running build_scripts creating build/scripts-2.6 copying and adjusting serial/tools/miniterm.py -> build/scripts-2.6 changing mode of build/scripts-2.6/miniterm.py from 644 to 755 running install_lib creating /usr/lib/python2.6/site-packages/serial copying build/lib/serial/rs485.py -> /usr/lib/python2.6/site-packages/serial copying build/lib/serial/serialwin32.py -> /usr/lib/python2.6/site-packages/serial creating /usr/lib/python2.6/site-packages/serial/tools copying build/lib/serial/tools/hexlify_codec.py -> /usr/lib/python2.6/site-packages/serial/tools copying build/lib/serial/tools/list_ports_common.py -> /usr/lib/python2.6/site-packages/serial/tools copying build/lib/serial/tools/list_ports.py -> /usr/lib/python2.6/site-packages/serial/tools copying build/lib/serial/tools/list_ports_windows.py -> /usr/lib/python2.6/site-packages/serial/tools copying build/lib/serial/tools/list_ports_osx.py -> /usr/lib/python2.6/site-packages/serial/tools copying build/lib/serial/tools/list_ports_posix.py -> /usr/lib/python2.6/site-packages/serial/tools copying build/lib/serial/tools/miniterm.py -> /usr/lib/python2.6/site-packages/serial/tools copying build/lib/serial/tools/__init__.py -> /usr/lib/python2.6/site-packages/serial/tools copying build/lib/serial/tools/list_ports_linux.py -> /usr/lib/python2.6/site-packages/serial/tools creating /usr/lib/python2.6/site-packages/serial/threaded copying build/lib/serial/threaded/__init__.py -> /usr/lib/python2.6/site-packages/serial/threaded copying build/lib/serial/serialposix.py -> /usr/lib/python2.6/site-packages/serial copying build/lib/serial/win32.py -> /usr/lib/python2.6/site-packages/serial copying build/lib/serial/serialcli.py -> /usr/lib/python2.6/site-packages/serial copying build/lib/serial/serialutil.py -> /usr/lib/python2.6/site-packages/serial copying build/lib/serial/rfc2217.py -> /usr/lib/python2.6/site-packages/serial copying build/lib/serial/serialjava.py -> /usr/lib/python2.6/site-packages/serial copying build/lib/serial/__init__.py -> /usr/lib/python2.6/site-packages/serial creating /usr/lib/python2.6/site-packages/serial/urlhandler copying build/lib/serial/urlhandler/protocol_hwgrep.py -> /usr/lib/python2.6/site-packages/serial/urlhandler copying build/lib/serial/urlhandler/protocol_rfc2217.py -> /usr/lib/python2.6/site-packages/serial/urlhandler copying build/lib/serial/urlhandler/protocol_serve-rfc2217.py -> /usr/lib/python2.6/site-packages/serial/urlhandler copying build/lib/serial/urlhandler/protocol_spy.py -> /usr/lib/python2.6/site-packages/serial/urlhandler copying build/lib/serial/urlhandler/protocol_loop.py -> /usr/lib/python2.6/site-packages/serial/urlhandler copying build/lib/serial/urlhandler/protocol_alt.py -> /usr/lib/python2.6/site-packages/serial/urlhandler copying build/lib/serial/urlhandler/protocol_socket.py -> /usr/lib/python2.6/site-packages/serial/urlhandler copying build/lib/serial/urlhandler/__init__.py -> /usr/lib/python2.6/site-packages/serial/urlhandler byte-compiling /usr/lib/python2.6/site-packages/serial/rs485.py to rs485.pyc byte-compiling /usr/lib/python2.6/site-packages/serial/serialwin32.py to serialwin32.pyc byte-compiling /usr/lib/python2.6/site-packages/serial/tools/hexlify_codec.py to hexlify_codec.pyc byte-compiling /usr/lib/python2.6/site-packages/serial/tools/list_ports_common.py to list_ports_common.pyc byte-compiling /usr/lib/python2.6/site-packages/serial/tools/list_ports.py to list_ports.pyc byte-compiling /usr/lib/python2.6/site-packages/serial/tools/list_ports_windows.py to list_ports_windows.pyc byte-compiling /usr/lib/python2.6/site-packages/serial/tools/list_ports_osx.py to list_ports_osx.pyc byte-compiling /usr/lib/python2.6/site-packages/serial/tools/list_ports_posix.py to list_ports_posix.pyc byte-compiling /usr/lib/python2.6/site-packages/serial/tools/miniterm.py to miniterm.pyc byte-compiling /usr/lib/python2.6/site-packages/serial/tools/__init__.py to __init__.pyc byte-compiling /usr/lib/python2.6/site-packages/serial/tools/list_ports_linux.py to list_ports_linux.pyc byte-compiling /usr/lib/python2.6/site-packages/serial/threaded/__init__.py to __init__.pyc byte-compiling /usr/lib/python2.6/site-packages/serial/serialposix.py to serialposix.pyc byte-compiling /usr/lib/python2.6/site-packages/serial/win32.py to win32.pyc byte-compiling /usr/lib/python2.6/site-packages/serial/serialcli.py to serialcli.pyc byte-compiling /usr/lib/python2.6/site-packages/serial/serialutil.py to serialutil.pyc byte-compiling /usr/lib/python2.6/site-packages/serial/rfc2217.py to rfc2217.pyc byte-compiling /usr/lib/python2.6/site-packages/serial/serialjava.py to serialjava.pyc byte-compiling /usr/lib/python2.6/site-packages/serial/__init__.py to __init__.pyc byte-compiling /usr/lib/python2.6/site-packages/serial/urlhandler/protocol_hwgrep.py to protocol_hwgrep.pyc byte-compiling /usr/lib/python2.6/site-packages/serial/urlhandler/protocol_rfc2217.py to protocol_rfc2217.pyc byte-compiling /usr/lib/python2.6/site-packages/serial/urlhandler/protocol_serve-rfc2217.py to protocol_serve-rfc2217.pyc byte-compiling /usr/lib/python2.6/site-packages/serial/urlhandler/protocol_spy.py to protocol_spy.pyc byte-compiling /usr/lib/python2.6/site-packages/serial/urlhandler/protocol_loop.py to protocol_loop.pyc byte-compiling /usr/lib/python2.6/site-packages/serial/urlhandler/protocol_alt.py to protocol_alt.pyc byte-compiling /usr/lib/python2.6/site-packages/serial/urlhandler/protocol_socket.py to protocol_socket.pyc byte-compiling /usr/lib/python2.6/site-packages/serial/urlhandler/__init__.py to __init__.pyc running install_scripts copying build/scripts-2.6/miniterm.py -> /usr/bin changing mode of /usr/bin/miniterm.py to 755 running install_egg_info Writing /usr/lib/python2.6/site-packages/pyserial-3.4-py2.6.egg-info [root@localhost pyserial-3.4]#
Reply
#2
Since you are building from the tarball, you need to provide the dependencies.
This one is importlib: https://github.com/brettcannon/importlib
Reply
#3
Thanks much.

To be clear: I didn't actually destroy anything,
I just did an incomplete job. Correct?

I'll soon find out whether importlib has any dependencies.

Also, what did I miss?
Until the traceback, I hadn't noticed evidence of a need for importlib.
I'd rather not repeat this scenario the next time I install from tarball.
The first time (several years ago), I installed pyserial from tarball,
no such dependency was required, so I hadn't looked very hard.

From reading about importlib and pip,
I get the impression that I should install Python3 outside Centos's package system.
Centos does system things with Python2.
Does pip do the right thing when there are two Python installs?
Does it handle dependencies?
Reply
#4
correct, but you will have to repeat operation after installing importlib
(I always thought that was part of the 3.4 installation python installation, but I guess not
Reply
#5
skeeve Wrote:I untarred it.
Use pip or wheel(pip install wheel).

There install doc.
Just pip install pyserial should work.
mint@mint ~ $ pip -V
pip 9.0.1 from /home/mint/.pyenv/versions/3.6.2/lib/python3.6/site-packages (python 3.6)

mint@mint ~ $ pip install pyserial
Collecting pyserial
  Downloading pyserial-3.4-py2.py3-none-any.whl (193kB)
    100% |████████████████████████████████| 194kB 1.8MB/s 
Installing collected packages: pyserial
Successfully installed pyserial-3.4

mint@mint ~ $ python
Python 3.6.2 (default, Aug  6 2017, 12:55:04) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import serial
>>> serial.VERSION
'3.4'
Going back to OS default and try Python 2.
mint@mint ~ $ pyenv local system
mint@mint ~ $ pip2 -V
pip 8.1.1 from /usr/lib/python2.7/dist-packages (python 2.7)

mint@mint ~ $ pip2 install pyserial
Collecting pyserial
  Using cached pyserial-3.4-py2.py3-none-any.whl
Installing collected packages: pyserial
Successfully installed pyserial-3.0.1

mint@mint ~ $ python2
Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import serial
>>> serial.VERSION
'3.4'
As you i have no problems here.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to install "pip install pyserial" Joni_Engr 2 2,683 Aug-09-2021, 08:35 AM
Last Post: Joni_Engr
  IndexError in Project Euler attempt CRISPRmetoopls 3 2,309 Aug-10-2020, 10:00 AM
Last Post: perfringo
  pip install -e ., ERROR: Failed building wheel for pyfarmhash mostafaPython 1 6,305 Jun-09-2020, 08:24 PM
Last Post: mcmxl22
  Failed Install NetfilterQueue Alamily 3 10,147 Dec-08-2019, 06:52 AM
Last Post: Rocknpaper
  install Pyserial neeheng 2 2,264 Jul-11-2019, 03:05 PM
Last Post: neeheng
  Simple while loop only works on first attempt jsb83 2 2,017 Jun-20-2019, 08:57 PM
Last Post: jsb83
  pip3 install functools failed kintarowonders 1 15,764 Mar-07-2019, 07:56 PM
Last Post: nilamo
  install DB API failed... netbanker 1 2,712 Apr-06-2018, 05:01 AM
Last Post: Gribouillis
  Problems installing Python - Failed to install MSI package Johnnyq70 1 4,859 Oct-29-2017, 08:50 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020