getting nfcpy working in basic form

Asked by

I did a bit of work back earlier in 2016 with nfcpy on raspberry pi. It worked with by basic testing using I have returned to raspberry pi (3) and reloaded nfcpy once more. However at the very start python is complaining when I try to test:

 pi@raspberrypi:~ $ python -m nfc
/usr/bin/python: No module named nfc.__main__; 'nfc' is a package and cannot be directly executed

If I skip this step the Sony card reader appears to be recognised the first time around. (SONY RC-S380) but on the second try I get:

>>> import nfc
>>> clf = nfc.ContactlessFrontend('usb')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/nfc/clf/", line 72, in __init__
    raise IOError(errno.ENODEV, os.strerror(errno.ENODEV))
IOError: [Errno 19] No such device

Also I notice that sometimes I have to use SUDO which I do not want to use. I guess this is a permissions thing but how do I get around it?

It may be my newbie skills are the cause...


Question information

English Edit question
nfcpy Edit question
No assignee Edit question
Solved by:
Stephen Tiedemann
Last query:
Last reply:
Revision history for this message
Best Stephen Tiedemann (stephen-tiedemann) said :

You were probably looking at the documentation for the "latest" version (which belongs to the "master" branch on GitHub) but have installed the latest "stable" version 0.11.1 (or any earlier). The "python -m nfc" thing only works with master (or v0.12 when it's out). You can either switch documentation (at bottom of left sidebar or just go to and use "examples/ --defive <full-device-path>", or grab the master branch from GitHub (git clone

Revision history for this message (ian-5) said :

Thx Stephen. Got things working by using the "switch documentation and use of examples/" choice. BTW is it best to stick to the latest "stable" version 0.11.1 for developing an NFC tag application?


Revision history for this message
Stephen Tiedemann (stephen-tiedemann) said :

The advantage of a release version is that it gives you a stable environment for a potential deployment. And it can be installed with pip.

On the master branch you might experience API changes and suffer from mistakes. But generally it's supposed to be just working - it's not a development branch.

It probably depends on whether you're heading for a "product" or an "experiment". For the latter you might just use the latest version but for a "product" you should really stick to a stable release.