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

Unable to run pyexamples on Windows #426

Closed
Gatunox opened this issue Oct 20, 2018 · 8 comments
Closed

Unable to run pyexamples on Windows #426

Gatunox opened this issue Oct 20, 2018 · 8 comments

Comments

@Gatunox
Copy link

Gatunox commented Oct 20, 2018

First let me clarify that I'm a complete newbie with python, so if something is obvious I appologize in advance.
I've followed the steps on the page:

git` clone https://github.com/stevenlovegrove/Pangolin.git
cd Pangolin
mkdir build
cd build
cmake ..
cmake --build .

Alter this, results shows:

41 Warning(s)
0 Error(s)

Time Elapsed 00:11:38.89.

When I try to execute the SimpleDisplay.py from my console using python i get.
C:\dev\Pangolin\pyexamples>python SimpleDisplay.py
Traceback (most recent call last):
File "SimpleDisplay.py", line 4, in
import pypangolin as pango
ImportError: No module named pypangolin

C:\dev\Pangolin\pyexamples>

Analizing the code on the script, i see this.

import sys
sys.path.append('../build/src')

So what's exactly is it trying to locate in this folder?, I do not find anything that is called pypangolin within the ../build/src folder.

Any ideas?
Regards

@stevenlovegrove
Copy link
Owner

It sounds as though Pangolin is not trying to build the python library. When you cmake pangolin, you should make sure that it finds python. It should say something like PyBind found and enabled. You can use cmake-gui .. instead of cmake .. to inspect variables and try to provide the correct path to your python install.

I admit, I have not tried this on windows, so you may encounter a small bug.

@Gatunox
Copy link
Author

Gatunox commented Oct 21, 2018

Hi Steve, Thanks for you reply.

I've checked CMAKE-GUI, during "Config" and "Generate". I do not see any variable related with python path nor any leyend saying "PyBind found and enabled",

If I search on the UI for "py" the only results are the checkboxes:
BUILD_PANGOLIN_PYTHON and BUILD_PYPANGOLIN_MODULE, Both selected.

The C compiler identification is MSVC 19.14.26433.0
The CXX compiler identification is MSVC 19.14.26433.0
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools    /MSVC/14.14.26428/bin/Hostx86/x86/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x86/cl.exe -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Detecting C compile features
Detecting C compile features - done
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise    /VC/Tools/MSVC/14.14.26428/bin/Hostx86/x86/cl.exe
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise    /VC/Tools/MSVC/14.14.26428/bin/Hostx86/x86/cl.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
MediaFoundation Found and Enabled
libpng Found and Enabled
libjpeg Found and Enabled
Performing Test COMPILER_HAS_DEPRECATED_ATTR
Performing Test COMPILER_HAS_DEPRECATED_ATTR - Failed
Performing Test COMPILER_HAS_DEPRECATED
Performing Test COMPILER_HAS_DEPRECATED - Success
Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
Configuring done
Generating done

I will try to analize this on cmake and see if i can find anything related with PyBind.
Any other idea, let me know and I will try.

Thanks

@Gatunox
Copy link
Author

Gatunox commented Oct 21, 2018

Hi Steve.

If WIN is set pypangolin will not be included.

option(BUILD_PANGOLIN_PYTHON "Build support for Pangolin Interactive Console" ON)
if(BUILD_PANGOLIN_PYTHON AND BUILD_PANGOLIN_GUI AND BUILD_PANGOLIN_VARS AND NOT WIN)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../external/pybind11/CMakeLists.txt")
add_subdirectory("../external/pybind11" "${CMAKE_CURRENT_BINARY_DIR}/external/pybind11")
set( pybind11_FOUND true)
else()
find_package(pybind11 QUIET)
endif()

@stevenlovegrove
Copy link
Owner

Hmm - I probably did that because it wasn't working or something. Hopefully it will be possible with a little bit of work.

@Gatunox
Copy link
Author

Gatunox commented Oct 21, 2018

Steven,

I've made some progress but it's not working still. I detele everyhting and start over.
I did:

git clone https://github.com/stevenlovegrove/Pangolin.git
cd Pangolin

then:

python -mpip install numpy pyopengl Pillow pybind11 **(These were OK)**
git submodule init && git submodule update **(I noticed that once I delete all i had to donload it again)**

then:

mkdir build
cd build
cmake ..

Here i verifyied that pybind11 was found on the CMAKE generation.

-- Found PythonInterp: C:/Python27/python.exe (found version "2.7.14")
-- Found PythonLibs: C:/Python27/libs/Python27.lib
-- pybind11 v2.2.1
-- Python Found and Enabled (with pybind11)

Finally i did:

cmake --build .

But I've got like 15 errors due to a LINK error, In particular, Fatal error LNK1104: cannot open file 'python27_d.lib. I supposed this was related to the fact that the project was trying to link with some debug version. So i've opened the solution in Visual Studio 2017 and change the project config from Debug to Release. Then I cleaned the solution and recompile evething.

Evething compiles ok. I got:

21>   Creating library C:/dev/Pangolin/build/src/Release/pypangolin.lib and object C:/dev/Pangolin/build/src/Release/pypangolin.exp
21>Generating code
21>Finished generating code
21>pypangolin.vcxproj -> C:\dev\Pangolin\build\src\Release\pypangolin.pyd
22>------ Build started: Project: ALL_BUILD, Configuration: Release Win32 ------
22>Building Custom Rule C:/dev/Pangolin/CMakeLists.txt
22>CMake does not need to re-run because C:/dev/Pangolin/build/CMakeFiles/generate.stamp is up-to-date.
========== Build: 22 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

Once again from the console, I've tried to run the example but I got the same result as the fiist time when i opened the issue, Now i do have one pypangolin.dir under C:\dev\Pangolin\build\src that was not created the first time.

Directorio de C:\dev\Pangolin\build\src

21/10/2018 01:00

.
21/10/2018 01:00 ..
21/10/2018 01:06 CMakeFiles
20/10/2018 23:58 8,749 cmake_install.cmake
21/10/2018 00:03 Debug
20/10/2018 23:58 external
20/10/2018 23:58 790,526 fonts.cpp
20/10/2018 23:58 include
20/10/2018 23:58 11,430 INSTALL.vcxproj
20/10/2018 23:58 512 INSTALL.vcxproj.filters
20/10/2018 23:58 11,814 PACKAGE.vcxproj
20/10/2018 23:58 512 PACKAGE.vcxproj.filters
21/10/2018 00:01 pangolin.dir
20/10/2018 23:58 46,495 pangolin.vcxproj
20/10/2018 23:58 29,211 pangolin.vcxproj.filters
20/10/2018 23:58 1,896 PangolinConfig.cmake
20/10/2018 23:58 642 PangolinConfigVersion.cmake
20/10/2018 23:58 3,541 PangolinTargets.cmake
21/10/2018 01:02 pypangolin.dir
20/10/2018 23:58 37,331 pypangolin.vcxproj
20/10/2018 23:58 5,229 pypangolin.vcxproj.filters
21/10/2018 01:06 Release
13 archivos 947,888 bytes
9 dirs 122,484,195,328 bytes libres

C:\dev\Pangolin\build\src>

C:\dev\Pangolin\pyexamples>dir
El volumen de la unidad C no tiene etiqueta.
El número de serie del volumen es: 16A4-1DB8

Directorio de C:\dev\Pangolin\pyexamples

20/10/2018 23:56

.
20/10/2018 23:56 ..
20/10/2018 23:56 1,528 SimpleDisplay.py
20/10/2018 23:56 1,166 SimplePlot.py
20/10/2018 23:56 3,160 SimpleVideo.py
3 archivos 5,854 bytes
2 dirs 122,486,951,936 bytes libres

C:\dev\Pangolin\pyexamples>python simpledisplay.py
Traceback (most recent call last):
File "simpledisplay.py", line 4, in
import pypangolin as pango
ImportError: No module named pypangolin

C:\dev\Pangolin\pyexamples>

Any Ideas?,
Thanks in advace.

@stevenlovegrove
Copy link
Owner

stevenlovegrove commented Oct 21, 2018

the location of pypangolin.lib looks to be different on your build, so you will probably have to modify the syspath thing at the top of simpledisplay.py. It needs to point to the folder containing that lib.

Have you tried that?

@Gatunox
Copy link
Author

Gatunox commented Oct 22, 2018

Hi Steven

I've change the code in the examples to point to the correct location as you said. Now this is what happening. I attempted to run each of the examples you provided: SimpleDisplay.py, SimplePlot.py, SimpleVideo.py

SimpleDisplay.py, Showed the following error.

C:\dev\Pangolin\pyexamples>python simpledisplay.py
Traceback (most recent call last):
  File "simpledisplay.py", line 56, in <module>
    main()
  File "simpledisplay.py", line 47, in main
    gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
  File "C:\Python27\lib\site-packages\OpenGL\error.py", line 232, in glCheckError
    baseOperation = baseOperation,
OpenGL.error.GLError: GLError(
        err = 1281,
        description = 'valor no v\xe1lido',
        baseOperation = glClear,
        cArguments = (16640,)
)

SimplePlot.py only showed a black screen.

SimpleVideo.py Showed the following error.

Traceback (most recent call last):
  File "SimpleVideo.py", line 105, in <module>
    main(FLAGS)
  File "SimpleVideo.py", line 27, in main
    vid = pango.VideoInput(vid_uri)
TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
    1. pypangolin.VideoInput()
    2. pypangolin.VideoInput(input_uri: unicode, output_uri: unicode=u'pango:   [buffer_size_mb=100]//video_log.pango')

 Invoked with: None

C:\dev\Pangolin\pyexamples>

So I decided to go back to SimplePlot.py since it was the only one that runned without issues but the program just showed one back screen, luckly when I maximized the windows I saw the plot generation on the window.

for the SimpleVideo.py watching on the program source, again first time with python, I can see indeed the program is expecting some parameters but I am not sure what the example is trying to acheive also I am not sure abuout the meanig of '--pango', '--pangoOut' params, What's a pango file? what about '--stream', Could you clarify this to me?

I decided to go back to the SimpleDisplay.py and tried to troubleshoot it a little. To make the LONG story short end up checking the result of glGetError()) after each OpengGL call with the following print.

print("glGetError() returns " + str(gl.glGetError())).

Once I did that at least I was able to see the screen with a portion of the cube, but once again screen was unreponsive until I maximize it or chage it's size in any way, Once I did that I was able to play with the cube and see the button UI, not sure if this is supposed to be a buttons or not. BTW the result from glGetError() is alwyas 1281 in the loop until I resize the window, then result is becomes 0, UI shows up and the cube start to respond to mouse events.

Any ideas about this? Also I would like to know more about SimpleVideo.py is possible.

Thanks in advace.
Regards
Gastón

@stevenlovegrove
Copy link
Owner

Sorry for the silence. The blank window until resize got fixed in the end. Thanks!

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

2 participants