Installing pyxid

I am having a fair bit of trouble getting pyxid installed. I have several machines, all running fully updated manjaro linux, which is an arch derivative. My first attempt was:

$ pip install pyxid2
Defaulting to user installation because normal site-packages is not writeable
WARNING: Keyring is skipped due to an exception: Failed to unlock the keyring!
Collecting pyxid2
  Downloading pyxid2-1.0.3-py3-none-any.whl (11 kB)
WARNING: Discarding https://files.pythonhosted.org/packages/84/08/cf44ba85776b945da05262ff3992c1e82997aa20d37530abd337ac780158/pyxid2-1.0.3-py3-none-any.whl#sha256=9317e83dc6e16c500467c5b35d526ee6d92b76dcf0bdb86b8af655ff42ce2f12 (from https://pypi.org/simple/pyxid2/). Requested pyxid2 from https://files.pythonhosted.org/packages/84/08/cf44ba85776b945da05262ff3992c1e82997aa20d37530abd337ac780158/pyxid2-1.0.3-py3-none-any.whl#sha256=9317e83dc6e16c500467c5b35d526ee6d92b76dcf0bdb86b8af655ff42ce2f12 has different version in metadata: '1.0.3'
  Downloading pyxid2-1.0.3.tar.gz (11 kB)
WARNING: Discarding https://files.pythonhosted.org/packages/56/1f/dddfcf39acbf5bb2bd54e8843c555d0614970509bcb636049e6c8b2f88e7/pyxid2-1.0.3.tar.gz#sha256=b7da934c40ba3f38c081dcd93ea0241836560424ef84d5b13937928269e5115b (from https://pypi.org/simple/pyxid2/). Requested pyxid2 from https://files.pythonhosted.org/packages/56/1f/dddfcf39acbf5bb2bd54e8843c555d0614970509bcb636049e6c8b2f88e7/pyxid2-1.0.3.tar.gz#sha256=b7da934c40ba3f38c081dcd93ea0241836560424ef84d5b13937928269e5115b has different version in metadata: '1.0.3'
  Downloading pyxid2-1.0.2-py3-none-any.whl (11 kB)
WARNING: Discarding https://files.pythonhosted.org/packages/84/68/15786191ab22c492b3501a445c4b7c8454f10961cea0ebbcc1134ddeea61/pyxid2-1.0.2-py3-none-any.whl#sha256=5355d1e793041ca6d3dab7d9a9625779aa2d1578a2ce84df5d61e2180f6bd0f2 (from https://pypi.org/simple/pyxid2/). Requested pyxid2 from https://files.pythonhosted.org/packages/84/68/15786191ab22c492b3501a445c4b7c8454f10961cea0ebbcc1134ddeea61/pyxid2-1.0.2-py3-none-any.whl#sha256=5355d1e793041ca6d3dab7d9a9625779aa2d1578a2ce84df5d61e2180f6bd0f2 has different version in metadata: '1.0.2'
  Downloading pyxid2-1.0.2.tar.gz (10 kB)
WARNING: Discarding https://files.pythonhosted.org/packages/9d/9b/53c04aee93ebe117b89f413999f8ac6058df6872992f73c4bd2012d3282f/pyxid2-1.0.2.tar.gz#sha256=7b250eb2a6786d5139eb326503255e9e981fcf76b4b4c9d4695291d1c06a608a (from https://pypi.org/simple/pyxid2/). Requested pyxid2 from https://files.pythonhosted.org/packages/9d/9b/53c04aee93ebe117b89f413999f8ac6058df6872992f73c4bd2012d3282f/pyxid2-1.0.2.tar.gz#sha256=7b250eb2a6786d5139eb326503255e9e981fcf76b4b4c9d4695291d1c06a608a has different version in metadata: '1.0.2'
  Downloading pyxid2-1.0.1-py3-none-any.whl (10 kB)
WARNING: Discarding https://files.pythonhosted.org/packages/bf/99/98a84bad4e362a96d125142505c44de3cc900ecc6eaccd81567bca810de5/pyxid2-1.0.1-py3-none-any.whl#sha256=3a8e25b4addfc843fd2f2db2e858b11419237e249ab6e3ad708813f2abd5689d (from https://pypi.org/simple/pyxid2/). Requested pyxid2 from https://files.pythonhosted.org/packages/bf/99/98a84bad4e362a96d125142505c44de3cc900ecc6eaccd81567bca810de5/pyxid2-1.0.1-py3-none-any.whl#sha256=3a8e25b4addfc843fd2f2db2e858b11419237e249ab6e3ad708813f2abd5689d has different version in metadata: '1.0.1'
  Downloading pyxid2-1.0.1.tar.gz (10 kB)
WARNING: Discarding https://files.pythonhosted.org/packages/ba/b8/21411dd5f85a2cf6e95be0100d74d321e9aee0075d6104eda8d314cde783/pyxid2-1.0.1.tar.gz#sha256=3210348ead823ad6605ac332bed72dd07a7ae0ae436920d8adc101ac43d3fc56 (from https://pypi.org/simple/pyxid2/). Requested pyxid2 from https://files.pythonhosted.org/packages/ba/b8/21411dd5f85a2cf6e95be0100d74d321e9aee0075d6104eda8d314cde783/pyxid2-1.0.1.tar.gz#sha256=3210348ead823ad6605ac332bed72dd07a7ae0ae436920d8adc101ac43d3fc56 has different version in metadata: '1.0.1'
  Downloading pyxid2-1.0-py3-none-any.whl (17 kB)
WARNING: Discarding https://files.pythonhosted.org/packages/de/dc/e736ee8c9671a2376adfe1a67e16bab9cd34a07395bd1c8f48d6d6313346/pyxid2-1.0-py3-none-any.whl#sha256=ae26f1c0177ed56ba1bf84f7ae2cf3d2c42cd00a883366fc890f6b6aecc84e8a (from https://pypi.org/simple/pyxid2/). Requested pyxid2 from https://files.pythonhosted.org/packages/de/dc/e736ee8c9671a2376adfe1a67e16bab9cd34a07395bd1c8f48d6d6313346/pyxid2-1.0-py3-none-any.whl#sha256=ae26f1c0177ed56ba1bf84f7ae2cf3d2c42cd00a883366fc890f6b6aecc84e8a has different version in metadata: '1.0'
  Downloading pyxid2-1.0.tar.gz (8.0 kB)
WARNING: Discarding https://files.pythonhosted.org/packages/6d/c6/2ff02242558ea828193a7362563e4ff0ca6df45ba83376e10592ee8d09ec/pyxid2-1.0.tar.gz#sha256=b8d9b6a75fb7bb5ef4617be71e5d234e573aa07cd5257b41611ce437ba848969 (from https://pypi.org/simple/pyxid2/). Requested pyxid2 from https://files.pythonhosted.org/packages/6d/c6/2ff02242558ea828193a7362563e4ff0ca6df45ba83376e10592ee8d09ec/pyxid2-1.0.tar.gz#sha256=b8d9b6a75fb7bb5ef4617be71e5d234e573aa07cd5257b41611ce437ba848969 has different version in metadata: '1.0'
ERROR: Could not find a version that satisfies the requirement pyxid2
ERROR: No matching distribution found for pyxid2
$ 

So then I grabbed the download links from the output above and tried a local install:

