ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

roswtf pythonpath

asked 2022-04-27 08:02:24 -0500

Petros ADLATUS gravatar image

Hey,

I run roswtf to check if everything is fine with my ROS-noetic, but I failed to interpret this error right. So could somebody explain why these two paths seemed to be wrong or setted wrong? On ROS Answers I don't see a question like this and also on github

ERROR Not all paths in PYTHONPATH [/home/pkatsoulakos/catkin_ws/devel/lib/python3/dist-packages:/opt/ros/noetic/lib/python3/dist-packages:/usr/bin/python3:/usr/bin/python] point to a directory: 
 * /usr/bin/python3
 * /usr/bin/python

Thanks for helping

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2022-04-27 08:24:48 -0500

gvdhoorn gravatar image

updated 2022-04-27 08:25:52 -0500

The PYTHONPATH environment variable is supposed to contain a list of paths (or: directories).

From the official documentation on PYTHONPATH (emphasis mine):

Augment the default search path for module files. The format is the same as the shell’s PATH: one or more directory pathnames separated by os.pathsep (e.g. colons on Unix or semicolons on Windows). Non-existent directories are silently ignored.

In addition to normal directories, individual PYTHONPATH entries may refer to zipfiles containing pure Python modules (in either source or compiled form). Extension modules cannot be imported from zipfiles.

As you can read: plain files are not supposed to be listed in this environment variable.

Despite its name, it's not "the path to the python executable".

In your case, you have:

  • /home/pkatsoulakos/catkin_ws/devel/lib/python3/dist-packages
  • /opt/ros/noetic/lib/python3/dist-packages
  • /usr/bin/python3
  • /usr/bin/python

It's very likely /usr/bin/python3 (and /usr/bin/python) are not paths, but files.

Hence the complaint from roswtf.

edit flag offensive delete link more

Comments

1

Note that this is not a "ROS problem". PYTHONPATH is part of the regular Python runtime configuration infrastructure.

gvdhoorn gravatar image gvdhoorn  ( 2022-04-27 08:25:22 -0500 )edit

Hey thanks for the quick response,

yes you're right, these two are files not folders, so I guess I can remove them from my PYTHONPATH without doubt?

Petros ADLATUS gravatar image Petros ADLATUS  ( 2022-04-27 08:34:41 -0500 )edit
1

I can't say.

Those two entries don't make sense to me, but I also don't know how / why they ended up on your PYTHONPATH in the first place.

gvdhoorn gravatar image gvdhoorn  ( 2022-04-27 11:53:04 -0500 )edit

so I just uncomment in my bashrc file the 2 lines with /usr/bin/python3 and usr/bin/python. Dont remember why I've done this, but now it seems to be ok. Could be marked as answered

Petros ADLATUS gravatar image Petros ADLATUS  ( 2022-04-28 00:40:31 -0500 )edit

Could be marked as answered

that would be something you could/should do.

Tick the checkmark (✓) to the left of the answer.

gvdhoorn gravatar image gvdhoorn  ( 2022-04-28 03:14:41 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2022-04-27 08:02:24 -0500

Seen: 161 times

Last updated: Apr 28 '22