Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

ImportError: cannot import name contrib #60

Closed
zhang-jian opened this issue Mar 15, 2017 · 7 comments
Closed

ImportError: cannot import name contrib #60

zhang-jian opened this issue Mar 15, 2017 · 7 comments

Comments

@zhang-jian
Copy link

zhang-jian commented Mar 15, 2017

Hi all,
Following the page at https://google.github.io/seq2seq/getting_started/, got error

user@localhost:~/Desktop/seq2seq$ pip install -e .
Obtaining file:///home/user/Desktop/seq2seq
Requirement already satisfied: numpy in /home/user/anaconda2/lib/python2.7/site-packages (from seq2seq==0.1)
Requirement already satisfied: matplotlib in /home/user/anaconda2/lib/python2.7/site-packages (from seq2seq==0.1)
Requirement already satisfied: pyyaml in /home/user/anaconda2/lib/python2.7/site-packages (from seq2seq==0.1)
Requirement already satisfied: pyrouge in /home/user/anaconda2/lib/python2.7/site-packages (from seq2seq==0.1)
Requirement already satisfied: six>=1.10 in /home/user/anaconda2/lib/python2.7/site-packages (from matplotlib->seq2seq==0.1)
Requirement already satisfied: python-dateutil in /home/user/anaconda2/lib/python2.7/site-packages (from matplotlib->seq2seq==0.1)
Requirement already satisfied: functools32 in /home/user/anaconda2/lib/python2.7/site-packages (from matplotlib->seq2seq==0.1)
Requirement already satisfied: subprocess32 in /home/user/anaconda2/lib/python2.7/site-packages (from matplotlib->seq2seq==0.1)
Requirement already satisfied: pytz in /home/user/anaconda2/lib/python2.7/site-packages (from matplotlib->seq2seq==0.1)
Requirement already satisfied: cycler>=0.10 in /home/user/anaconda2/lib/python2.7/site-packages (from matplotlib->seq2seq==0.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=1.5.6 in /home/user/anaconda2/lib/python2.7/site-packages (from matplotlib->seq2seq==0.1)
Installing collected packages: seq2seq
  Running setup.py develop for seq2seq
Successfully installed seq2seq
user@localhost:~/Desktop/seq2seq$ python -m unittest seq2seq.test.pipeline_test
Traceback (most recent call last):
  File "/home/user/anaconda2/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/home/user/anaconda2/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/user/anaconda2/lib/python2.7/unittest/__main__.py", line 12, in 
    main(module=None)
  File "/home/user/anaconda2/lib/python2.7/unittest/main.py", line 94, in __init__
    self.parseArgs(argv)
  File "/home/user/anaconda2/lib/python2.7/unittest/main.py", line 149, in parseArgs
    self.createTests()
  File "/home/user/anaconda2/lib/python2.7/unittest/main.py", line 158, in createTests
    self.module)
  File "/home/user/anaconda2/lib/python2.7/unittest/loader.py", line 130, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/home/user/anaconda2/lib/python2.7/unittest/loader.py", line 91, in loadTestsFromName
    module = __import__('.'.join(parts_copy))
  File "seq2seq/__init__.py", line 24, in 
    from seq2seq import contrib
ImportError: cannot import name contrib

PS: It should be
pip install -e .
at https://google.github.io/seq2seq/getting_started/

@dennybritz
Copy link
Contributor

dennybritz commented Mar 15, 2017

Hmm, I have never seen this error before. It seems like other people have had problems with anaconda, it must be somehow related to its Python installation and version...

It's hard for me to fix this without being able to reproduce it.

@panwarnaveen9
Copy link

I am also facing same issue... :(
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcurand.so locally
Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
"main", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/lib/python2.7/unittest/main.py", line 12, in
main(module=None)
File "/usr/lib/python2.7/unittest/main.py", line 94, in init
self.parseArgs(argv)
File "/usr/lib/python2.7/unittest/main.py", line 149, in parseArgs
self.createTests()
File "/usr/lib/python2.7/unittest/main.py", line 158, in createTests
self.module)
File "/usr/lib/python2.7/unittest/loader.py", line 130, in loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
File "/usr/lib/python2.7/unittest/loader.py", line 91, in loadTestsFromName
module = import('.'.join(parts_copy))
File "seq2seq/init.py", line 24, in
from seq2seq import contrib

ImportError: cannot import name contrib

is it some path issue ?

@srikanthtamilselvam
Copy link

I guess the requirement is to use tensorflow 1.0. version mismatch could lead to this problem

@jnuthong
Copy link

@zhang-jian @panwarnaveen9

have same issue before, solve by using pip3
$ pip3 install -e .

note: please remember to use python3 to run the code

@dennybritz
Copy link
Contributor

dennybritz commented Mar 16, 2017

please remember to use python3 to run the code

The code should also work with Python 2.7, it's tested with both versions. It seems like it can't find the module, but I have no idea why. You could try:

export PYHTONPATH=/path/to/seq2seq/directory

@zhang-jian
Copy link
Author

After install tensorflow r1.0 (was r0.12), the problem is solved.

@jnuthong
Copy link

after upgrade tensorflow (1.0.1) do solve my problem

sudo pip install --upgrade tensorflow

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants