python-pkcs11 icon indicating copy to clipboard operation
python-pkcs11 copied to clipboard

Error received when installing: 'TypeError: can only concatenate tuple (not "list") to tuple'

Open joseavegaa opened this issue 3 years ago • 4 comments

When installing using pip install python-pkcs11 or pip install git+https://github.com/danni/python-pkcs11, I get the following error:

TypeError: can only concatenate tuple (not "list") to tuple

I've tried to install the package on two different computers. One of them running Windows 10 21H2 and the other one on Windows 11. Both of them have new conda environments created with miniforge and using Python 3.10.1 and pip 21.3.1. Also, Visual Code for C++ is installed and I am indeed able to compile and install other packages, such as PyHanko or Tesserocr.

joseavegaa avatar Jan 16 '22 03:01 joseavegaa

Do you have a stack trace for that exception, or some kind of detailed error log? The error you got is a pretty generic one, so it's hard to say where the issue is without that information. I've never actually tried installing python-pkcs11 in Conda, and I don't have a Conda install on hand to try either.

FWIW: I run Python 3.10 on my daily development machine as well, so installing this package on Python 3.10 shouldn't be a problem in and of itself.

MatthiasValvekens avatar Jan 23 '22 18:01 MatthiasValvekens

The full output of the error is in the error attached.

install.log

Thanks for the help.

joseavegaa avatar Jan 23 '22 19:01 joseavegaa

From a quick look at the stack trace and the corresponding code in distutils, here's what I think is going on:

  • The libraries property on the python-pkcs11 extension module is defined as a tuple, see here: https://github.com/danni/python-pkcs11/blob/761348d52597fbff5219c4807500ccda78026b9f/setup.py#L21-L28.
  • On the other hand, py37compat.pythonlib() in distutils appears to return a list: https://github.com/pypa/distutils/blob/bb74c98df88d072b83963a916ac3d749b1aa20e0/distutils/command/py37compat.py#L24-L30.

Attempting to concatenate these leads to the error you're seeing. That happens over here: https://github.com/pypa/distutils/blob/bb74c98df88d072b83963a916ac3d749b1aa20e0/distutils/command/build_ext.py#L755.

I'm not familiar enough with distutils to definitively state which of the two should be considered "at fault", but that appears to be the root cause.

MatthiasValvekens avatar Jan 23 '22 22:01 MatthiasValvekens

I'm also getting this when trying to install on a Windows machine. Is there a workaround?

Kylar13 avatar Mar 16 '22 09:03 Kylar13