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

PYBIND11 cmake error #420

Closed
yoshiyama opened this issue Jun 28, 2018 · 16 comments
Closed

PYBIND11 cmake error #420

yoshiyama opened this issue Jun 28, 2018 · 16 comments
Labels

Comments

@yoshiyama
Copy link

yoshiyama commented Jun 28, 2018

In cmake-gui for latest src, installation of pybind11 have an error of PYBIND directory not found.
My environment is windows 10 64bit.
But for src downloaded on 5th June, it succeed completely.
What are the differences between latest and old src ?

@takanokage
Copy link
Contributor

There is no difference as far as pybind11 is concerned - pybind11 is always built from source.
Without additional information my suggestion is to clean the project files (delete the build folder, delete the CMake cache) and start over.

@dotchang
Copy link
Contributor

I also met same problem. Maybe, it has some problems.

And, I don't need any python interfacce for Open3D, I need only c++ libraries.
But I can't cancel python-related options. I think that it is big problem.

@dotchang
Copy link
Contributor

The error is caused by 3rd line of Open3D/src/External/CMakeList.txt.
find_package(PkgConfig QUIET)
find_package(OpenGL QUIET)
#find_package(pybind11 QUIET)

@yoshiyama
Copy link
Author

Even after deleting the CMake cache, the error also happens.

@takanokage
Copy link
Contributor

I've just tested on my Windows 10 64bit machine, Python 2.7 32bit, CMake 3.11.0.
No trouble whatsoever. I can even disable building pybind11 and the python module.
What version of CMake are you using? Do you have any other information that might help us root cause the issue?

Thanks!

Building pybind11 from source:

Selecting Windows SDK version 10.0.16299.0 to target Windows 10.0.14393.
Disable unit tests since this feature is not fully supported on Windows.
Compiling on Windows
Compiling with MSVC
Using installed OpenMP 
Building EIGEN3 from source
Building GLEW from source
Building GLFW from source
Looking for pthread.h
Looking for pthread.h - not found
Found Threads: TRUE  
Could NOT find Vulkan (missing: VULKAN_LIBRARY VULKAN_INCLUDE_DIR) 
Using Win32 for window creation
Building LIBJPEG from source
Building JSONCPP from source
Building LIBPNG from source
Looking for sys/types.h
Looking for sys/types.h - found
Looking for stdint.h
Looking for stdint.h - found
Looking for stddef.h
Looking for stddef.h - found
Check size of off64_t
Check size of off64_t - failed
Building PYBIND11 from source
pybind11 v2.2.1
Building TINYFILEDIALOGS from source
Build experimental projects
Configuring done

Disabled building pybind11 and the python module:

Selecting Windows SDK version 10.0.16299.0 to target Windows 10.0.14393.
Disable unit tests since this feature is not fully supported on Windows.
Compiling on Windows
Compiling with MSVC
Using installed OpenMP 
Building EIGEN3 from source
Building GLEW from source
Building GLFW from source
Could NOT find Vulkan (missing: VULKAN_LIBRARY VULKAN_INCLUDE_DIR) 
Using Win32 for window creation
Building LIBJPEG from source
Building JSONCPP from source
Building LIBPNG from source
Building TINYFILEDIALOGS from source
Build experimental projects
Configuring done

@yoshiyama
Copy link
Author

My PC is Windows 10 64bit with Python 3.5.2 32bit and CMake 3.11.4.

@qianyizh
Copy link
Collaborator

@yoshiyama can you try the solution in #66 ?
In short, you need to specify these:

cmake -DPYTHON_LIBRARY=/Users/qianyizh/anaconda/envs/py36/lib/libpython3.6m.dylib
-DPYTHON_INCLUDE_DIR=/Users/qianyizh/anaconda/envs/py36/include/python3.6m
-DPYTHON_EXECUTABLE:FILEPATH=/Users/qianyizh/anaconda/envs/py36/bin/python3.6m
../src

(Sorry I don't have a Windows machine at hand so I can't test it right now.) You can start with adding -DPYTHON_EXECUTABLE:FILEPATH, then -DPYTHON_LIBRARY, then -DPYTHON_INCLUDE_DIR.

It is a known issue CMake gets confused when looking for Python executable and library and directory. On pybind11 repo they also note this pybind/pybind11#99

@qianyizh
Copy link
Collaborator

@dotchang Sorry for the late reply. I am trying to fix the build system. Yeah, it has not been managed well and has some issues.

