llSourcell / AI_Writer

AI Writer for Machine Learning for Hackers #8
163 stars 97 forks source link

import generate - module not found #4

Open quintendewilde opened 7 years ago

quintendewilde commented 7 years ago

Hi my console starts with this when running python:


Python 3.6.0 |Anaconda 4.3.1 (x86_64)| (default, Dec 23 2016, 13:19:00) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>  import generate
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'generate'
>>> 

I did all installation dependencies. Where can I locate the generate module to install for.

mzkhan141 commented 7 years ago

You need to go to the to the downloaded directory which by default should be AI_Writer. so find this directory and migrate to this directory using cd and then run python from this directory , it would most probably work

quintendewilde commented 7 years ago

from my user folder I cd in to AI_Writer

Console gives me :

AI_writer myname$ ls
README.md       decoder.py      embedding.pyc       images          skipthoughts.py
config.py       decoder.pyc     generate.py     search.py       skipthoughts.pyc
config.pyc      embedding.py        generate.pyc        search.pyc      test.py

And from here I did python import generate.

Any other idea what might call this error?

mzkhan141 commented 7 years ago

Can you please write down the full stacktrace that you get after executing this:

$ python
>>> import generate
quintendewilde commented 7 years ago

I get following trace, though it's different than the one before...

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/myname/AI_Writer/generate.py", line 53
    print 'NEAREST-CAPTIONS: '
                             ^
SyntaxError: Missing parentheses in call to 'print'
mzkhan141 commented 7 years ago

Ok, So its not an ImportError now its a Syntax Error. Are you using Python 3.5?

quintendewilde commented 7 years ago

When using python in console following shows

Python 3.6.0 |Anaconda 4.3.1 (x86_64)| (default, Dec 23 2016, 13:19:00) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin

3.6 is ok? It's definitely not 2.7 though I have this also. (don't know how to switch though...)

mzkhan141 commented 7 years ago

Well this is the problem this script was written for Python 2 and not for Python 3 . I assume that you have Python 2 as well if not I recommend you to download Python 2.7 . And then you can launch Python 2 just by typing python and Python 3 by typing python3 I hope this helps!

quintendewilde commented 7 years ago

I did python2 in console and got this:

Myname:AI_writer Myname$ python2
Python 2.7.13 |Continuum Analytics, Inc.| (default, Dec 20 2016, 23:05:08) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import generate
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "generate.py", line 14, in <module>
    import config
  File "config.py", line 21, in <module>
    if not config.FLAG_CPU_MODE:
AttributeError: 'module' object has no attribute 'FLAG_CPU_MODE'

This is a totally different new error..

mzkhan141 commented 7 years ago

Yes thats a bug in this script but when I debugged this error a new error popped up. After studying the working of this script for a while I came out with this conclusion that there is something wrong with the config.py file.

quintendewilde commented 7 years ago

So this should be reported as a bug? And is there a workaround?

mzkhan141 commented 7 years ago

According to me its a bug and I haven't found a workaround yet

quintendewilde commented 7 years ago

Is this something that you thing that might be fixed in the nearby future?

mzkhan141 commented 7 years ago

I am not sure about that and I cant promise you anything.

shivaraj-bh commented 6 years ago

I have found a fix for the issue. You can get the config.py flie from this link https://github.com/ryankiros and going to this storyteller repo. After replacing the file if you have any issues feel free to ask because I ran it on my system and works perfectly fine.