LudovicRousseau / pyscard

pyscard smartcard library for python
http://pyscard.sourceforge.net/
GNU Lesser General Public License v2.1
379 stars 108 forks source link

pyscard installation fails on Py3 on Ubuntu 16.04 #119

Closed ullix closed 2 years ago

ullix commented 2 years ago

I tried Python3.5 and 3.9; on both the same result. No idea what to look for:

~$ python3 -m pip install pyscard
Collecting pyscard
  Using cached pyscard-2.0.2.tar.gz (149 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: pyscard
  Building wheel for pyscard (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/ullix/geigerlog/vgl39/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-2z7zx378/pyscard_a77662212df54a20aec5d53925383ad6/setup.py'"'"'; __file__='"'"'/tmp/pip-install-2z7zx378/pyscard_a77662212df54a20aec5d53925383ad6/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-g88w4897
       cwd: /tmp/pip-install-2z7zx378/pyscard_a77662212df54a20aec5d53925383ad6/
  Complete output (8 lines):
  running bdist_wheel
  running build
  running build_py
  running build_ext
  building 'smartcard.scard._scard' extension
  swigging smartcard/scard/scard.i to smartcard/scard/scard_wrap.c
  swig -python -outdir smartcard/scard -DPCSCLITE -o smartcard/scard/scard_wrap.c smartcard/scard/scard.i
  error: command 'swig' failed: No such file or directory
  ----------------------------------------
  ERROR: Failed building wheel for pyscard
  Running setup.py clean for pyscard
Failed to build pyscard
Installing collected packages: pyscard
    Running setup.py install for pyscard ... error
    ERROR: Command errored out with exit status 1:
     command: /home/ullix/geigerlog/vgl39/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-2z7zx378/pyscard_a77662212df54a20aec5d53925383ad6/setup.py'"'"'; __file__='"'"'/tmp/pip-install-2z7zx378/pyscard_a77662212df54a20aec5d53925383ad6/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-efon7241/install-record.txt --single-version-externally-managed --compile --install-headers /home/ullix/geigerlog/vgl39/include/site/python3.9/pyscard
         cwd: /tmp/pip-install-2z7zx378/pyscard_a77662212df54a20aec5d53925383ad6/
    Complete output (8 lines):
    running install
    running build
    running build_py
    running build_ext
    building 'smartcard.scard._scard' extension
    swigging smartcard/scard/scard.i to smartcard/scard/scard_wrap.c
    swig -python -outdir smartcard/scard -DPCSCLITE -o smartcard/scard/scard_wrap.c smartcard/scard/scard.i
    error: command 'swig' failed: No such file or directory
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/ullix/geigerlog/vgl39/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-2z7zx378/pyscard_a77662212df54a20aec5d53925383ad6/setup.py'"'"'; __file__='"'"'/tmp/pip-install-2z7zx378/pyscard_a77662212df54a20aec5d53925383ad6/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-efon7241/install-record.txt --single-version-externally-managed --compile --install-headers /home/ullix/geigerlog/vgl39/include/site/python3.9/pyscard Check the logs for full command output.
LudovicRousseau commented 2 years ago
    error: command 'swig' failed: No such file or directory

Install swig and try again.

I suggest you to install the pyscard Ubuntu package. https://packages.ubuntu.com/search?keywords=pyscard

ullix commented 2 years ago

Did install swig, and did install pyscard ubuntu package. Still no benefit:

~$ python3 -m pip install pyscard
Collecting pyscard
  Using cached pyscard-2.0.2.tar.gz (149 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: pyscard
  Building wheel for pyscard (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/ullix/geigerlog/vgl39/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-mcddvi5q/pyscard_960496a4404841be9cb5104552544d67/setup.py'"'"'; __file__='"'"'/tmp/pip-install-mcddvi5q/pyscard_960496a4404841be9cb5104552544d67/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-l5hxgmwi
       cwd: /tmp/pip-install-mcddvi5q/pyscard_960496a4404841be9cb5104552544d67/
  Complete output (15 lines):
  running bdist_wheel
  running build
  running build_py
  running build_ext
  building 'smartcard.scard._scard' extension
  swigging smartcard/scard/scard.i to smartcard/scard/scard_wrap.c
  swig -python -outdir smartcard/scard -DPCSCLITE -o smartcard/scard/scard_wrap.c smartcard/scard/scard.i
  creating build
  creating build/temp.linux-x86_64-3.9
  creating build/temp.linux-x86_64-3.9/smartcard
  creating build/temp.linux-x86_64-3.9/smartcard/scard
  x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVER_PRODUCTVERSION=2,0,2,0000 -DVER_PRODUCTVERSION_STR=2.0.2 -DPCSCLITE=1 -Ismartcard/scard/ -I/usr/include/PCSC -I/usr/local/include/PCSC -I/home/ullix/geigerlog/vgl39/include -I/usr/include/python3.9 -c smartcard/scard/helpers.c -o build/temp.linux-x86_64-3.9/smartcard/scard/helpers.o
  smartcard/scard/helpers.c:28:22: fatal error: winscard.h: Datei oder Verzeichnis nicht gefunden
  compilation terminated.
  error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for pyscard
  Running setup.py clean for pyscard
Failed to build pyscard
Installing collected packages: pyscard
    Running setup.py install for pyscard ... error
    ERROR: Command errored out with exit status 1:
     command: /home/ullix/geigerlog/vgl39/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-mcddvi5q/pyscard_960496a4404841be9cb5104552544d67/setup.py'"'"'; __file__='"'"'/tmp/pip-install-mcddvi5q/pyscard_960496a4404841be9cb5104552544d67/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-svlu20cc/install-record.txt --single-version-externally-managed --compile --install-headers /home/ullix/geigerlog/vgl39/include/site/python3.9/pyscard
         cwd: /tmp/pip-install-mcddvi5q/pyscard_960496a4404841be9cb5104552544d67/
    Complete output (15 lines):
    running install
    running build
    running build_py
    running build_ext
    building 'smartcard.scard._scard' extension
    swigging smartcard/scard/scard.i to smartcard/scard/scard_wrap.c
    swig -python -outdir smartcard/scard -DPCSCLITE -o smartcard/scard/scard_wrap.c smartcard/scard/scard.i
    creating build
    creating build/temp.linux-x86_64-3.9
    creating build/temp.linux-x86_64-3.9/smartcard
    creating build/temp.linux-x86_64-3.9/smartcard/scard
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVER_PRODUCTVERSION=2,0,2,0000 -DVER_PRODUCTVERSION_STR=2.0.2 -DPCSCLITE=1 -Ismartcard/scard/ -I/usr/include/PCSC -I/usr/local/include/PCSC -I/home/ullix/geigerlog/vgl39/include -I/usr/include/python3.9 -c smartcard/scard/helpers.c -o build/temp.linux-x86_64-3.9/smartcard/scard/helpers.o
    smartcard/scard/helpers.c:28:22: fatal error: winscard.h: Datei oder Verzeichnis nicht gefunden
    compilation terminated.
    error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/ullix/geigerlog/vgl39/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-mcddvi5q/pyscard_960496a4404841be9cb5104552544d67/setup.py'"'"'; __file__='"'"'/tmp/pip-install-mcddvi5q/pyscard_960496a4404841be9cb5104552544d67/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-svlu20cc/install-record.txt --single-version-externally-managed --compile --install-headers /home/ullix/geigerlog/vgl39/include/site/python3.9/pyscard Check the logs for full command output.
(vgl39) ullix@crucialmx200:~$ 
LudovicRousseau commented 2 years ago
  smartcard/scard/helpers.c:28:22: fatal error: winscard.h: Datei oder Verzeichnis nicht gefunden

Install the package libpcsclite-dev