If you want to turn off Python binding, can you try to use the following switch:

cmake -DBUILD_PYBIND11=OFF -DBUILD_PYTHON_MODULE=OFF -DBUILD_PYTHON_TUTORIALS=OFF ../src

Will the error still exist? I can't duplicate the error so need your help, :)

@yoshiyama
Copy link
Author

Thank you qianyizh.
The error is solved by specifying location of directory of python (In my case, Anaconda python).

@syncle syncle closed this as completed Aug 28, 2018
@LLDavid
Copy link

LLDavid commented Oct 17, 2018

Thank you qianyizh.
The error is solved by specifying location of directory of python (In my case, Anaconda python).

@yoshiyama Hi, I met the same the problem on my win 10. But I am kind of new to CMake, can you share how you exactly specify the location of directory of python? Thanks

@yxlao
Copy link
Collaborator

yxlao commented Oct 17, 2018

@LLDavid , please see @qianyizh 's comment above .

If you remove the build directory and start from scratch, for me it's sufficient to specify the PYTHON_EXECUTABLE. First, we'll need to find where the python is.

E.g. if you're using a conda environment:

ylao@DESKTOP-CFLLFA0 C:\Users\ylao
$ activate py36

(py36) ylao@DESKTOP-CFLLFA0 C:\Users\ylao
$ where python
C:\Users\ylao\Miniconda3\envs\py36\python.exe

(py36) ylao@DESKTOP-CFLLFA0 C:\Users\ylao
$ cmake -DPYTHON_EXECUTABLE=C:\Users\ylao\Miniconda3\envs\py36\python.exe -DYOUR_OTHER_CMAKE_FLAGS ..

@LLDavid
Copy link

LLDavid commented Oct 17, 2018

DPYTHON_EXECUTABLE=C:\Users\ylao\Miniconda3\envs\py36\

@yxlao Thanks! Now I can get the open3d.sln, and I rebuild the 'ALL_BUILD' as the tutorial says (on VS 2015 2017). Then I try to build the 'INSTALL' and I got following one error:

Severity Code Description Project File Line Suppression State
Error MSB3073 The command "setlocal
C:\Users\Owner\Li\bin\cmake.exe -DBUILD_TYPE=Release -P cmake_install.cmake
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
:VCEnd" exited with code 1. INSTALL C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets 138

Any idea what I am missing?

@yxlao
Copy link
Collaborator

yxlao commented Oct 17, 2018

It's a little bit hard to tell from the limited information. From the error code, seems like it's similar to this one. One thing you could try is to specify a path that a non-admin user can access, as described in. Otherwise, by default, it will be installed to C:\Program Files which require admin access.

cmake -DCMAKE_INSTALL_PREFIX=\some\non\admin\path ..

Or, start the CMD console with Administrator rights.

@LLDavid
Copy link

LLDavid commented Oct 17, 2018

-DCMAKE_INSTALL_PREFIX

@yxlao You are right. I first tried to add DCMAKE_INSTALL_PREFIX=\some\non\admin\path , and got same error. Then I open both my cmake gui and VS with Admin rights, it succeed.
But then I still failed with 'import open3d'.
I check the cmake log and the python version, it should match.
image
image

@yxlao
Copy link
Collaborator

yxlao commented Oct 17, 2018

Currently, we're undergoing some dramatic changes for the python build system: see #604 and #618.

If you're on the lastest master (as of this commit point), make install will not install python. In fact, in current master, you don't even need to run make install to get the python package working.

Following #604, all you'll need to do is to build install-pip-wheel.

make install-pip-wheel
# at 0.4.0 release, we'll change it to
# make install-pip-package

# If you're on windows, build the install-pip-wheel target in Visual Studio. 
# Or, at windows terminal, run
# cmake --build . --config Release --target install-pip-wheel

If you run into permission issue again, instead, try

make pip-wheel
# at 0.4.0 release, we'll change it to
# make pip-package

And then find your wheel *.whl file in build\lib\python_package\dist, and use

pip install -U \path\to\wheel.whl

Lastly, we'd recommend using a python virtual environment (can be pip virtualenv or conda virtualenv). This will solve a lot of the permission issues.

If everything is done properly, 1) we wouldn't need to use the Administrator terminal, 2) we don't need to run make install at all.

@LLDavid
Copy link

LLDavid commented Oct 18, 2018

@yxlao Now I can get it work. Really appreciate your help!

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

No branches or pull requests

7 participants