I'm new to this. I was trying to run sitl simulation and was installing all the packages. I tried to install an older version of pymavlink on ubuntu because newer seem to have problems. And many others did that in tutorials. I ran sudo pip3 install pymavlink==2.4.8 and got such errors:
Collecting pymavlink==2.4.8
Using cached pymavlink-2.4.8.tar.gz (3.6 MB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: future in /usr/local/lib/python3.10/dist-packages (from pymavlink==2.4.8) (0.18.3)
Requirement already satisfied: lxml in /usr/local/lib/python3.10/dist-packages (from pymavlink==2.4.8) (4.9.2)
Building wheels for collected packages: pymavlink
Building wheel for pymavlink (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [46 lines of output]
running bdist_wheel
running build
running build_py
Using message definitions from /tmp/pip-install-u688fu4a/pymavlink_14df38e43e034876b23652c0fb467231/message_definitions
Building /tmp/pip-install-u688fu4a/pymavlink_14df38e43e034876b23652c0fb467231/message_definitions/v1.0/ardupilotmega.xml for protocol 1.0
WARNING: Unable to load XML validator libraries. XML validation will not be performed
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-u688fu4a/pymavlink_14df38e43e034876b23652c0fb467231/setup.py", line 109, in <module>
setup (name = 'pymavlink',
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.10/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.10/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/wheel/bdist_wheel.py", line 299, in run
self.run_command('build')
File "/usr/lib/python3.10/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3.10/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/lib/python3.10/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/tmp/pip-install-u688fu4a/pymavlink_14df38e43e034876b23652c0fb467231/setup.py", line 103, in run
generate_content()
File "/tmp/pip-install-u688fu4a/pymavlink_14df38e43e034876b23652c0fb467231/setup.py", line 64, in generate_content
if not mavgen.mavgen_python_dialect(dialect, mavparse.PROTOCOL_1_0):
File "/tmp/pip-install-u688fu4a/pymavlink_14df38e43e034876b23652c0fb467231/generator/mavgen.py", line 247, in mavgen_python_dialect
if not mavgen(opts, [xml]):
File "/tmp/pip-install-u688fu4a/pymavlink_14df38e43e034876b23652c0fb467231/generator/mavgen.py", line 142, in mavgen
xml.append(mavparse.MAVXML(fname, opts.wire_protocol))
File "/tmp/pip-install-u688fu4a/pymavlink_14df38e43e034876b23652c0fb467231/generator/mavparse.py", line 420, in __init__
m.crc_extra = message_checksum(m)
File "/tmp/pip-install-u688fu4a/pymavlink_14df38e43e034876b23652c0fb467231/generator/mavparse.py", line 447, in message_checksum
crc.accumulate_str(msg.name + ' ')
File "/tmp/pip-install-u688fu4a/pymavlink_14df38e43e034876b23652c0fb467231/generator/mavcrc.py", line 34, in accumulate_str
bytes.fromstring(buf)
AttributeError: 'array.array' object has no attribute 'fromstring'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pymavlink
Running setup.py clean for pymavlink
Failed to build pymavlink
Installing collected packages: pymavlink
Running setup.py install for pymavlink ... error
error: subprocess-exited-with-error
× Running setup.py install for pymavlink did not run successfully.
│ exit code: 1
╰─> [50 lines of output]
running install
/usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
Using message definitions from /tmp/pip-install-u688fu4a/pymavlink_14df38e43e034876b23652c0fb467231/message_definitions
Building /tmp/pip-install-u688fu4a/pymavlink_14df38e43e034876b23652c0fb467231/message_definitions/v1.0/ardupilotmega.xml for protocol 1.0
WARNING: Unable to load XML validator libraries. XML validation will not be performed
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-u688fu4a/pymavlink_14df38e43e034876b23652c0fb467231/setup.py", line 109, in <module>
setup (name = 'pymavlink',
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.10/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.10/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 68, in run
return orig.install.run(self)
File "/usr/lib/python3.10/distutils/command/install.py", line 619, in run
self.run_command('build')
File "/usr/lib/python3.10/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3.10/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/lib/python3.10/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/tmp/pip-install-u688fu4a/pymavlink_14df38e43e034876b23652c0fb467231/setup.py", line 103, in run
generate_content()
File "/tmp/pip-install-u688fu4a/pymavlink_14df38e43e034876b23652c0fb467231/setup.py", line 64, in generate_content
if not mavgen.mavgen_python_dialect(dialect, mavparse.PROTOCOL_1_0):
File "/tmp/pip-install-u688fu4a/pymavlink_14df38e43e034876b23652c0fb467231/generator/mavgen.py", line 247, in mavgen_python_dialect
if not mavgen(opts, [xml]):
File "/tmp/pip-install-u688fu4a/pymavlink_14df38e43e034876b23652c0fb467231/generator/mavgen.py", line 142, in mavgen
xml.append(mavparse.MAVXML(fname, opts.wire_protocol))
File "/tmp/pip-install-u688fu4a/pymavlink_14df38e43e034876b23652c0fb467231/generator/mavparse.py", line 420, in __init__
m.crc_extra = message_checksum(m)
File "/tmp/pip-install-u688fu4a/pymavlink_14df38e43e034876b23652c0fb467231/generator/mavparse.py", line 447, in message_checksum
crc.accumulate_str(msg.name + ' ')
File "/tmp/pip-install-u688fu4a/pymavlink_14df38e43e034876b23652c0fb467231/generator/mavcrc.py", line 34, in accumulate_str
bytes.fromstring(buf)
AttributeError: 'array.array' object has no attribute 'fromstring'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> pymavlink
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
emil618@LAPTOP-OAM6O1U6:~$ sudo pip install pymavlink==2.4.8
Collecting pymavlink==2.4.8
Using cached pymavlink-2.4.8.tar.gz (3.6 MB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: future in /usr/local/lib/python3.10/dist-packages (from pymavlink==2.4.8) (0.18.3)
Requirement already satisfied: lxml in /usr/local/lib/python3.10/dist-packages (from pymavlink==2.4.8) (4.9.2)
Building wheels for collected packages: pymavlink
Building wheel for pymavlink (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [46 lines of output]
running bdist_wheel
running build
running build_py
Using message definitions from /tmp/pip-install-muoyzd8q/pymavlink_e9818d02e995458cb64b6a1f6e3d3da0/message_definitions
Building /tmp/pip-install-muoyzd8q/pymavlink_e9818d02e995458cb64b6a1f6e3d3da0/message_definitions/v1.0/ardupilotmega.xml for protocol 1.0
WARNING: Unable to load XML validator libraries. XML validation will not be performed
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-muoyzd8q/pymavlink_e9818d02e995458cb64b6a1f6e3d3da0/setup.py", line 109, in <module>
setup (name = 'pymavlink',
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.10/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.10/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/wheel/bdist_wheel.py", line 299, in run
self.run_command('build')
File "/usr/lib/python3.10/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3.10/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/lib/python3.10/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/tmp/pip-install-muoyzd8q/pymavlink_e9818d02e995458cb64b6a1f6e3d3da0/setup.py", line 103, in run
generate_content()
File "/tmp/pip-install-muoyzd8q/pymavlink_e9818d02e995458cb64b6a1f6e3d3da0/setup.py", line 64, in generate_content
if not mavgen.mavgen_python_dialect(dialect, mavparse.PROTOCOL_1_0):
File "/tmp/pip-install-muoyzd8q/pymavlink_e9818d02e995458cb64b6a1f6e3d3da0/generator/mavgen.py", line 247, in mavgen_python_dialect
if not mavgen(opts, [xml]):
File "/tmp/pip-install-muoyzd8q/pymavlink_e9818d02e995458cb64b6a1f6e3d3da0/generator/mavgen.py", line 142, in mavgen
xml.append(mavparse.MAVXML(fname, opts.wire_protocol))
File "/tmp/pip-install-muoyzd8q/pymavlink_e9818d02e995458cb64b6a1f6e3d3da0/generator/mavparse.py", line 420, in __init__
m.crc_extra = message_checksum(m)
File "/tmp/pip-install-muoyzd8q/pymavlink_e9818d02e995458cb64b6a1f6e3d3da0/generator/mavparse.py", line 447, in message_checksum
crc.accumulate_str(msg.name + ' ')
File "/tmp/pip-install-muoyzd8q/pymavlink_e9818d02e995458cb64b6a1f6e3d3da0/generator/mavcrc.py", line 34, in accumulate_str
bytes.fromstring(buf)
AttributeError: 'array.array' object has no attribute 'fromstring'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pymavlink
Running setup.py clean for pymavlink
Failed to build pymavlink
Installing collected packages: pymavlink
Running setup.py install for pymavlink ... error
error: subprocess-exited-with-error
× Running setup.py install for pymavlink did not run successfully.
│ exit code: 1
╰─> [50 lines of output]
running install
/usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
Using message definitions from /tmp/pip-install-muoyzd8q/pymavlink_e9818d02e995458cb64b6a1f6e3d3da0/message_definitions
Building /tmp/pip-install-muoyzd8q/pymavlink_e9818d02e995458cb64b6a1f6e3d3da0/message_definitions/v1.0/ardupilotmega.xml for protocol 1.0
WARNING: Unable to load XML validator libraries. XML validation will not be performed
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-muoyzd8q/pymavlink_e9818d02e995458cb64b6a1f6e3d3da0/setup.py", line 109, in <module>
setup (name = 'pymavlink',
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.10/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.10/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 68, in run
return orig.install.run(self)
File "/usr/lib/python3.10/distutils/command/install.py", line 619, in run
self.run_command('build')
File "/usr/lib/python3.10/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3.10/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/lib/python3.10/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.10/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/tmp/pip-install-muoyzd8q/pymavlink_e9818d02e995458cb64b6a1f6e3d3da0/setup.py", line 103, in run
generate_content()
File "/tmp/pip-install-muoyzd8q/pymavlink_e9818d02e995458cb64b6a1f6e3d3da0/setup.py", line 64, in generate_content
if not mavgen.mavgen_python_dialect(dialect, mavparse.PROTOCOL_1_0):
File "/tmp/pip-install-muoyzd8q/pymavlink_e9818d02e995458cb64b6a1f6e3d3da0/generator/mavgen.py", line 247, in mavgen_python_dialect
if not mavgen(opts, [xml]):
File "/tmp/pip-install-muoyzd8q/pymavlink_e9818d02e995458cb64b6a1f6e3d3da0/generator/mavgen.py", line 142, in mavgen
xml.append(mavparse.MAVXML(fname, opts.wire_protocol))
File "/tmp/pip-install-muoyzd8q/pymavlink_e9818d02e995458cb64b6a1f6e3d3da0/generator/mavparse.py", line 420, in __init__
m.crc_extra = message_checksum(m)
File "/tmp/pip-install-muoyzd8q/pymavlink_e9818d02e995458cb64b6a1f6e3d3da0/generator/mavparse.py", line 447, in message_checksum
crc.accumulate_str(msg.name + ' ')
File "/tmp/pip-install-muoyzd8q/pymavlink_e9818d02e995458cb64b6a1f6e3d3da0/generator/mavcrc.py", line 34, in accumulate_str
bytes.fromstring(buf)
AttributeError: 'array.array' object has no attribute 'fromstring'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> pymavlink
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
The package doesn't seem to be problematic. Maybe it just doesn't work with the python version. I have 3.10.6
While I do know from experience, pymavlink 2.4.8 isn't supported by python 3.10, according to these guys (1, 2) you'll need to use Python 3.6 or below.
Pymavlink's own documentation says it can be used with Python 2.7+ and Python 3.5+. So, that leaves safe candidate versions of Python for Pymavlink 2.4.8 to be 2.7, 3.5, 3.6.
I personally have had it working for me with Python 2.7 on Windows 10.