caffe2 icon indicating copy to clipboard operation
caffe2 copied to clipboard

caffe2 already support python3 now?

Open holymeng opened this issue 7 years ago • 5 comments

caffe2 already support python3 now? @Yangqing

holymeng avatar Jan 09 '18 07:01 holymeng

It does work with python 3. The only modification you need to make to the build instructions is to pass in some arguments to cmake telling it to use python 3. The three build arguments you need to pass are -DPYTHON_INCLUDE_DIR -DPYTHON_EXECUTABLE -DPYTHON_LIBRARY

If you're linux then which python3 should give you the path to the python executable while the library and include dir likely live in /usr/lib and /usr/share.

hmc-cs-mdrissi avatar Jan 09 '18 17:01 hmc-cs-mdrissi

Just add to the answer from @hmc-cs-mdrissi, we don't need "-DPYTHON_LIBRARY" flag anymore since we have changed our cmake build system to not link against libpython (the python module will be imported into python anyway, so we let the python symbols resolution happens at runtime). For getting the python include path, do python -c 'from distutils import sysconfig; print(sysconfig.get_python_inc())'

Another way to do this is pip install $caffe2_checkout_path, which will use the setup.py and it automatically figures out these python details for you.

bddppq avatar Jan 09 '18 19:01 bddppq

You should really update documentation and insert python3 support and pip build technique, it would help many

danigamba avatar Jan 13 '18 17:01 danigamba

Latest Caffe2 does support python3. We still need to update the documentation and tutorials to support this, though. Thanks for all the feedback and we're working on those doc updates.

orionr avatar Jan 19 '18 02:01 orionr

@orionr Is the documentation updated? Or shall I proceed further with Python2 installation. Another problem with Python2 installation is the Numpy multiarray Import error which has still not been resolved.

virajmavani avatar Apr 10 '18 06:04 virajmavani