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

Invalid .whl name compiling inside a python virtual (venv) environment #959

Closed
firth650 opened this issue Oct 30, 2024 · 7 comments · Fixed by #960
Closed

Invalid .whl name compiling inside a python virtual (venv) environment #959

firth650 opened this issue Oct 30, 2024 · 7 comments · Fixed by #960

Comments

@firth650
Copy link

firth650 commented Oct 30, 2024

Hi
I had previously tried to compile Pangolin inside a system environment, and, as I was not using a venv, (as is now required), I chose to force the pip install using "--break-system-packages". This compiled and installed fine, and I could run the examples. Unfortunately, as may have been expected, I broke my system packages. and thus had to remove the Pangolin elements.

I have now tried to compile Pangolin inside a venv, and the wheel is not being correctly created. (This is the latest Pangolin from github with the Python_EXECUTABLE swapped for Python3_EXECUTABLE changes)

This is on a raspberry pi4 running Bookworm. In order to keep things simple: This a 100% fresh sdcard install with no other software on the card with all OS updates included.

These were my commands:

git clone --recursive https://github.com/stevenlovegrove/Pangolin.git
 cd Pangolin
./scripts/install_prerequisites.sh recommended
cmake -B build
cmake --build build -t pypangolin_pip_install

This runs without any errors until the final python .whl install (The .whl has an empty name) Output is as below

[ 98%] Linking CXX shared module pypangolin-0.9.2.data/purelib/pypangolin.cpython-311-aarch64-linux-gnu.so
lto-wrapper: warning: using serial compilation of 23 LTRANS jobs
lto-wrapper: note: see the ‘-flto’ option documentation for more information

[ 98%] Built target pypangolin
[ 98%] Creating Wheel /home/robot/LearnOpenCV/Pangolin/build/.whl
[ 98%] Built target pypangolin_wheel
[100%] Installing for selected Python '/home/robot/LearnOpenCV/bin/python3'
ERROR: Invalid requirement: '/home/robot/LearnOpenCV/Pangolin/build/.whl'
Hint: It looks like a path. The path does exist. 
gmake[3]: *** [CMakeFiles/pypangolin_pip_install.dir/build.make:71: CMakeFiles/pypangolin_pip_install] Error 1
gmake[2]: *** [CMakeFiles/Makefile2:957: CMakeFiles/pypangolin_pip_install.dir/all] Error 2
gmake[1]: *** [CMakeFiles/Makefile2:964: CMakeFiles/pypangolin_pip_install.dir/rule] Error 2
gmake: *** [Makefile:390: pypangolin_pip_install] Error 2

I am assuming that the switch to a venv has caused this, but I am unsure

@christian-rauch
Copy link
Collaborator

Can you provide steps (creating the virtual environment, building, ...) to reproduce this? I have not tested this in a virtual environment before, so this may indeed cause the problem.

@christian-rauch
Copy link
Collaborator

I can reproduce this with the following steps:

# create and active a virtual environment
python3 -m venv pangovenv
source pangovenv/bin/activate
# build and install the pypangolin wheel file
git clone https://github.com/stevenlovegrove/Pangolin.git
cd Pangolin
cmake -B build
cmake --build build -t pypangolin_pip_install

This shows me that Python is correctly found inside the virtual environment:

-- Found Python3: [...]/pangovenv/bin/python3.10 (found version "3.10.12") found components: Interpreter Development Development.Module Development.Embed 
-- Selected Python: '[...]/pangovenv/bin/python3.10'. cmake --build . -t pypangolin_pip_install to use pypangolin module.

and that the pypangolin.cpython-*.so is built:

[ 98%] Linking CXX shared module pypangolin-0.9.2.data/purelib/pypangolin.cpython-310-x86_64-linux-gnu.so

but the wheel file indeed has no name (.whl):

[100%] Creating Wheel [...]/Pangolin/build/.whl
[100%] Built target pypangolin_wheel
[100%] Installing for selected Python '[...]/pangovenv/bin/python3.10'
ERROR: Invalid requirement: '[...]/Pangolin/build/.whl'
Hint: It looks like a path. The path does exist.

@christian-rauch
Copy link
Collaborator

The snippet that generated the wheel name fails with:

distutils.errors.DistutilsModuleError: invalid command 'bdist_wheel'

After a:

pip install wheel

the wheel file name should be correct.

@firth650
Copy link
Author

Yes, the steps that you took were exactly the same as I did, and I also saw python being correctly found etc.

@christian-rauch
Copy link
Collaborator

Can you provide more details which OS and Python version you are using? Which versions of setuptools (pip show setuptools) and wheel (pip show wheel) you have installed?

@christian-rauch
Copy link
Collaborator

@firth650 Can you try with #960 if this shows better error messages that help you to debug the issue?

@firth650
Copy link
Author

firth650 commented Oct 31, 2024

I'm using:
Debian GNU/Linux 12 (bookworm)
setuptools Version: 66.1.1

(LearnOpenCV) robot@:$ pip show wheel
WARNING: Package(s) not found: wheel

AHH!! You had already diagnosed this 100% correctly. I apologise, my mistake. I had installed wheel outside of venv.

It now compiles/installs and runs the "PythonExamples" fine

Again apologies.

@firth650 firth650 closed this as completed Nov 1, 2024
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

Successfully merging a pull request may close this issue.

2 participants