stevenlovegrove / Pangolin

Pangolin is a lightweight portable rapid development library for managing OpenGL display / interaction and abstracting video input.
MIT License
2.36k stars 853 forks source link

cmake --build . --target pypangolin_pip_install creates an unknown-unknown.whl #752

Closed RishabhChangwani closed 1 week ago

RishabhChangwani commented 2 years ago
cmake --build . --target pypangolin_pip_install
Consolidate compiler generated dependencies of target pango_core
[  9%] Built target pango_core
Consolidate compiler generated dependencies of target pango_image
[ 21%] Built target pango_image
Consolidate compiler generated dependencies of target pango_opengl
[ 29%] Built target pango_opengl
Consolidate compiler generated dependencies of target pango_windowing
[ 36%] Built target pango_windowing
Consolidate compiler generated dependencies of target pango_vars
[ 37%] Built target pango_vars
Consolidate compiler generated dependencies of target pango_display
[ 47%] Built target pango_display
Consolidate compiler generated dependencies of target pango_packetstream
[ 50%] Built target pango_packetstream
Consolidate compiler generated dependencies of target pango_plot
[ 54%] Built target pango_plot
Consolidate compiler generated dependencies of target pango_video
[ 80%] Built target pango_video
Consolidate compiler generated dependencies of target pypangolin
[ 98%] Built target pypangolin
[ 98%] Creating Wheel /home/ubuntu/Desktop/catkin_ws/src/ORB_SLAM2/Pangolin/build/unknown-unknown.whl
[ 98%] Built target pypangolin_wheel
[100%] Installing for selected Python '/usr/bin/python3.9'
unknown-unknown.whl is not a valid wheel filename.
CMakeFiles/pypangolin_pip_install.dir/build.make:70: recipe for target 'CMakeFiles/pypangolin_pip_install' failed
make[3]: *** [CMakeFiles/pypangolin_pip_install] Error 1
CMakeFiles/Makefile2:956: recipe for target 'CMakeFiles/pypangolin_pip_install.dir/all' failed
make[2]: *** [CMakeFiles/pypangolin_pip_install.dir/all] Error 2
CMakeFiles/Makefile2:963: recipe for target 'CMakeFiles/pypangolin_pip_install.dir/rule' failed
make[1]: *** [CMakeFiles/pypangolin_pip_install.dir/rule] Error 2
Makefile:390: recipe for target 'pypangolin_pip_install' failed
make: *** [pypangolin_pip_install] Error 2
goldbird5 commented 2 years ago

I had exactly same issue when CMake selected python2.7, but when I change the version to python3.6 (by cmake .. -DPython_EXECUTABLE=/......./python3.6, since I use CMake version 3.18.0 the variable is as so) I got no issue. Maybe I think the version of python is the reason. Try little bit low version such as 3.6 or 3.8

0xTechSavvy commented 2 years ago

pip install wheel

dwindy commented 2 years ago

pip install wheel

it says Requirement already satisfied: wheel in /usr/lib/python3/dist-packages (0.34.2)

christian-rauch commented 2 years ago

I cannot reproduce this with:

cmake -B build
cmake --build build --target pypangolin_pip_install

If I run these commands, I get a pypangolin-0.8-cp38-cp38-linux_x86_64.whl inside the folder build.

Coldmooon commented 2 years ago

Open the file ./cmake/MakePythonWheel.cmake, and you will find the code:

message(STATUS "Python module `setuptools` required for correct wheel filename generation. Please install if needed.")
        set(wheel_filename "unknown;unknown")

This is why you got unknown-unknown.whl. Fix this issue by:

python3 -m pip install --upgrade pip setuptools wheel
esmeetu commented 1 year ago

cmake -B build -GNinja build with ninja works! no need to specific PYTHON_DIR or PYTHON_EXECUTABLE

Then. cmake --build build -t pypangolin_pip_install

goku-g commented 1 year ago

incounter an error while running $cmake --build build -t pypangolin_pip_install

ERROR: unknown-unknown.whl is not a valid wheel filename.
make[3]: *** [CMakeFiles/pypangolin_pip_install.dir/build.make:58: CMakeFiles/pypangolin_pip_install] Error 1
make[2]: *** [CMakeFiles/Makefile2:746: CMakeFiles/pypangolin_pip_install.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:753: CMakeFiles/pypangolin_pip_install.dir/rule] Error 2
make: *** [Makefile:268: pypangolin_pip_install] Error 2

Solution:

add python directory to the PATH NOTE: for python location $whereis python3, for adding to PATH $export PATH="/python_location:$PATH"

Where, /python_location = /usr/bin/pyhton3.8 (or your python3 location)

After adding directory to PATH re-run

$cmake -B build
$cmake --build build

