{"action":"created","issue":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/22498","repository_url":"https://api.github.com/repos/tensorflow/tensorflow","labels_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/22498/labels{/name}","comments_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/22498/comments","events_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/22498/events","html_url":"https://github.com/tensorflow/tensorflow/issues/22498","id":363487896,"node_id":"MDU6SXNzdWUzNjM0ODc4OTY=","number":22498,"title":"Writing a SavedModel on Windows with long file path fails","user":{"login":"HedgehogCode","id":6631116,"node_id":"MDQ6VXNlcjY2MzExMTY=","avatar_url":"https://avatars1.githubusercontent.com/u/6631116?v=4","gravatar_id":"","url":"https://api.github.com/users/HedgehogCode","html_url":"https://github.com/HedgehogCode","followers_url":"https://api.github.com/users/HedgehogCode/followers","following_url":"https://api.github.com/users/HedgehogCode/following{/other_user}","gists_url":"https://api.github.com/users/HedgehogCode/gists{/gist_id}","starred_url":"https://api.github.com/users/HedgehogCode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HedgehogCode/subscriptions","organizations_url":"https://api.github.com/users/HedgehogCode/orgs","repos_url":"https://api.github.com/users/HedgehogCode/repos","events_url":"https://api.github.com/users/HedgehogCode/events{/privacy}","received_events_url":"https://api.github.com/users/HedgehogCode/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"wt-huang","id":42785337,"node_id":"MDQ6VXNlcjQyNzg1MzM3","avatar_url":"https://avatars0.githubusercontent.com/u/42785337?v=4","gravatar_id":"","url":"https://api.github.com/users/wt-huang","html_url":"https://github.com/wt-huang","followers_url":"https://api.github.com/users/wt-huang/followers","following_url":"https://api.github.com/users/wt-huang/following{/other_user}","gists_url":"https://api.github.com/users/wt-huang/gists{/gist_id}","starred_url":"https://api.github.com/users/wt-huang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wt-huang/subscriptions","organizations_url":"https://api.github.com/users/wt-huang/orgs","repos_url":"https://api.github.com/users/wt-huang/repos","events_url":"https://api.github.com/users/wt-huang/events{/privacy}","received_events_url":"https://api.github.com/users/wt-huang/received_events","type":"User","site_admin":false},"assignees":[{"login":"wt-huang","id":42785337,"node_id":"MDQ6VXNlcjQyNzg1MzM3","avatar_url":"https://avatars0.githubusercontent.com/u/42785337?v=4","gravatar_id":"","url":"https://api.github.com/users/wt-huang","html_url":"https://github.com/wt-huang","followers_url":"https://api.github.com/users/wt-huang/followers","following_url":"https://api.github.com/users/wt-huang/following{/other_user}","gists_url":"https://api.github.com/users/wt-huang/gists{/gist_id}","starred_url":"https://api.github.com/users/wt-huang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wt-huang/subscriptions","organizations_url":"https://api.github.com/users/wt-huang/orgs","repos_url":"https://api.github.com/users/wt-huang/repos","events_url":"https://api.github.com/users/wt-huang/events{/privacy}","received_events_url":"https://api.github.com/users/wt-huang/received_events","type":"User","site_admin":false}],"milestone":null,"comments":8,"created_at":"2018-09-25T09:30:26Z","updated_at":"2018-10-07T10:07:12Z","closed_at":null,"author_association":"NONE","body":"### System information\r\n- **Have I written custom code**: Yes, see below.\r\n- **OS Platform and Distribution**: Windows 10 Enterprise 64Bit (10.0.16299)\r\n- **Mobile device**: N/A\r\n- **TensorFlow installed from**: Binary\r\n- **TensorFlow version**: b'v1.10.0-rc1-19-g656e7a2b34' 1.10.0\r\n- **Python version**: 3.5.5\r\n- **Bazel version**: N/A\r\n- **GCC/Compiler version**: N/A\r\n- **CUDA/cuDNN version**: N/A\r\n- **GPU model and memory**: N/A\r\n- **Exact command to reproduce**: Run the provided script on Windows\r\n\r\n\r\n### Describe the problem\r\nWhen exporting a SavedModel to a directory with a rather long path the maximum file path length of Windows (260 chars) gets exceeded while creating temporary variable files and the process fails because it can't find the file (See attachments for the full log):\r\n```\r\nNotFoundError (see above for traceback): Failed to create a NewWriteableFile: C:\\reallylongpath\\barfoobarfoobarfoobarfoobarfoobarfoo\\barfoobarfoobarfoobarfoobarfoobarfoo\\barfoobarfoobarfoobarfoobarfoobarfoo\\barfoobarfoo\\variables\\variables_temp_cbd5fe79f07a4790a08e7c2adf1ed95b/part-00000-of-00001.data-00000-of-00001.tempstate12448200021531902965 : The system cannot find the path specified.\r\n```\r\nThe usual workaround to prepend `'\\\\\\\\?\\\\'` to the path (like described [here](https://stackoverflow.com/a/3557977)) doesn't work (See attachments).\r\n\r\n### Source code / logs\r\n\r\n__Code to reproduce:__\r\n```python\r\nimport tensorflow as tf\r\n\r\n# Long export path (should be at least 140 chars long)\r\nexport_dir = r'C:\\reallylongpath\\barfoobarfoobarfoobarfoobarfoobarfoo\\barfoobarfoobarfoobarfoobarfoobarfoo\\barfoobarfoobarfoobarfoobarfoobarfoo\\barfoobarfoo'\r\nprint('Export dir lenght: {}'.format(len(export_dir)))\r\n\r\n# Build an easy graph with variables\r\nx = tf.constant(2)\r\nw = tf.Variable(3)\r\ny = tf.multiply(x, w)\r\n\r\nwith tf.Session() as sess:\r\n    # Initialize the variable\r\n    sess.run(w.initializer)\r\n\r\n    # Save as a SavedModel\r\n    tf.saved_model.simple_save(sess,\r\n                               export_dir,\r\n                               inputs={'x': x },\r\n                               outputs={'y': y })\r\n```\r\n\r\n__Logs:__\r\nFull log:\r\n[log.txt](https://github.com/tensorflow/tensorflow/files/2414582/log.txt)\r\n\r\nFull log with `'\\\\\\\\?\\\\'` prefix:\r\n[log_prefix_0.txt](https://github.com/tensorflow/tensorflow/files/2414583/log_prefix_0.txt)\r\n\r\nFull log with `'\\\\?\\'` prefix:\r\n[log_prefix_1.txt](https://github.com/tensorflow/tensorflow/files/2414584/log_prefix_1.txt)\r\n"},"comment":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/comments/427641052","html_url":"https://github.com/tensorflow/tensorflow/issues/22498#issuecomment-427641052","issue_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/22498","id":427641052,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNzY0MTA1Mg==","user":{"login":"HedgehogCode","id":6631116,"node_id":"MDQ6VXNlcjY2MzExMTY=","avatar_url":"https://avatars1.githubusercontent.com/u/6631116?v=4","gravatar_id":"","url":"https://api.github.com/users/HedgehogCode","html_url":"https://github.com/HedgehogCode","followers_url":"https://api.github.com/users/HedgehogCode/followers","following_url":"https://api.github.com/users/HedgehogCode/following{/other_user}","gists_url":"https://api.github.com/users/HedgehogCode/gists{/gist_id}","starred_url":"https://api.github.com/users/HedgehogCode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HedgehogCode/subscriptions","organizations_url":"https://api.github.com/users/HedgehogCode/orgs","repos_url":"https://api.github.com/users/HedgehogCode/repos","events_url":"https://api.github.com/users/HedgehogCode/events{/privacy}","received_events_url":"https://api.github.com/users/HedgehogCode/received_events","type":"User","site_admin":false},"created_at":"2018-10-07T10:07:12Z","updated_at":"2018-10-07T10:07:12Z","author_association":"NONE","body":"Hi @wt-huang,\r\n\r\n> You can first try to save the model to a local directory with long file path.\r\n\r\nWith 'local NTFS partition mounted at `C:`' I mean a local directory. `C:` is in my case (as usual) the local partition where Windows is installed.\r\n\r\nI tried it on a freshly installed virtual machine and it still fails with the same error message. New system information:\r\n- **OS Platform and Distribution**: Windows 10 Pro 64Bit (Version: 1803, Build: 17134.286)\r\n- **TensorFlow installed from**: binary\r\n- **TensorFlow version**: b'1.11.0-rc2-4-gc19e29306c' 1.11.0\r\n- **Python version**: 3.5.6\r\n\r\n(I enabled the `Enable Long File Path` config and restarted the virtual machine)"}}
{"actor":{"display_login":"HedgehogCode"}}