$ wget https://files.pythonhosted.org/packages/84/08/cf44ba85776b945da05262ff3992c1e82997aa20d37530abd337ac780158/pyxid2-1.0.3-py3-none-any.whl
$ pip install pyxid2-1.0.3-py3-none-any.whl 
Defaulting to user installation because normal site-packages is not writeable
Processing ./pyxid2-1.0.3-py3-none-any.whl
ERROR: Exception:
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 223, in _main
    status = self.run(options, args)
  File "/usr/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 180, in wrapper
    return func(self, options, args)
  File "/usr/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 320, in run
    requirement_set = resolver.resolve(
  File "/usr/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 121, in resolve
    self._result = resolver.resolve(
  File "/usr/lib/python3.9/site-packages/resolvelib/resolvers.py", line 454, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/usr/lib/python3.9/site-packages/resolvelib/resolvers.py", line 319, in resolve
    name, crit = self._merge_into_criterion(r, parent=None)
  File "/usr/lib/python3.9/site-packages/resolvelib/resolvers.py", line 176, in _merge_into_criterion
    crit = Criterion.from_requirement(self._p, requirement, parent)
  File "/usr/lib/python3.9/site-packages/resolvelib/resolvers.py", line 80, in from_requirement
    cands = build_iter_view(matches)
  File "/usr/lib/python3.9/site-packages/resolvelib/structs.py", line 148, in build_iter_view
    matches = list(matches)
  File "/usr/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 285, in <genexpr>
    if constraint.is_satisfied_by(c)
  File "/usr/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/base.py", line 66, in is_satisfied_by
    return self.specifier.contains(candidate.version, prereleases=True)
  File "/usr/lib/python3.9/site-packages/packaging/specifiers.py", line 790, in contains
    item = parse(item)
  File "/usr/lib/python3.9/site-packages/packaging/version.py", line 57, in parse
    return Version(version)
  File "/usr/lib/python3.9/site-packages/packaging/version.py", line 296, in __init__
    match = self._regex.search(version)
TypeError: expected string or bytes-like object
$ 

I get the same error if I try with earlier versions. Next, I tried installing from the git repo, which seems to give the same error:

$ pip install git+https://github.com/cedrus-opensource/pyxid/
Defaulting to user installation because normal site-packages is not writeable
Collecting git+https://github.com/cedrus-opensource/pyxid/
  Cloning https://github.com/cedrus-opensource/pyxid/ to /tmp/pip-req-build-k019eqz7
  Running command git clone -q https://github.com/cedrus-opensource/pyxid/ /tmp/pip-req-build-k019eqz7
ERROR: Exception:
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 223, in _main
    status = self.run(options, args)
  File "/usr/lib/python3.9/site-packages/pip/_internal/cli/req_command.py", line 180, in wrapper
    return func(self, options, args)
  File "/usr/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 320, in run
    requirement_set = resolver.resolve(
  File "/usr/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 121, in resolve
    self._result = resolver.resolve(
  File "/usr/lib/python3.9/site-packages/resolvelib/resolvers.py", line 454, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/usr/lib/python3.9/site-packages/resolvelib/resolvers.py", line 319, in resolve
    name, crit = self._merge_into_criterion(r, parent=None)
  File "/usr/lib/python3.9/site-packages/resolvelib/resolvers.py", line 176, in _merge_into_criterion
    crit = Criterion.from_requirement(self._p, requirement, parent)
  File "/usr/lib/python3.9/site-packages/resolvelib/resolvers.py", line 80, in from_requirement
    cands = build_iter_view(matches)
  File "/usr/lib/python3.9/site-packages/resolvelib/structs.py", line 148, in build_iter_view
    matches = list(matches)
  File "/usr/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/factory.py", line 285, in <genexpr>
    if constraint.is_satisfied_by(c)
  File "/usr/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/base.py", line 66, in is_satisfied_by
    return self.specifier.contains(candidate.version, prereleases=True)
  File "/usr/lib/python3.9/site-packages/packaging/specifiers.py", line 790, in contains
    item = parse(item)
  File "/usr/lib/python3.9/site-packages/packaging/version.py", line 57, in parse
    return Version(version)
  File "/usr/lib/python3.9/site-packages/packaging/version.py", line 296, in __init__
    match = self._regex.search(version)
TypeError: expected string or bytes-like object
$ 

At this point I can’t think of what to try next. Any suggestions?

Thanks.

Unfortunately we have no idea where the issue is. A colleague just tried this morning to do an install on Windows and it worked fine, the only difference (other than OS) is that he is using Python 3.8 whereas you’re on 3.9.

I have made some progress. pyxid2 and libftdi are now installed. I was getting an error when trying to import pyxid2 in python, saying:

AttributeError: /usr/lib/libftd2xx.so: undefined symbol: stime. Did you mean: 'ctime'?

This was solved by commenting out the following lines in the file site-packages/ftd2xx/_ftd2xx_linux.py:

#stime = _libraries['libftd2xx.so'].stime
#stime.restype = c_int
## stime(__when)
#stime.argtypes = [POINTER(time_t)]
#stime.__doc__ = \
#"""int stime(unknown * __when)

Now, pyxid2 imports successfully. But with the c-pod plugged in to a usb port, here is what I get:

>>> import pyxid2
>>> pyxid2.get_xid_devices()
[]
>>> 

I do see that when I plug the c-pod in, a new device is created in these 3 locations:

/dev/ttyUSB0
/dev/serial/by-id/usb-FTDI_FT232R_USB_UART-if00-port0
/dev/serial/by-path/pci-0000:00:14.0-usb-0:13:1.0-port0

So the device is found by the system. Any ideas for how to troubleshoot from here?

More progress. As soon as I hit submit on my previous post, I found this thread:

E-prime and parallel or serial port

Which indicates that the device can be written to manually as a serial port. This is great. I am not using psychopy or anything, just pure python and pyserial. Following some matlab code, I was able to open the port and write to it with ‘_c1’ and I received an ‘_xid0’ response, which I take to indicate that I am successfully communicating with the device. Now I am on to trying to send a trigger. Is there a simple pure-python example of writing a trigger to the port?

Alas, we do not support Linux, but hopefully these two tips would help.

  • If you want to go the Matlab route, see our Matlab samples.

  • pyxid2 is a library. When you get it to install, you will not have to deal with sending commands like ‘_c1’ and waiting for a response – the library will do it for you.

  • pyxid2 uses a different USB driver that will give you a 2ms delay that is jitter free. With Matlab, it will be something like ±5 to 6ms.

I hope this helps.

Thanks for the tips.

I have written my own python module to send triggers on linux. The only dependency is pyserial. I can live with the latency and jitter.

If anyone else is interested, you can find it here:

https://gitlab.com/cabrown/triggers