from here and finally $cmake --build build -t pypangolin_pip_install

chenmozxh commented 1 year ago

incounter an error while running $cmake --build build -t pypangolin_pip_install

ERROR: unknown-unknown.whl is not a valid wheel filename.
make[3]: *** [CMakeFiles/pypangolin_pip_install.dir/build.make:58: CMakeFiles/pypangolin_pip_install] Error 1
make[2]: *** [CMakeFiles/Makefile2:746: CMakeFiles/pypangolin_pip_install.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:753: CMakeFiles/pypangolin_pip_install.dir/rule] Error 2
make: *** [Makefile:268: pypangolin_pip_install] Error 2

Solution:

add python directory to the PATH NOTE: for python location $whereis python3, for adding to PATH $export PATH="/python_location:$PATH"

Where, /python_location = /usr/bin/pyhton3.8 (or your python3 location)

After adding directory to PATH re-run

$cmake -B build
$cmake --build build

from here and finally $cmake --build build -t pypangolin_pip_install

it works, helps me a lot thx

Halfold commented 2 weeks ago

hello everyone, i had the same problem today, but when I followed the solution mentioned above, the situation did not change for the better.

here I successfully add the python dir to $PATH

$ echo $PATH /opt/ros/noetic/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/bin/python3.8

and re-run the two build-command. but after that i still have the same unknown-unknown.whl issue...

$ cmake --build build -t pypangolin_pip_install [100%] Built target pango_core [100%] Built target pango_packetstream [100%] Built target pango_image [100%] Built target pango_opengl [100%] Built target pango_windowing [100%] Built target pango_vars [100%] Built target pango_display [100%] Built target pango_video [100%] Built target pango_plot [100%] Built target pypangolin [100%] Creating Wheel /home/tengli/pangolin/Pangolin/build/unknown-unknown.whl [100%] Built target pypangolin_wheel [100%] Installing for selected Python '/usr/bin/python3.8' Defaulting to user installation because normal site-packages is not writeable ERROR: unknown-unknown.whl is not a valid wheel filename. make[3]: [CMakeFiles/pypangolin_pip_install.dir/build.make:58:CMakeFiles/pypangolin_pip_install] 错误 1 make[2]: [CMakeFiles/Makefile2:746:CMakeFiles/pypangolin_pip_install.dir/all] 错误 2 make[1]: [CMakeFiles/Makefile2:753:CMakeFiles/pypangolin_pip_install.dir/rule] 错误 2 make: [Makefile:268:pypangolin_pip_install] 错误 2

and i also try this, doesn't work python3 -m pip install --upgrade pip setuptools wheel

I would be very appreciate if someone can help give ideas and ways to solve the problem:)

christian-rauch commented 1 week ago

The wheel file name unknown-unknown.whl does not look right.

The wheel file name is formatted as part of the MakeWheel macro: https://github.com/stevenlovegrove/Pangolin/blob/master/cmake/MakePythonWheel.cmake via the Python code: https://github.com/stevenlovegrove/Pangolin/blob/e80f97436fb1ff813189c54f18667d0d7b22711d/cmake/MakePythonWheel.cmake#L13-L29

Essentially, something like

#!/usr/bin/env python3

from setuptools.dist import Distribution
from setuptools import Extension

def wheel_name(**kwargs):
    # create a fake distribution from arguments
    dist = Distribution(attrs=kwargs)
    # finalize bdist_wheel command
    bdist_wheel_cmd = dist.get_command_obj('bdist_wheel')
    bdist_wheel_cmd.ensure_finalized()
    # assemble wheel file name
    distname = bdist_wheel_cmd.wheel_dist_name
    tag = '-'.join(bdist_wheel_cmd.get_tag())
    return f'{distname};{tag}'

python_module = "pypangolin"
version = "0.9.2"

print(wheel_name(name=f'{python_module}', version=f'{version}', ext_modules=[Extension('dummy', ['summy.c'])]))

should print something like pypangolin-0.9.2;cp312-cp312-linux_x86_64.

The fallback unknown;unknown is used if the returned string is empty: https://github.com/stevenlovegrove/Pangolin/blob/e80f97436fb1ff813189c54f18667d0d7b22711d/cmake/MakePythonWheel.cmake#L34-L37 but this also means you should have seen a Python modulesetuptoolsrequired for correct wheel filename generation. Please install if needed. on the terminal.

@Halfold Can you check the code snippet above and report back if it returns something useful, and also check the terminal output for the CMake message?

christian-rauch commented 1 week ago

I changed some bits around the wheel file generation in https://github.com/stevenlovegrove/Pangolin/pull/956. It probably does not fix your issue, since you will still have to install setuptools, but it now fails when setuptools is not available instead of generating an invalid wheel file, and it provides more information about the Python module search path.