Using python3.8 in anaconda to work with ROS Melodic [closed]

asked 2022-02-08 03:40:17 -0500

kankanzheli gravatar image

updated 2022-02-08 04:44:42 -0500

gvdhoorn gravatar image

In python3, import tf will report error. After I found some website which teach me to install geometry packgae for python3.8 in anaconda enviroment. I did those following steps:

conda create -n openai python=3.8 -y
conda activate openai
pip install rospkg catkin_pkg
sudo apt install python3-dev python3-pip python3-venv
pip install --upgrade tensorflow
pip install catkin_pkg 
pip install -e .
conda install -c anaconda make
pip install rospkg empy pyyaml
conda activate openai
cd ~/anaconda3/envs/openai/geometry/src
git clone -b indigo-devel https://github.com/ros/geometry.git   (melodic version)
git clone -b indigo-devel https://github.com/ros/geometry2.git  (melodic version)

[delete some words in geometry2/test_tf2/CmakeLists.txt: if(NOT CATKIN_ENABLE_TESTING) return() endif() ]

git clone https://github.com/orocos/orocos_kinematics_dynamics/releases/tag/v1.4.0
cd ~/anaconda3/envs/openai/geometry
catkin_make_isolated --cmake-args -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=~/anaconda3/envs/openai/bin/python -DPYTHON_INCLUDE_DIR=~/anaconda3/envs/openai/include/python3.8 -DPYTHON_LIBRARY=~/anaconda3/envs/openai/lib/libpython3.8.so

But when I try to catkin_make this package in anconda, this error will occur:

Failed to process package 'geometry': 
  Command '['cmake', '/home/zhaowentao/anaconda3/envs/openai/geometry/src/geometry/geometry', '-DCATKIN_DEVEL_PREFIX=/home/zhaowentao/anaconda3/envs/openai/geometry/devel_isolated/geometry', '-DCMAKE_INSTALL_PREFIX=/home/zhaowentao/anaconda3/envs/openai/geometry/install_isolated', '-DCMAKE_BUILD_TYPE=Release', '-DPYTHON_EXECUTABLE=~/anaconda3/envs/openai/bin/python', '-DPYTHON_INCLUDE_DIR=~/anaconda3/envs/openai/include/python3.8', '-DPYTHON_LIBRARY=~/anaconda3/envs/openai/lib/libpython3.8.so', '-G', 'Unix Makefiles']' returned non-zero exit status 1.

So what should I do? Or how can I import tf and tf2 in the python3.8 of anaconda?

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by kankanzheli
close date 2022-02-13 05:21:46.181495