ROSOnWindows icon indicating copy to clipboard operation
ROSOnWindows copied to clipboard

catkin_make fails to find proper python env

Open mgdelmonte opened this issue 5 years ago • 2 comments

The setup script c:\opt\ros\melodic\x64\setup.bat properly sets the PYTHONHOME env var, but it does not set PYTHON_EXECUTABLE, which catkin_make references independently. On a system with many python interpreters, this means catkin_make uses the wrong environment entirely (it uses the environment of the first-found interpreter, and not the one in PYTHONHOME).

I'd call this a bug in catkin_make, unless they have a good reason (unlikely) for using a random interpreter. But nevertheless this appears to happen only on Windows.

To reproduce, install two python 2 environments and then ROS using the second environment. Then install any ROS repo and run catkin_make. Unless both python environments have empy It will fail with "python can't find library em..." (meaning empy).

Workaround: manually add that PYTHON_EXECUTABLE env var to the ROS setup. It must have the full path to the python executable. (But you can't add it to setup.bat because it's autogenerated.)

OS: Windows 10 Chocolatey: v0.10.15

AB#509410

mgdelmonte avatar Feb 24 '20 14:02 mgdelmonte

Thank you for the writeup and investigation. We've been trying to map the ROS environment to a locally installed python path in c:\opt, so that it is isolated from potentially tainted environments outside of the ROS environment.

ooeygui avatar Feb 24 '20 15:02 ooeygui

we will consider checking PYTHONHOME in the setup and offer a warning during setup that a previous python environment was detected. the user can still click to continue setup.

IoTDan avatar Oct 11 '22 21:10 IoTDan