Python import module problem


#1

Hi,

I am able to use the smartcard module from my ubuntu enviroment. I unable to use with stackstorm.

The import for the unbuntu is simple “import smartcard”
My requirements.txt file in stackstorm is “smartcard”

This can be found here:
/usr/local/lib/python2.7/dist-packages/pyscard-1.9.7-py2.7-linux-x86_64.egg/smartcard

pip freeze shows this:
pyscard==1.9.7

The pack install fails here:

Collecting smartcard (from -r /opt/stackstorm/packs/extr/requirements.txt (line 7))
 (stderr:   Could not find a version that satisfies the requirement smartcard (from -r /opt/stackstorm/packs/extr/requirements.txt (line 7)) (from versions: )

Any suggestions?


(Lindsay Hill) #2

The library name is pyscard - not smartcard.

requirements.txt in your pack directory should have the same format & name as what you show in the pip freeze output.


#3

That fails, which I had tried. The local environment (not stackstorm) uses smartcard


(Lindsay Hill) #4

No, the local environment does not use smartcard - you can see this in your output of pip freeze above

import smartcard is what you put inside your python code, but in order to install that library, your requirements.txt file must contain pyscard (possibly also with a fixed version).

Add pyscard to your pack requirements.txt file, and re-install the pack (or at least update the virtualenv). Do that, and report any error messages here


#5

Yes, you are correct. I put pyscard back into requirements.txt I can now install the pack.
I think it may have failed previously from a git problem.

Thank you!