How to fix OSError: [Errno 97] Address family not supported by protocol during socket creation?

Hi Nvidia- developers, I’m trying to use this library can-isotp on a Jetson TX2 Board inside of an docker container.

If I test the following code from the docs:

import isotp

s = isotp.socket()
s2 = isotp.socket()
# Configuring the sockets.
s.set_fc_opts(stmin=5, bs=10)

s.bind("vcan0", isotp.Address(rxid=0x123 txid=0x456))
s2.bind("vcan0", isotp.Address(rxid=0x456, txid=0x123))
s2.send(b"Hello, this is a long payload sent in small chunks of 8 bytes.")
print(s.recv())

I get the following error message:

root@d1a297bae985:/# python3.7 test.py
Traceback (most recent call last):
File “test.py”, line 3, in
s = isotp.socket()
File “/usr/local/lib/python3.7/site-packages/isotp/tpsock/init.py”, line 74, in init
self._socket = socket_module.socket(socket_module.AF_CAN, socket_module.SOCK_DGRAM, socket_module.CAN_ISOTP)
File “/usr/local/lib/python3.7/socket.py”, line 151, in init
_socket.socket.init(self, family, type, proto, fileno)
OSError: [Errno 97] Address family not supported by protocol

I already searched the internet but didn’t find anything helping me in this context. I am not sure why it isn’t working (it worked before on a RPI3). Ifconfig shows both interfaces, can0 and can1.

I would really appreciate any help!

I’ve never looked at this, but the protocol and family not being supported probably means the kernel needs to have that feature enabled (often it is just a copy of a kernel module file, but sometimes it is more complicated). It could also be a need for a missing library, don’t know…I am just being very general.

What do you see from:
zcat /proc/config.gz | grep -i vcan
…if you have this as either “=m” or “=y”, then this is present. However, it could be some other protocol combination and not this one. The error message is not specific.