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

Failure to detect pytest module on Windows #274

Closed
rotu opened this issue Aug 30, 2020 · 12 comments
Closed

Failure to detect pytest module on Windows #274

rotu opened this issue Aug 30, 2020 · 12 comments
Assignees

Comments

@rotu
Copy link
Contributor

rotu commented Aug 30, 2020

On Windows, ament_cmake_pytest is failing to find pytest despite it being installed in the current environment. It also spits out a Linux-specific debug message.

--- stderr: rosidl_adapter
CMake Warning at C:/opt/ros/master/install/ament_cmake_pytest/share/ament_cmake_pytest/cmake/ament_add_pytest_test.cmake:77 (message):
  The Python module 'pytest' was not found, pytests can not be run (e.g.  on
  Ubuntu/Debian install the package 'python3-pytest')
Call Stack (most recent call first):
  CMakeLists.txt:31 (ament_add_pytest_test)


---
Finished <<< rosidl_adapter [7.61s]
C:\opt\ros\master>where pytest
C:\Users\dan\AppData\Roaming\Python\Python38\Scripts\pytest.exe
C:\opt\ros\master>python -c "import pytest; print(pytest.__path__)"
['C:\\Users\\dan\\AppData\\Roaming\\Python\\Python38\\site-packages\\pytest']

build.zip
build_2020-08-30_16-51-29.zip

@flynneva
Copy link

flynneva commented May 7, 2021

bump - ive found the same problem with cv_bridge....any ideas how to solve this?

@nuclearsandwich nuclearsandwich self-assigned this May 7, 2021
@christophebedard
Copy link
Member

@flynneva do you happen to have CI logs or build output? I'm wondering what CMake is using for PYTHON_EXECUTABLE in your case.

@flynneva
Copy link

flynneva commented May 9, 2021

@christophebedard gimme a day so I can get back on my windows machine, but yes I should have the build logs for this.

EDIT: I just remembered I posted build logs (at least some of them) for another issue last week. It should show you what you were looking for:

ros-perception/vision_opencv#387

@christophebedard
Copy link
Member

ros-perception/vision_opencv#387

So here it is:

Using PYTHON_EXECUTABLE: C:/opt/ros/foxy/x64/python.exe

That looks weird, because I think the installation instructions have you install Python somewhere under C:/Python38/. How did you install Foxy and Python?

Also, can you try running these commands (and provide the output):

C:\opt\ros\foxy\x64\python.exe -m pytest --version --version
python -m pytest --version --version

Without the second --version too if you can; might as well.

Maybe I'm wrong, but I suspect that pytest isn't actually installed alongside that specific Python installation/path.

@flynneva
Copy link

flynneva commented May 10, 2021

So in this situation I sourced the foxy install from binaries following the windows IoT instructions.

https://ms-iot.github.io/ROSOnWindows/GettingStarted/SetupRos2.html

If you're saying that's weird I can go ahead and try to rebuild by using the normal install for windows foxy.

Tomorrow morning I'll run that version command and report back.

@clalancette
Copy link
Contributor

If you're saying that's weird I can go ahead and try to rebuild by using the normal install for windows foxy.

It's weird in the sense that those are not officially supported packages. They may work perfectly fine, but they are not the official tested and released binaries.

@flynneva
Copy link

It's weird in the sense that those are not officially supported packages. They may work perfectly fine, but they are not the official tested and released binaries.

Is there a plan to support that style of installation though? Right now for Windows I believe you still have to manually download the binaries from a Github Release - I chose to go with the Microsoft IoT instructions because it was a command-line "easy" download. Ideally it should be a choco install command for windows, right?

@clalancette
Copy link
Contributor

Is there a plan to support that style of installation though? Right now for Windows I believe you still have to manually download the binaries from a Github Release - I chose to go with the Microsoft IoT instructions because it was a command-line "easy" download. Ideally it should be a choco install command for windows, right?

Ideally, yes. We'd love to get there, and maybe one way to get there is to just point at those packages. But that's not the path that gets tested regularly today, so it's leaving the "official" ecosystem.

And that's fine! We want to encourage people to make this stuff available, but it may not all work out-of-the-box since it isn't something we test. And of course we'd be happy to take any fixes that come out of investigating it.

@flynneva
Copy link

flynneva commented May 10, 2021

fyi....can confirm using the standard Windows ROS2 Foxy Patch 4 release the pytest warning goes away.

Might be something @seanyen could help fix for future ms-iot ros2 releases?

-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.18363.
-- The C compiler identification is MSVC 19.28.29913.0
-- The CXX compiler identification is MSVC 19.28.29913.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ament_cmake_ros: 0.9.0 (C:/dev/ros2-foxy-patch-4/share/ament_cmake_ros/cmake)
-- Found PythonInterp: C:/Python38/python.exe (found suitable version "3.8.3", minimum required is "3") 
-- Using PYTHON_EXECUTABLE: C:/Python38/python.exe
-- Found PythonLibs: C:/Python38/libs/python38.lib (found version "3.8.3") 

@christophebedard
Copy link
Member

the warning message has now been changed (#337) to mention other platforms.

@rotu are you still having this issue?

Your builds logs show

Using PYTHON_EXECUTABLE: C:/Python38/python.exe

for rosidl_adapter, but from your description it seems that pytest in installed under C:\Users\dan\AppData\Roaming\Python\Python38\, so maybe there is no pytest for C:/Python38/python.exe? This would be similar to @flynneva's situation.

@rotu
Copy link
Contributor Author

rotu commented May 11, 2021

I've not been deep in ROS 2 in a while, so don't keep this open just for me

@clalancette
Copy link
Contributor

I'm going to close this one out, since we changed the error message and we don't have a good reproducer. Feel free to reopen if you'd like to pursue it further.

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

5 participants