0

I have multiple indications that my python modules are installed but several cause 'No module named..' exceptions. For example...

root@raspberrypi:~# pip install pyfingerprint --no-cache-dir
Collecting pyfingerprint    
Downloading https://www.piwheels.org/simple/pyfingerprint/pyfingerprint-0.1-py3-none-any.whl
Requirement already satisfied: pyserial in /usr/local/lib/python3.5/dist-
packages (from pyfingerprint)
Requirement already satisfied: Pillow in /usr/lib/python3/dist-packages (from 
pyfingerprint)
Installing collected packages: pyfingerprint
Successfully installed pyfingerprint-0.1

Then, the module is nowhere to be found...

root@raspberrypi:~# python
Python 3.5.3 (default, Sep 27 2018, 17:25:39) 
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyfingerprint
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'pyfingerprint'

Note also, that the dependent modules in the install above are listed as satisfied, but importing them also fails...

>>> import pyserial
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'pyserial'
>>> import Pillow
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'Pillow'

When I check that they exist, pip agrees...

pip freeze

...
Pillow==4.0.0    
...
pyfingerprint==0.1
...
pyserial==3.4
...

The problem is not limited to this install. There are numerous modules that pip says exist fail on import. Others are just fine.

I've tried everything in the following SO post, to no avail...

[Python pip install module is not found. How to link python to pip location?

The sys.path seems to point to the correct locations:

>>> import sys
>>> type(sys.path)
<class 'list'>
>>> for path in sys.path:
...     print(path)
... 

/usr/lib/python35.zip
/usr/lib/python3.5
/usr/lib/python3.5/plat-arm-linux-gnueabihf
/usr/lib/python3.5/lib-dynload
/root/.local/lib/python3.5/site-packages
/usr/local/lib/python3.5/dist-packages
/usr/lib/python3/dist-packages

I'm at a loss here. Any suggestions you have would be great. Thank you.

UPDATE

FWIW, this happened only after I did my usual:

sudo apt-get update 
sudo apt-get upgrade 

Which yields to the following from uname:

Linux raspberrypi 4.19.42-v7+ #1219 SMP Tue May 14 21:20:58 BST 2019 armv7l GNU/Linux

Modules, or at least the ones I was importing, worked fine before this.

JRomeo
  • 543
  • 1
  • 4
  • 20

2 Answers2

0

Could it be that the pip command installs python2 packages? On my system for example I use pip for python 2 and pip3 for python3 packages.

Axel Olivecrona
  • 143
  • 2
  • 6
  • I wish. root@raspberrypi:~# pip3 install pyfingerprint Requirement already satisfied: pyfingerprint in /usr/local/lib/python3.5/dist-packages Requirement already satisfied: pyserial in /usr/local/lib/python3.5/dist-packages (from pyfingerprint) Requirement already satisfied: Pillow in /usr/lib/python3/dist-packages (from pyfingerprint) pip3 freeze returns the same module list. – JRomeo Jul 07 '19 at 20:19
0

The modules I can't load using python 3.x in fact are recognized in my python 2.x installation on the same machine.

JRomeo
  • 543
  • 1
  • 4
  • 20