Caffe: virtualenv request

Created on 12 May 2015  路  7Comments  路  Source: BVLC/caffe

Could caffe be structured in a way such that the python dependencies reside in a virtualenv?

JL

Most helpful comment

cd python
virtualenv venv
source venv/bin/activate
for req in $(cat requirements.txt); do pip install $req; done

I don't see anything that needs to change in Caffe.

All 7 comments

Is this happening soon?

cd python
virtualenv venv
source venv/bin/activate
for req in $(cat requirements.txt); do pip install $req; done

I don't see anything that needs to change in Caffe.

what's with the for loop? @lukeyeager why not pip install -r requirements.txt

Did you actually try what you recommended? From what I remembered Caffe does not play nicely with virtualenv. Installing this suite was a painful experience.

what's with the for loop?

https://github.com/BVLC/caffe/pull/1950#issuecomment-76026969

Did you actually try what you recommended?

Yep, I do this all the time, and suggest this method for DIGITS users:
https://github.com/NVIDIA/DIGITS/blob/v2.2.1/docs/InstallCaffe.md#python-dependencies

+1 @lukeyeager

@lukeyeager Thanks for the links! But I have another question.
Say I create a virtualenv in some other folder (not caffe/python). If I have to use OpenCV in that virtualenv, I know that I just have to copy cv2.so and cv.py from OpenCV source to the env_name/lib/pythonX.X/site-packages folder. Can something similar be done for Caffe? If so, which all files needs to be copied?

pycaffe itself won't be installed in your virtualenv - you'll still have to set your PYTHONPATH to get that to work right.

If you wanted to install pycaffe to your virtualenv (or system-wide, for that matter), we would need to add a setup.py script like I suggested at https://github.com/BVLC/caffe/issues/2440#issuecomment-106100614.

I'm not sure how linking to the right .so file would work - you bring up a good point. Ideally, the Caffe libs would be installed to /usr/lib with a debian/RPM installer.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

malreddysid picture malreddysid  路  3Comments

shiorioxy picture shiorioxy  路  3Comments

OpenHero picture OpenHero  路  3Comments

lixin7895123 picture lixin7895123  路  3Comments

erogol picture erogol  路  3Comments