Skip to content
This repository has been archived by the owner on Sep 29, 2022. It is now read-only.

[WIP] VTK 7 recipe supporting both Python 2 & 3 #581

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

grlee77
Copy link

@grlee77 grlee77 commented Feb 5, 2016

Hi,

I spent some time the other day getting VTK 7 to build with Python 3 wrappers and wanted to share my efforts. I have marked this as work-in-progress because I am only sure that this recipe succeeds on 64-bit linux.

On OSX Yosemite, the build completed successfully (at least once I installed XCode), but for some reason the import failed during running the tests and the package was not installed. However, if I manually copy the VTK folder from the _build environment's site-packages folder into my primary environment's site-packages folder, it does seem to work properly.

The windows case has not been tested at all, but I attempted to add the appropriate flag for Python 2 vs. 3

@grlee77 grlee77 changed the title WIP: VTK 7 recipe supporting both Python 2 & 3 [WIP] VTK 7 recipe supporting both Python 2 & 3 Feb 5, 2016
PY_LIB="libpython${PY_VER}.so"
# Note: VTK 7 requires gcc >= 4.2
CC=gcc
CXX=g++
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please leave here gcc44 and g++44. Those are the versions we're using right now in centos5.

@ccordoba12
Copy link
Contributor

Thanks a lot for working on this. Other than my minor comments, this seems good to go :-)

@satra
Copy link

satra commented Mar 2, 2016

+1 for merge works beautifully on os x.

@ccordoba12
Copy link
Contributor

Will do :-)

@satra
Copy link

satra commented Mar 3, 2016

@ccordoba12 - hold that thought.

getting some rpath errors on pushing this to anaconda.org and installing with conda. looking into it.

@satra
Copy link

satra commented Mar 9, 2016

this is the error that's happening: nipy/mindboggle#69

@grlee77
Copy link
Author

grlee77 commented Mar 16, 2016

Hi Satra,
I verified that I can build mindboggle using this recipe on linux (Ubuntu 14.04) as long as I configure VTK_DIR to point to ~/anaconda/lib/cmake/vtk-7.0 instead of the one it found by default on the system path (or to the equivalent subfolder of whichever anaconda/env environment you are running)

Are you sure the VTK_DIR is getting set to this location during your os x build?

I am now trying this on a laptop with OS X at the moment, but the build is taking a while. For some reason, on my laptop, I have to comment out the cmake build requirement from meta.yml. Otherwise I get the following error. Did you encounter this?

+ cmake .. -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_COMPILER=c++ -DVTK_REQUIRED_OBJCXX_FLAGS= -DVTK_USE_TK=OFF -DVTK_USE_COCOA=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/Users/lee8rx/anaconda/envs/_build -DCMAKE_INSTALL_RPATH:STRING=/Users/lee8rx/anaconda/envs/_build/lib -DBUILD_DOCUMENTATION=OFF -DVTK_HAS_FEENABLEEXCEPT=OFF -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF -DBUILD_SHARED_LIBS=ON -DVTK_WRAP_PYTHON=ON -DPYTHON_EXECUTABLE=/Users/lee8rx/anaconda/envs/_build/bin/python -DPYTHON_INCLUDE_PATH=/Users/lee8rx/anaconda/envs/_build/include/python3.4m -DPYTHON_LIBRARY=/Users/lee8rx/anaconda/envs/_build/lib/libpython3.4m.dylib -DVTK_INSTALL_PYTHON_MODULE_DIR=/Users/lee8rx/anaconda/envs/_build/lib/python3.4/site-packages -DModule_vtkRenderingMatplotlib=ON -DVTK_USE_X=OFF -DVTK_PYTHON_VERSION=3
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/Users/lee8rx/anaconda/envs/_build/share/cmake-3.3
CMake Error: Error executing cmake::LoadCache(). Aborting.

I have cmake v3.4.3 already on my system, so removing the cmake requirement from meta.yml caused the system cmake to be used instead which works fine.

@satra
Copy link

satra commented Mar 16, 2016

@binarybottle - can you answer @grlee77 question?

@satra
Copy link

satra commented Mar 16, 2016

@grlee77 - did you try installing vtk7 from my conda repo, instead of building vtk locally with conda?

https://anaconda.org/satra/vtk

so the recipe builds fine on my local machine, but when i push to anaconda.org and someone downloads it they get the rpath error.

@grlee77
Copy link
Author

grlee77 commented Mar 16, 2016

@satra, @binarybottle
The OS X build of vtk_cpp_tools worked for me on OS X as well based on this recipe (I am on OS X Yosemite).

I uploaded a Python 3.4 build of VTK 7 for OS X here:
https://anaconda.org/grlee77/vtk/files
I will go ahead and upload Python 3.5 and 2.7 versions for OS X there as well once those builds complete. You can try installing from my channel via:
conda install --channel https://conda.anaconda.org/grlee77 vtk

Let's continue any further discussion of this back at nipy/mindboggle#69 as it seems the recipe itself is likely not the cause of the problem.

@satra
Copy link

satra commented Mar 18, 2016

@ccordoba12 - could someone from the continuum team help with this. i believe this is specific to conda-build and OSX.

@ccordoba12
Copy link
Contributor

@satra, I'm in charge of compiling VTK in all platforms, so I'm your guy :-) Problem is I'm terribly busy until April 8th.

By reading the mindboggle issue very quickly, I think your problem is that CMake doesn't find the 10.6 SDK, which is necessary because conda-build sets MACOSX_DEPLOYMENT_TARGET precisely to 10.6.

If you're using command line tools, that SDK has to be placed in a particular location (I don't exactly remember which one right now), and if you're using XCode, it needs to be placed on another.

I hope this helps you to better understand your problem until I have some free time :-)

@hjmjohnson
Copy link

@ccordoba12 I am trying to build SimpleITK and VTK against anaconda, with similar issues with 10.6 SDK not being available.

I am running OS X 10.10.5, and Xcode 7.2.1.

CMake Warning at /scratch/johnsonhj/anaconda2/envs/_build/share/cmake-3.3/Modules/Platform/Darwin-Initialize.cmake:97 (message):
CMAKE_OSX_DEPLOYMENT_TARGET is '10.6' but the matching SDK does not exist
at:

"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk"

Instead using SDK:

"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk".
Call Stack (most recent call first):
/scratch/johnsonhj/anaconda2/envs/_build/share/cmake-3.3/Modules/CMakeSystemSpecificInitialize.cmake:18 (include)
CMakeLists.txt:16 (project)

Are there instructions for setting up a compilation environment that is appropriate for the anaconda package building?

Thanks,
Hans

@mick-d
Copy link

mick-d commented Oct 21, 2016

Just for reference, after following the thread of PRs, the current easiest installation seems to be with conda-forge:

conda config --add channels conda-forge 
conda install vtk

@astrofrog
Copy link
Contributor

@ccordoba12 - I know that VTK 7.0 on all platforms is currently not possible in conda-forge due to build time limitations on the CI services, but is there any chance that you could build and put VTK 7.0 in the defaults channel? :)

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

Successfully merging this pull request may close these issues.

6 participants