Repository navigation
Description
Please go to Stack Overflow for help and support:
If you open a GitHub issue, here is our policy:
- It must be a bug or a feature request.
- The form below must be filled out.
- It shouldn't be a TensorBoard issue. Those go here.
Here's why we have that policy: TensorFlow developers respond to issues. We want to focus on work that benefits the whole community, e.g., fixing bugs and adding features. Support only helps individuals. GitHub also notifies thousands of people when issues are filed. We want them to see you communicating an interesting problem, rather than being redirected to Stack Overflow.
System information
- Have I written custom code (as opposed to using a stock example script provided in TensorFlow):
No - OS Platform and Distribution (e.g., Linux Ubuntu 16.04):
Amazon Linux 2016.09 - TensorFlow installed from (source or binary):
binary, no gpu, virtualenv method - TensorFlow version (use command below):
1.2.1 - Python version:
2.7.12 - Bazel version (if compiling from source):
N/A - CUDA/cuDNN version:
N/A - GPU model and memory:
N/A - Exact command to reproduce:
python -c "from tensorflow.contrib.layers import fully_connected"
You can collect some of this information using our environment capture script:
You can obtain the TensorFlow version with
python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"
Describe the problem
When building a python install for a disk space constrained environment, it's fairly common to first compile all .py files to .pyc files, and then only install the .pyc files, to save a few megabytes of space. When attempting this for tensorflow, it became unable to import it's contrib modules (traceback below). From some testing I did, this appears to be due to differing behavior in this snippet from the get_path_to_datafile function in python/platform/resource_loader.py: data_files_path = _os.path.dirname(_inspect.getfile(_sys._getframe(1)))
when the .py files are present, this snippet produces an absolute path. When only the .pyc files are present, it produces a relative path, which is then concatenated with another path, as the get_path_to_datafile function is called twice.
Source code / logs
File "./tensorflow/contrib/__init__.py", line 27, in <module>
File "./tensorflow/contrib/cudnn_rnn/__init__.py", line 28, in <module>
File "./tensorflow/contrib/cudnn_rnn/python/ops/cudnn_rnn_ops.py", line 34, in <module>
File "./tensorflow/contrib/util/loader.py", line 55, in load_op_library
File "./tensorflow/python/framework/load_library.py", line 64, in load_op_library
NotFoundError: ./tensorflow/contrib/util/./tensorflow/contrib/cudnn_rnn/python/ops/_cudnn_rnn_ops.so: cannot open shared object file: No such file or directory
Activity
bignamehyp commentedon Nov 7, 2017
Does this problem still exist at TF 1.4?
gotyaoi commentedon Nov 7, 2017
The issue still exists in tensorflow 1.4.0. The stack trace looks to have changed slightly, but the error is very similar.
aselle commentedon Nov 29, 2017
This appears to be because pyc files store the paths relative to where they were generated from. So if you run the python command that generates the pyc from the root directory in an environment with the same root, it will give you full paths and work properly. That being said, it would be great if we could make this work no matter what the relative paths were.
aselle commentedon Nov 29, 2017
@annarev, could you look into making getfile() more robust to only pyc environments? I think we have the same issue if you try to put a PYTHONPATH with a relative path specified i.e. ../foo/bar/tensorflow
tensorflowbutler commentedon Dec 20, 2017
It has been 14 days with no activity and this issue has an assignee.Please update the label and/or status accordingly.
tensorflowbutler commentedon Jan 3, 2018
It has been 14 days with no activity and this issue has an assignee.Please update the label and/or status accordingly.
tensorflowbutler commentedon Jan 18, 2018
Nagging Assignee: It has been 14 days with no activity and this issue has an assignee. Please update the label and/or status accordingly.
Fixes tensorflow#12466. Fix getfile in cases when .py files aren't av…