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

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

Closed
RishabhChangwani opened this issue Apr 7, 2022 · 11 comments

Comments

@RishabhChangwani
Copy link

RishabhChangwani commented Apr 7, 2022

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
Copy link

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
Copy link

pip install wheel

@dwindy
Copy link

dwindy commented Jun 2, 2022

pip install wheel

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

@christian-rauch
Copy link
Collaborator

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
Copy link

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
Copy link

esmeetu commented Jan 15, 2023

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
Copy link

goku-g commented Feb 14, 2023

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
Copy link

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
Copy link

Halfold commented Oct 11, 2024

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
Copy link
Collaborator

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:

COMMAND ${Python_EXECUTABLE} -c "
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}'
print(wheel_name(name='${python_module}', version='${version}', ext_modules=[Extension('dummy', ['summy.c'])]))
"

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:

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

but this also means you should have seen a Python module setuptools required 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
Copy link
Collaborator

I changed some bits around the wheel file generation in #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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants