Closed RishabhChangwani closed 1 week 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
pip install wheel
pip install wheel
it says
Requirement already satisfied: wheel in /usr/lib/python3/dist-packages (0.34.2)
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
.
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
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
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
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
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
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:)
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 module
setuptoolsrequired 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?
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.