priya-dwivedi / cs224n-Squad-Project

487 stars 217 forks source link

unable to install tensorflow==1.4.1 for python 2.7 #4

Open medasuryatej opened 6 years ago

medasuryatej commented 6 years ago

It is mentioned in the code that it is written in Tensorflow==1.4.1 in Python 2.7 I am unable to install Tensorflow==1.4.1 in Python 2.7 Environment. I am able to install Tensorflow only in python 3.5 and above. When I try to run main.py with I facing several Python 2.7 to 3.6 compatibility issues

Error While installing Tensorflow in Python 2.7

C:\Python27\Scripts>pip install tensorflow==1.4.0 --proxy approxy.rockwellcollins.com:9090
Collecting tensorflow==1.4.0
  Could not find a version that satisfies the requirement tensorflow==1.4.0 (from versions: )
No matching distribution found for tensorflow==1.4.0

My OS: Windows 10 Anaconda 64 bit Environment Tensorflowversion 1.4 Python 3.6.5

Error with Python 3.6.5

(squad) D:\cs224n-Squad-Project>python D://cs224n-Squad-Project//code//main.py --experiment_name=bidaf_best --dropout=0.15 --batch_size=60 --hidden_size_encoder=150 --embedding_size=100 --do_char_embed=False --add_highway_layer=True --rnet_attention=False --bidaf_attention=True --answer_pointer_RNET=False --smart_span=True --hidden_size_modeling=150 --mode=train
This code was developed and tested on TensorFlow 1.4.1. Your TensorFlow version: 1.4.0
Loading GLoVE vectors from file: .\data\glove.6B.100d.txt
  0%|                                                                                                                          | 0/400000 [00:00<?, ?it/s]Traceback (most recent call last):
  File "D://cs224n-Squad-Project//code//main.py", line 232, in <module>
    tf.app.run()
  File "C:\anaconda3\envs\squad\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "D://cs224n-Squad-Project//code//main.py", line 150, in main
    emb_matrix, word2id, id2word = get_glove(FLAGS.glove_path, FLAGS.embedding_size)
  File "D:\cs224n-Squad-Project\code\vocab.py", line 67, in get_glove
    for line in tqdm(fh, total=vocab_size):
  File "C:\anaconda3\envs\squad\lib\site-packages\tqdm\_tqdm.py", line 930, in __iter__
    for obj in iterable:
  File "C:\anaconda3\envs\squad\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 2776: character maps to <undefined>
medasuryatej commented 6 years ago

Was able to solve it, by opening every file with encoding="utf8" in the code

dhrths commented 6 years ago

can you please tell me what do you mean by 'opening every file with encoding="utf8"?

medasuryatej commented 6 years ago

the encoding of the file caused an issue UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 2776: character maps to So I had to change the file encoding to utf8 while reading/writing, and it worked

dhrths commented 6 years ago

The file encoding in main.py is already in utf-8 coding...where do we have to change?

medasuryatej commented 6 years ago

I kinda changed in every file . While opening in write mode added a encoding = utf8

On Aug 16, 2018 18:39, "DHRTHI NANDA" notifications@github.com wrote:

The file encoding in main.py is already in utf-8 coding...where do we have to change?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/priya-dwivedi/cs224n-Squad-Project/issues/4#issuecomment-413539688, or mute the thread https://github.com/notifications/unsubscribe-auth/ANZqbeLTD4vig8Z15GapmdOhouEoBCepks5uRW8XgaJpZM4VXlEJ .

mandarmp commented 5 years ago

use python 3+ but convert each file using (2to3 -w filename) command.