Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python system path installation wrong directory #2206

Closed
oysstu opened this issue Oct 12, 2023 · 2 comments · Fixed by #2274
Closed

Python system path installation wrong directory #2206

oysstu opened this issue Oct 12, 2023 · 2 comments · Fixed by #2274

Comments

@oysstu
Copy link
Contributor

oysstu commented Oct 12, 2023

Enabling the USE_SYSTEM_PATHS_FOR_PYTHON_INSTALLATION option installs the python libraries in a folder called gz in the system root. The other libraries, such as gz-msgs and gz-math, installs their libraries in the correct location using this option.

I suppose the following part is the problem

if(USE_SYSTEM_PATHS_FOR_PYTHON_INSTALLATION)
if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
execute_process(
COMMAND "${PYTHON_EXECUTABLE}" -c "if True:
from distutils import sysconfig as sc
print(sc.get_python_lib(plat_specific=True))"
OUTPUT_VARIABLE Python3_SITEARCH
OUTPUT_STRIP_TRAILING_WHITESPACE)
else()
# Get install variable from Python3 module
# Python3_SITEARCH is available from 3.12 on, workaround if needed:
find_package(Python3 COMPONENTS Interpreter)
endif()
if(USE_DIST_PACKAGES_FOR_PYTHON)
string(REPLACE "site-packages" "dist-packages" GZ_PYTHON_INSTALL_PATH ${Python3_SITEARCH})
endif()
else()
# If not a system installation, respect local paths
set(GZ_PYTHON_INSTALL_PATH ${GZ_LIB_INSTALL_DIR}/python)
endif()
set(GZ_PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
set(GZ_PYTHON_INSTALL_PATH "${GZ_PYTHON_INSTALL_PATH}/gz")

The equivalent part in gz-math. The else statement in USE_DIST_PACKAGES_FOR_PYTHON seem to be missing?
https://github.com/gazebosim/gz-math/blob/a527e1422c25df73e30ee4f0c38ccbe56f6da4e4/src/python_pybind11/CMakeLists.txt#L75-L100

@azeey
Copy link
Contributor

azeey commented Nov 10, 2023

Hi @oysstu, thanks for filing an issue! Since you've already identified what needs to be done, would you mind creating a PR?

@oysstu
Copy link
Contributor Author

oysstu commented Jan 2, 2024

Hi @oysstu, thanks for filing an issue! Since you've already identified what needs to be done, would you mind creating a PR?

Opened in #2274. With this, python libraries are installed to /usr/lib/python3.XX/site-packages/gz/ instead of /gz.

@github-project-automation github-project-automation bot moved this from To do to Done in Core development Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants