Error using ros.ros2.internal.createOrGetLocalPython
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
Hello,
Recently I encountered the following error when trying to call ros2genmsg. Anyone can help? Thanks in advance.
Error using ros.ros2.internal.createOrGetLocalPython (line 133)
Could not install the required Python packages: Looking in links:
/var/home/alex/opt/MATLAB/R2020a/sys/ros2/share/python
Processing /var/home/alex/opt/MATLAB/R2020a/sys/ros2/share/python/argcomplete-1.10.0-py2.py3-none-any.whl
Processing /var/home/alex/opt/MATLAB/R2020a/sys/ros2/share/python/flake8-3.7.8-py2.py3-none-any.whl
Processing /var/home/alex/opt/MATLAB/R2020a/sys/ros2/share/python/flake8-blind-except-0.1.1.tar.gz
Processing /var/home/alex/opt/MATLAB/R2020a/sys/ros2/share/python/flake8_class_newline-1.6.0-py3-none-any.whl
Processing /var/home/alex/opt/MATLAB/R2020a/sys/ros2/share/python/flake8_comprehensions-2.1.0-py3-none-any.whl
Processing /var/home/alex/opt/MATLAB/R2020a/sys/ros2/share/python/flake8_docstrings-1.3.0-py2.py3-none-any.whl
Processing /var/home/alex/opt/MATLAB/R2020a/sys/ros2/share/python/flake8_import_order-0.18.1-py2.py3-none-any.whl
Processing /var/home/alex/opt/MATLAB/R2020a/sys/ros2/share/python/flake8-quotes-2.0.1.tar.gz
Processing /var/home/alex/opt/MATLAB/R2020a/sys/ros2/share/python/pytest-5.0.1-py3-none-any.whl
Processing /var/home/alex/opt/MATLAB/R2020a/sys/ros2/share/python/pytest_cov-2.7.1-py2.py3-none-any.whl
Processing /var/home/alex/opt/MATLAB/R2020a/sys/ros2/share/python/pytest_runner-5.1-py2.py3-none-any.whl
Processing /var/home/alex/opt/MATLAB/R2020a/sys/ros2/share/python/pytest_repeat-0.8.0-py2.py3-none-any.whl
Processing /var/home/alex/opt/MATLAB/R2020a/sys/ros2/share/python/pytest_rerunfailures-7.0-py2.py3-none-any.whl
Processing /var/home/alex/opt/MATLAB/R2020a/sys/ros2/share/python/colcon_common_extensions-0.2.0-py3-none-any.whl
Processing /var/home/alex/opt/MATLAB/R2020a/sys/ros2/share/python/lark-parser-0.7.2.tar.gz
[31mERROR: Could not find a version that satisfies the requirement numpy (from versions: none)[0m
[31mERROR: No matching distribution found for numpy[0m
. Verify there is space on disk to create the packages and retry the command.
Error in ros2genmsg (line 53)
ros.ros2.internal.createOrGetLocalPython(); %ensure python is available
For reference,
>> pyenv
ans =
PythonEnvironment with properties:
Version: "3.8"
Executable: "/var/home/alex/miniconda3/envs/matlab/bin/python"
Library: "/var/home/alex/miniconda3/envs/matlab/lib/libpython3.8.so"
Home: "/var/home/alex/miniconda3/envs/matlab"
Status: NotLoaded
ExecutionMode: InProcess
채택된 답변
Cam Salzberger
2020년 7월 27일
Hello Alexander,
There is unfortunately an issue with the current documentation, which should be updated soon. Instead of Python 3.7+, you need exactly Python 3.7 to use ROS 2 custom messages or code generation with MATLAB. Once you install Python 3.7 and point MATLAB to use it with pyenv('Version', <executable path>), it should work.
-Cam
댓글 수: 12
Alexander Wang
2020년 7월 27일
편집: Alexander Wang
2020년 7월 27일
Thanks Cam, this solves the previous error. There come another two errors though. One is
Expected one output from a curly brace or dot indexing expression, but there were 0 results.
Error in ros.ros2.internal.ColconBuilder/runColconCmd (line 74)
{['"' fullfile(fileparts(mfilename('fullpath')),'runcolconcmd') '" "'
strtrim(h.MexInfo.Details.CommandLineShell) '"'], ...use .bat file
Error in ros.ros2.internal.ColconBuilder/buildPackage (line 404)
[status, result] = h.runColconCmd(cmd, varargin{:});
Error in ros2genmsg (line 165)
buildPackage(builder, [], ' --merge-install'); %other messages might need to be present in the same directory
So I have to modify that line manually even though it shows `read-only`, and then I get the error
Error using ros.ros2.internal.ColconBuilder/buildPackage (line 403)
Error building package: /var/home/alex/opt/MATLAB/R2020a/toolbox/ros/mlros2/+ros/+ros2/+internal/runcolconcmd.sh:
line 37: /var/home/alex/.matlab/R2020a/ros2/python_venv/bin/colcon: No such file or directory
.
Error in ros2genmsg (line 165)
buildPackage(builder, [], ' --merge-install'); %other messages might need to be present in the same directory
So I follow the directory and install the colcon-core under that python env.
Horray finally I can generate the message now.
But it is not a smooth process and it seems a bit weird that the internal `ColconBuilder.m` throws a syntax error. Is that a problem only on my system or is that a general bug?
Again, when I try to create a message
Warning: Name is nonexistent or not a directory:
/var/home/alex/devel/finger_perception/custom/matlab_msg_gen/glnxa64/install/m
> In path (line 109)
In addpath (line 86)
In ros.internal.getEmptyMessage (line 17)
In ros2message (line 37)
In ros2message (line 43)
In ros2message (line 43)
Error using ros.internal.getEmptyMessage (line 25)
Unrecognized message type tactile_msgs/TactileSignal. Use ros2 msg list to see available types.
Error in ros2message (line 37)
msg = ros.internal.getEmptyMessage(messageType,'ros2');
43 rethrow(ex)
but
ros2 msg list
shows that the message type has been generated...

Hey Alexander,
I'm a bit worried about you having changed the code inside of ColconBuilder, as that should work without any modification. That section of the code should be:
cmdline = sprintf('%s ',varargin{:});
cmdmap = containers.Map({'win64','maci64','glnxa64'}, ...
{['"' fullfile(fileparts(mfilename('fullpath')),'runcolconcmd') '" "' strtrim(h.MexInfo.Details.CommandLineShell) '"'], ...use .bat file
['"' fullfile(fileparts(mfilename('fullpath')),'runcolconcmd.sh') '"'],... use .sh
['"' fullfile(fileparts(mfilename('fullpath')),'runcolconcmd.sh') '"']});
cmd = cmdmap(computer('arch'));
The "cmdmap" here is just used to determine which batch file or shell script should be used depending on which platform you are on. From the error message, it looks like your code was missing the second half of the "Windows" line (everything after "strtrim"). Make sure you haven't moved this file either, as it uses that to determine the location of the shell script. It shouldn't really be possible for it to not return a value to cmdmap.
Also, a little background about what createOrGetLocalPython is doing. There are several non-standard Python packages required for ROS 2. Rather than requring users to install them, this creates a Python virtual environment (venv) and installs those Python modules to the virtual environment. Then whenever it needs to run any Python commands (mostly running colcon build), it activates the virtual environment and uses that. Once this virtual environment gets created, it can be used from then on ("getting" rather than "creating" the Python environment). This lets it be only a one-time setup time-sink rather than requiring the setup every time.
You shouldn't need to personally modify the Python virtual environment - it should have everything it needs from the module install. There's a possibility that it got created in a bad state though, but continues to try to use it. You can force MATLAB to recreate the virtual environment from scratch with:
ros.ros2.internal.createOrGetLocalPython(true)
(the "true" argument forces the recreation)
One thing that can help, after running "ros2genmsg" is to check the build log link that gets output. This is the raw colcon build log file, so you can skim/search it for any errors or warnings if something is coming up weird.
The message showing in "ros2 msg list" means that the message got registered as a custom message with MATLAB, and the location of the message definition file exists and is known (as that is how "ros2 msg list" determines availability of messages). However, it seems that the expected MATLAB file for generating the default message did not get created (should be in this relative location: matlab_msg_gen/glnxa64/install/m). That seems to indicate the build not fully completing without some kind of error stopping it early.
To summarize my suggestion:
- Put the code in ColconBuilder/runColconCmd back to how it was, but make sure it matches what I showed (lines 72-77).
- Run ros.ros2.internal.createOrGetLocalPython(true)
- Try ros2genmsg again, and check the build log for any odd output
- Check that the folder matlab_msg_gen/glnxa64/install/m is created, and contains a file for your message type
-Cam
Alexander Wang
2020년 7월 28일
편집: Alexander Wang
2020년 7월 28일
Thanks for your patience and help. Here is the log after I revert everything to the original and do exactly as you suggested.
Expected one output from a curly brace or dot indexing expression, but there were 0 results.
Error in ros.ros2.internal.ColconBuilder/runColconCmd (line 74)
{['"' fullfile(fileparts(mfilename('fullpath')),'runcolconcmd') '" "'
strtrim(h.MexInfo.Details.CommandLineShell) '"'], ...use .bat file
Error in ros.ros2.internal.ColconBuilder/buildPackage (line 404)
[status, result] = h.runColconCmd(cmd, varargin{:});
Error in ros2genmsg (line 165)
buildPackage(builder, [], ' --merge-install'); %other messages might need to be present in the same directory
BTW, since my default python is 3.8. I am running matlab in a conda environment with python 3.7. Would that be a problem?
Also, since my ros2 packages are all running in a docker container, I don't have a ros2 installment on the host machine actually. Is that okay?
Ah, I think I've figured it out. The issue is with this portion of the command:
strtrim(h.MexInfo.Details.CommandLineShell)
The value contained in h.MexInfo comes from:
mex.getCompilerConfigurations('C++')
I would bet that if you ran that, you would get an empty object result (0x1 CompilerConfiguration). That will cause the first line there to fail with your error.
I'm actually surprised it managed to attempt a colcon build without the compiler being set, since it requires that to perform the build. Colcon must be picking up the default installation location of the compiler. You should be able to resolve this by running:
mex -setup C++
and following the prompts from there. You can see supported compilers for your OS for ROS 2 listed here or even here.
Hmm, though if that's the case, I wouldn't think it would get past line 157 in ros2genmsg, since that should be where it checks the compiler version for compatibility. When I run after removing my selected compiler, that's where it errors for me. Well, at least make sure you run the mex -setup and check the getCompilerConfigurations output. Let me know that information if it still doesn't work.
I have never tested this with or used Conda environments before, so I can't speak for whether it might cause issues or not, though it doesn't seem to be the cause of this specific issue. You don't need to have any ROS 2 libraries installed on your system to use ROS 2 in MATLAB.
-Cam
Alexander Wang
2020년 7월 28일
편집: Alexander Wang
2020년 7월 28일
You are right. I don't have a c++ compiler on the host machine. Thanks for solving this problem.
Now I get errors in build log as follows
[ 68%] Building C object CMakeFiles/tactile_msgs__python.dir/rosidl_generator_py/tactile_msgs/msg/_tactile_signal_s.c.o
gmake[2]: *** No rule to make target '/usr/lib/x86_64-linux-gnu/libz.so', needed by 'libtactile_msgs_matlab.so'. Stop.
gmake[2]: *** Waiting for unfinished jobs....
[ 71%] Building CXX object CMakeFiles/tactile_msgs_matlab.dir/src/tactile_msgs_TactileSignal_common.cpp.o
[ 74%] Building CXX object CMakeFiles/tactile_msgs_matlab.dir/src/tactile_msgs_msg_TactileSignal_publisher.cpp.o
[ 77%] Building CXX object CMakeFiles/tactile_msgs_matlab.dir/src/tactile_msgs_msg_TactileSignal_subscriber.cpp.o
/var/home/alex/devel/finger_perception/custom/matlab_msg_gen/glnxa64/build/tactile_msgs/rosidl_generator_py/tactile_msgs/msg/_tactile_signal_s.c:11:10: fatal error: numpy/ndarrayobject.h: No such file or directory
11 | #include "numpy/ndarrayobject.h"
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
gmake[2]: *** [CMakeFiles/tactile_msgs__python.dir/build.make:63: CMakeFiles/tactile_msgs__python.dir/rosidl_generator_py/tactile_msgs/msg/_tactile_signal_s.c.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:609: CMakeFiles/tactile_msgs__python.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
gmake[1]: *** [CMakeFiles/Makefile2:74: CMakeFiles/tactile_msgs_matlab.dir/all] Error 2
gmake: *** [Makefile:141: all] Error 2
Cam Salzberger
2020년 7월 28일
편집: Cam Salzberger
2020년 7월 28일
Did you run this again?
ros.ros2.internal.createOrGetLocalPython(true)
That kind of error usually shows up only if the Python packages fail to fully install to the virtual environment (numpy installs last).
If that still doesn't work, and you are alright with modifying your Python 3.7 installation, you could try adding numpy to it? Make sure it's the 3.7 installation that you are modifying:
python3 -m pip install --upgrade numpy
Then rerun the createOrGetLocalPython command above to recapture the new state of the base Python.
One other possibility is the final dependency for custom messages. You have Python 3.7 and the supported compiler (gcc 6.3 or Xcode 10), but it also requires CMake of at least a particular version. We've tested for R2020a with CMake 3.10+, but I did see one instance of an issue with an unusual setup and a CMake version below 3.13 that was unable to properly find the Python paths. First, what is your current CMake version:
cmake --version
Next, you could try updating it to the latest release. I've personally tested with 3.15 and 3.17, so one of those should be fine too.
Side note: Are you on Mac or Linux? What OS and version?
-Cam
Unfortunately the problem persists.
I did follow all your steps and have installed numpy. I also checked pip list in the python_venv created by Matlab, numpy is presented

Besides,

I also tried manually append the numpy include directory to $CFLAGS, but it didn't help at all.
What OS and version are you using? I want to try to reproduce this if possible.
I have seen one other instance where having Python 3.8 available, while trying to use Python 3.7, is actually causing issues. The issues didn't look anything like this one, but it might be worth trying. Run this within MATLAB:
getenv('PATH')
and see if there is any mention of Python 3.8 in there. If so, try removing removing it and setting the environment variable to the new value without it. If you do this just within MATLAB, it won't affect your environment outside of it.
-Cam
Alexander Wang
2020년 7월 29일
편집: Alexander Wang
2020년 7월 29일
I am running Fedora 32 Silverblue. Matlab is started within conda env, both python and python3, pip and pip3 have been redirected to python3.7. Though python3.8 does exist in /usr/bin/, unless there are scripts calling python3.8 explicitly, I guess it should not be a problem?
If I remove /usr/bin/ from PATH by setenv, lots of linux tools are missing. Besides, Fedora Silverblue has its root directory immutable, I cannot rename anything under /usr/.
for your reference, i uploaded the entire build log.
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /var/home/alex/miniconda3/envs/matlab/bin/x86_64-conda_cos6-linux-gnu-cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /var/home/alex/miniconda3/envs/matlab/bin/x86_64-conda_cos6-linux-gnu-c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ament_cmake: 0.7.3 (/var/home/alex/opt/MATLAB/R2020a/sys/ros2/glnxa64/ros2/share/ament_cmake/cmake)
-- Found PythonInterp: /var/home/alex/.matlab/R2020a/ros2/python_venv/bin/python3 (found suitable version "3.7.7", minimum required is "3")
-- Using PYTHON_EXECUTABLE: /var/home/alex/.matlab/R2020a/ros2/python_venv/bin/python3
-- Found ament_cmake_ros: 0.7.0 (/var/home/alex/opt/MATLAB/R2020a/sys/ros2/glnxa64/ros2/share/ament_cmake_ros/cmake)
-- Found rosidl_typesupport_c: 0.7.1 (/var/home/alex/opt/MATLAB/R2020a/sys/ros2/glnxa64/ros2/share/rosidl_typesupport_c/cmake)
-- Found rosidl_typesupport_cpp: 0.7.1 (/var/home/alex/opt/MATLAB/R2020a/sys/ros2/glnxa64/ros2/share/rosidl_typesupport_cpp/cmake)
-- Found rosidl_default_generators: 0.7.0 (/var/home/alex/opt/MATLAB/R2020a/sys/ros2/glnxa64/ros2/share/rosidl_default_generators/cmake)
-- Found OpenSSL: /var/home/alex/miniconda3/envs/matlab/lib/libcrypto.so (found version "1.1.1g")
-- Found FastRTPS: /var/home/alex/opt/MATLAB/R2020a/sys/ros2/glnxa64/ros2/include
-- Found rosidl_adapter: 0.7.4 (/var/home/alex/opt/MATLAB/R2020a/sys/ros2/glnxa64/ros2/share/rosidl_adapter/cmake)
-- Found class_loader: 1.3.1 (/var/home/alex/opt/MATLAB/R2020a/sys/ros2/glnxa64/ros2/share/class_loader/cmake)
-- Found poco_vendor: (/var/home/alex/opt/MATLAB/R2020a/sys/ros2/glnxa64/ros2/share/poco_vendor/cmake)
-- Found rclcpp: 0.7.6 (/var/home/alex/opt/MATLAB/R2020a/sys/ros2/glnxa64/ros2/share/rclcpp/cmake)
-- Found rmw_implementation_cmake: 0.7.2 (/var/home/alex/opt/MATLAB/R2020a/sys/ros2/glnxa64/ros2/share/rmw_implementation_cmake/cmake)
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found std_msgs: 0.7.0 (/var/home/alex/opt/MATLAB/R2020a/sys/ros2/glnxa64/ros2/share/std_msgs/cmake)
-- Found PythonInterp: /var/home/alex/.matlab/R2020a/ros2/python_venv/bin/python3 (found version "3.7.7")
-- Using all available rosidl_typesupport_c: rosidl_typesupport_fastrtps_c;rosidl_typesupport_introspection_c
-- Using all available rosidl_typesupport_cpp: rosidl_typesupport_fastrtps_cpp;rosidl_typesupport_introspection_cpp
-- Found PythonInterp: /var/home/alex/.matlab/R2020a/ros2/python_venv/bin/python3 (found suitable version "3.7.7", minimum required is "3.5")
-- Found python_cmake_module: 0.7.7 (/var/home/alex/opt/MATLAB/R2020a/sys/ros2/glnxa64/ros2/share/python_cmake_module/cmake)
-- Found PythonLibs: /var/home/alex/.matlab/R2020a/ros2/python_venv/lib/libpython3.7m.so (found suitable version "3.7.7", minimum required is "3.5")
-- Using PYTHON_EXECUTABLE: /var/home/alex/.matlab/R2020a/ros2/python_venv/bin/python3
-- Using PYTHON_INCLUDE_DIRS: /var/home/alex/.matlab/R2020a/ros2/python_venv/include/python3.7m
-- Using PYTHON_LIBRARIES: /var/home/alex/.matlab/R2020a/ros2/python_venv/lib/libpython3.7m.so
-- Found PythonExtra: .so
-- Configuring done
-- Generating done
-- Build files have been written to: /var/home/alex/devel/finger_perception/matlab_msg_gen/glnxa64/build/tactile_msgs
[35m[1mScanning dependencies of target tactile_msgs__cpp[0m
[ 2%] [34m[1mGenerating C code for ROS interfaces[0m
[ 5%] [34m[1mGenerating C++ code for ROS interfaces[0m
[ 5%] Built target tactile_msgs__cpp
[ 11%] [34m[1mGenerating C++ type support for eProsima Fast-RTPS[0m
[ 11%] [34m[1mGenerating C++ type support dispatch for ROS interfaces[0m
[ 14%] [34m[1mGenerating C++ introspection for ROS interfaces[0m
[35m[1mScanning dependencies of target tactile_msgs__rosidl_generator_c[0m
[ 17%] [32mBuilding C object CMakeFiles/tactile_msgs__rosidl_generator_c.dir/rosidl_generator_c/tactile_msgs/msg/tactile_signal__functions.c.o[0m
[ 20%] [32m[1mLinking C shared library libtactile_msgs__rosidl_generator_c.so[0m
[ 20%] Built target tactile_msgs__rosidl_generator_c
[ 25%] [34m[1mGenerating C type support dispatch for ROS interfaces[0m
[ 25%] [34m[1mGenerating C introspection for ROS interfaces[0m
[35m[1mScanning dependencies of target tactile_msgs__rosidl_typesupport_cpp[0m
[35m[1mScanning dependencies of target tactile_msgs__rosidl_typesupport_introspection_cpp[0m
[ 28%] [32mBuilding CXX object CMakeFiles/tactile_msgs__rosidl_typesupport_cpp.dir/rosidl_typesupport_cpp/tactile_msgs/msg/tactile_signal__type_support.cpp.o[0m
[35m[1mScanning dependencies of target tactile_msgs__rosidl_typesupport_fastrtps_cpp[0m
[ 31%] [32mBuilding CXX object CMakeFiles/tactile_msgs__rosidl_typesupport_introspection_cpp.dir/rosidl_typesupport_introspection_cpp/tactile_msgs/msg/tactile_signal__type_support.cpp.o[0m
[ 34%] [32mBuilding CXX object CMakeFiles/tactile_msgs__rosidl_typesupport_fastrtps_cpp.dir/rosidl_typesupport_fastrtps_cpp/tactile_msgs/msg/dds_fastrtps/tactile_signal__type_support.cpp.o[0m
[35m[1mScanning dependencies of target tactile_msgs__rosidl_typesupport_c[0m
[ 37%] [32mBuilding CXX object CMakeFiles/tactile_msgs__rosidl_typesupport_c.dir/rosidl_typesupport_c/tactile_msgs/msg/tactile_signal__type_support.cpp.o[0m
[35m[1mScanning dependencies of target tactile_msgs__rosidl_typesupport_introspection_c[0m
[ 40%] [32mBuilding C object CMakeFiles/tactile_msgs__rosidl_typesupport_introspection_c.dir/rosidl_typesupport_introspection_c/tactile_msgs/msg/tactile_signal__type_support.c.o[0m
[ 42%] [32m[1mLinking CXX shared library libtactile_msgs__rosidl_typesupport_c.so[0m
[ 45%] [32m[1mLinking C shared library libtactile_msgs__rosidl_typesupport_introspection_c.so[0m
[ 45%] Built target tactile_msgs__rosidl_typesupport_c
[ 45%] Built target tactile_msgs__rosidl_typesupport_introspection_c
[ 48%] [32m[1mLinking CXX shared library libtactile_msgs__rosidl_typesupport_cpp.so[0m
[ 51%] [32m[1mLinking CXX shared library libtactile_msgs__rosidl_typesupport_introspection_cpp.so[0m
[ 51%] Built target tactile_msgs__rosidl_typesupport_cpp
[ 51%] Built target tactile_msgs__rosidl_typesupport_introspection_cpp
[ 54%] [32m[1mLinking CXX shared library libtactile_msgs__rosidl_typesupport_fastrtps_cpp.so[0m
[ 54%] Built target tactile_msgs__rosidl_typesupport_fastrtps_cpp
[ 57%] [34m[1mGenerating C type support for eProsima Fast-RTPS[0m
[35m[1mScanning dependencies of target tactile_msgs__rosidl_typesupport_fastrtps_c[0m
[ 60%] [32mBuilding CXX object CMakeFiles/tactile_msgs__rosidl_typesupport_fastrtps_c.dir/rosidl_typesupport_fastrtps_c/tactile_msgs/msg/tactile_signal__type_support_c.cpp.o[0m
[ 62%] [32m[1mLinking CXX shared library libtactile_msgs__rosidl_typesupport_fastrtps_c.so[0m
[ 62%] Built target tactile_msgs__rosidl_typesupport_fastrtps_c
[35m[1mScanning dependencies of target tactile_msgs[0m
[ 62%] Built target tactile_msgs
[35m[1mScanning dependencies of target tactile_msgs_matlab[0m
[35m[1mScanning dependencies of target tactile_msgs__py[0m
[ 65%] [34m[1mGenerating Python code for ROS interfaces[0m
gmake[2]: *** No rule to make target '/usr/lib/x86_64-linux-gnu/libz.so', needed by 'libtactile_msgs_matlab.so'. Stop.
gmake[2]: *** Waiting for unfinished jobs....
[ 71%] [32mBuilding CXX object CMakeFiles/tactile_msgs_matlab.dir/src/tactile_msgs_TactileSignal_common.cpp.o[0m
[ 71%] [32mBuilding CXX object CMakeFiles/tactile_msgs_matlab.dir/src/tactile_msgs_msg_TactileSignal_publisher.cpp.o[0m
[ 74%] [32mBuilding CXX object CMakeFiles/tactile_msgs_matlab.dir/src/tactile_msgs_msg_TactileSignal_subscriber.cpp.o[0m
[ 74%] Built target tactile_msgs__py
[35m[1mScanning dependencies of target tactile_msgs__python[0m
[ 77%] [32mBuilding C object CMakeFiles/tactile_msgs__python.dir/rosidl_generator_py/tactile_msgs/msg/_tactile_signal_s.c.o[0m
/var/home/alex/devel/finger_perception/matlab_msg_gen/glnxa64/build/tactile_msgs/rosidl_generator_py/tactile_msgs/msg/_tactile_signal_s.c:11:10: fatal error: numpy/ndarrayobject.h: No such file or directory
#include "numpy/ndarrayobject.h"
^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
gmake[2]: *** [CMakeFiles/tactile_msgs__python.dir/build.make:82: CMakeFiles/tactile_msgs__python.dir/rosidl_generator_py/tactile_msgs/msg/_tactile_signal_s.c.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:547: CMakeFiles/tactile_msgs__python.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
gmake[1]: *** [CMakeFiles/Makefile2:142: CMakeFiles/tactile_msgs_matlab.dir/all] Error 2
gmake: *** [Makefile:160: all] Error 2
Hi Cam, thanks for your efforts.
I have moved to Ubuntu 20 now. But the last problem of numpy header persists. Is there any way to manually specify the include directories?
Hello together,
for last few days I also had problems to generate the custom messages.
Finally I came across the right solution and would like to briefly show what steps are needed to install it correctly.
To build the custom messages you need CMake, Python 3.7 and the ROS Toolbox.
For CMake:
1. go to https://cmake.org/download/
2. download version 3.20.5 as *.sh
mkdir ~/cmake-install
mv cmake-<version>.sh ~/cmake-install/
% move to ~/cmake-install/ and execute installer
./cmake-<version>.sh
% Finally add these lines to ~/.bashrc
export PATH=$HOME/cmake-install/bin:$PATH
export CMAKE_PREFIX_PATH=$HOME/cmake-install:$CMAKE_PREFIX_PATH
For Python:
For this I installed version 3.7+.
% install dependencies
sudo apt update
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
cd /tmp
% download python 3.7+
wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tar.xz
tar -xf Python-3.7.2.tar.xz
cd Python-3.7.2
% prepare for compiling. --enable-shared is important when linking
% libpython
./configure --enable-shared
make
sudo make altinstall
When building custom messages colcon will need numpy-headers.
Attention: It does not have to be the 3.7.2 installation where you install numpy. Colcon does not care about the virtual environment which ros2 creates.
% install numpy
python3 -m pip install numpy
---
Now run Matlab and hit pyenv. If Version 3.7.2 does not appear, hit:
pyenv('Version', "</path/to/python3.7>")
Check also if CMake has been installed correctly. Hit
% No errors should appear
!cmake --version
From here everything should work fine. Select your path to your messages und run the build.
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
