LudovicRousseau / PyKCS11

PKCS#11 Wrapper for Python
GNU General Public License v2.0
99 stars 35 forks source link

Installation failes on official python image #111

Closed advgal closed 7 months ago

advgal commented 7 months ago

Your system information

Please describe your issue in as much detail as possible:

Describe what you expected should happen.

The installation failes with the error:

0.690 Collecting PyKCS11                                                                                                                                             
0.782   Downloading PyKCS11-1.5.14.tar.gz (79 kB)                                                                                                                    
0.803      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 79.5/79.5 kB 6.0 MB/s eta 0:00:00                                                                                
0.846   Installing build dependencies: started                                                                                                                       
2.374   Installing build dependencies: finished with status 'done'
2.375   Getting requirements to build wheel: started
2.511   Getting requirements to build wheel: finished with status 'done'
2.513   Installing backend dependencies: started
3.248   Installing backend dependencies: finished with status 'done'
3.248   Preparing metadata (pyproject.toml): started
3.389   Preparing metadata (pyproject.toml): finished with status 'done'
3.391 Building wheels for collected packages: PyKCS11
3.391   Building wheel for PyKCS11 (pyproject.toml): started
3.533   Building wheel for PyKCS11 (pyproject.toml): finished with status 'error'
3.538   error: subprocess-exited-with-error
3.538   
3.538   × Building wheel for PyKCS11 (pyproject.toml) did not run successfully.
3.538   │ exit code: 1
3.538   ╰─> [12 lines of output]
3.538       running bdist_wheel
3.538       running build
3.538       running build_py
3.538       running build_ext
3.538       building 'PyKCS11._LowLevel' extension
3.538       swigging src/pykcs11.i to src/pykcs11_wrap.cpp
3.538       swig -python -c++ -o src/pykcs11_wrap.cpp src/pykcs11.i
3.538       Traceback (most recent call last):
3.538         File "/usr/local/bin/swig", line 5, in <module>
3.538           from swig import swig
3.538       ModuleNotFoundError: No module named 'swig'
3.538       error: command '/usr/local/bin/swig' failed with exit code 1
3.538       [end of output]
3.538   
3.538   note: This error originates from a subprocess, and is likely not a problem with pip.
3.538   ERROR: Failed building wheel for PyKCS11
3.539 Failed to build PyKCS11
3.539 ERROR: Could not build wheels for PyKCS11, which is required to install pyproject.toml-based projects

Steps for reproducing this issue:

  1. Create Dockerfie
FROM python

RUN python -m venv penv
RUN . penv/bin/activate

RUN pip install --upgrade pip setuptools wheel swig
RUN pip install PyKCS11
  1. build image

    docker build .

LudovicRousseau commented 7 months ago

It looks like you have a problem with your installation of swig:

         File "/usr/local/bin/swig", line 5, in <module>
           from swig import swig

Install the swig Debian package, not the Pypi package.

LudovicRousseau commented 7 months ago

Fixed in https://github.com/LudovicRousseau/PyKCS11/commit/e97fc7e7042d0a8169086fba0045182f8f625756

Thanks for the bug report.