- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a running container with python and pycaffe in it. If I use docker exec to enter via a bash, I can the run a python script that imports the caffe module. But it fails when using this command:
docker exec -ti dts bash -c "python /root/init_random_weights.py"
mroos@synapse:scratch$ docker exec -ti dts bash -c "python /root/init_random_weights.py"
Hello
Traceback (most recent call last):
File "/root/init_random_weights.py", line 4, in <module>
import caffe
ImportError: No module named caffe
Why isn't python finding caffe when called in this manner? My .bashrc on the running container adds caffe to PYTHONPATH:
export PYTHONPATH=/usr/local/caffe/python:
What am I misunderstanding here?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks to some info here: https://docs.docker.com/engine/reference/commandline/exec/, I implemented a workaround by defining the PYTHONPATH env variable in the docker exec call as such:
docker exec -ti -w /root -e PYTHONPATH=/usr/local/caffe/python: dts bash -c "python /root/init_random_weights.py"
But I still don't understand why, in the absence of the -e option, the PYTHONPATH of my host machine is used rather than the PYTHONPATH of the .bashrc file in the container.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@mattroos How did you build your docker container/image? There are some instructions for NCSDK 2 at https://movidius.github.io/ncsdk/docker.html.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page