shentianxiao / language-style-transfer

Apache License 2.0
553 stars 135 forks source link

ImportError Tensorflow #35

Closed Manuel030 closed 3 years ago

Manuel030 commented 3 years ago

When I'm running the command suggested in the readme I encounter the following Import Error. I am running it from a virtual environment with Python 2.7 and tensorflow 1.3.0 installed as recommended in the requriements.

C:\style-transfer\code>python style_transfer.py --train ../data/yelp/sentiment.train --dev ../data/yelp/sentiment.dev --output ../tmp/sentiment.dev --vocab ../tmp/yelp.vocab --model ../tmp/model C:\style-transfer\styletransfervenv\lib\site-packages\win_unicode_console__init.py:31: RuntimeWarning: sys.stdin.encoding == 'cp850', whereas sys.stdout.encoding == 'utf-8', readline hook consumer may assume they are the same readline_hook.enable(use_pyreadline=use_pyreadline) Traceback (most recent call last): File "style_transfer.py", line 8, in import tensorflow as tf File "C:\Ustyle-transfer\styletransfervenv\lib\site-packages\tensorflow\init.py", line 24, in from tensorflow.python import * File "C:\style-transfer\styletransfervenv\lib\site-packages\tensorflow\python\init__.py", line 49, in from tensorflow.python import pywrap_tensorflow File "C:\tyle-transfer\styletransfervenv\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 52, in raise ImportError(msg) ImportError: Traceback (most recent call last): File "C:\style-transfer\styletransfervenv\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\style-transfer\styletransfervenv\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\style-transfer\styletransfervenv\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper import _pywrap_tensorflow_internal ImportError: No module named _pywrap_tensorflow_internal

Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_problems

for some common reasons and solutions. Include the entire stack trace above this error message when asking for help.

If you suspect this is an IPython bug, please report it at: https://github.com/ipython/ipython/issues or send an email to the mailing list at ipython-dev@python.org

You can print a more detailed traceback right now with "%tb", or use "%debug" to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via: %config Application.verbose_crash=True

Manuel030 commented 3 years ago

Solved, Tensorflow 1x and Python 2 are not compatible on Windows. Solution: Use Python 3.5 and manually fix syntax errors in code