You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by Apache Bloodhound <de...@bloodhound.apache.org> on 2014/01/14 08:58:37 UTC

[Apache Bloodhound] #733: bloodhound_setup.py fails - "ImportError: No module named trac.util"

#733: bloodhound_setup.py fails - "ImportError: No module named trac.util"
------------------------+--------------------
 Reporter:  AlecTaylor  |      Owner:  nobody
     Type:  defect      |     Status:  new
 Priority:  blocker     |  Milestone:
Component:  installer   |    Version:
 Keywords:              |
------------------------+--------------------
 Line 34-35 in "bloodhound_setup.py" (from git):
 {{{
 from trac.util import translation
 from trac.util.translation import _, get_negotiated_locale, has_babel
 }}}

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/733>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound issue tracker

Re: [Apache Bloodhound] #733: bloodhound_setup.py fails - "ImportError: No module named trac.util"

Posted by Apache Bloodhound <de...@bloodhound.apache.org>.
#733: bloodhound_setup.py fails - "ImportError: No module named trac.util"
-------------------------+--------------------
  Reporter:  AlecTaylor  |      Owner:  nobody
      Type:  defect      |     Status:  new
  Priority:  blocker     |  Milestone:
 Component:  installer   |    Version:
Resolution:              |   Keywords:
-------------------------+--------------------

Comment (by astaric):

 Are you following installation on the wiki (BloodhoundInstall)?

 It looks like you skipped the

 {{{
  pip install -r requirements.txt
 }}}

 step.

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/733#comment:1>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound issue tracker

Re: [Apache Bloodhound] #733: bloodhound_setup.py fails - "ImportError: No module named trac.util"

Posted by Apache Bloodhound <de...@bloodhound.apache.org>.
#733: bloodhound_setup.py fails - "ImportError: No module named trac.util"
-------------------------+--------------------
  Reporter:  AlecTaylor  |      Owner:  nobody
      Type:  defect      |     Status:  new
  Priority:  blocker     |  Milestone:
 Component:  installer   |    Version:
Resolution:              |   Keywords:
-------------------------+--------------------

Comment (by AlecTaylor):

 Oh goodie, a new error (after running that command in my `virtualenv`):
 {{{
 Exception:
 Traceback (most recent call last):
   File "bloodhound_env/local/lib/python2.7/site-
 packages/pip/basecommand.py", line 134, in main
     status = self.run(options, args)
   File "bloodhound_env/local/lib/python2.7/site-
 packages/pip/commands/install.py", line 220, in run
     for req in parse_requirements(filename, finder=finder,
 options=options):
   File "bloodhound_env/local/lib/python2.7/site-packages/pip/req.py", line
 1477, in parse_requirements
     req = InstallRequirement.from_line(line, comes_from,
 prereleases=getattr(options, "pre", None))
   File "bloodhound_env/local/lib/python2.7/site-packages/pip/req.py", line
 129, in from_line
     return cls(req, comes_from, url=url, prereleases=prereleases)
   File "bloodhound_env/local/lib/python2.7/site-packages/pip/req.py", line
 44, in __init__
     req = pkg_resources.Requirement.parse(req)
   File "bloodhound_env/local/lib/python2.7/site-
 packages/pkg_resources.py", line 2914, in parse
     reqs = list(parse_requirements(s))
   File "bloodhound_env/local/lib/python2.7/site-
 packages/pkg_resources.py", line 2839, in parse_requirements
     line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version
 spec")
   File "bloodhound_env/local/lib/python2.7/site-
 packages/pkg_resources.py", line 2807, in scan_list
     raise ValueError("Expected "+item_name+" in",line,"at",line[p:])
 ValueError: ('Expected version spec in', '../trac', 'at', '/trac')
 }}}

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/733#comment:8>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound issue tracker

Re: [Apache Bloodhound] #733: bloodhound_setup.py fails - "ImportError: No module named trac.util"

Posted by Apache Bloodhound <de...@bloodhound.apache.org>.
#733: bloodhound_setup.py fails - "ImportError: No module named trac.util"
-------------------------+--------------------
  Reporter:  AlecTaylor  |      Owner:  nobody
      Type:  defect      |     Status:  new
  Priority:  blocker     |  Milestone:
 Component:  installer   |    Version:
Resolution:              |   Keywords:
-------------------------+--------------------

Comment (by astaric):

 I run your script in a fresh ubuntu virtual machine, and it fails for me
 as well.

 The problem with the script is, that it executes all steps, even if one of
 the intermidient steps fails. You can fix this by adding
 {{{
 set -e
 }}}
 before the first line. This way the script will stop execution if any of
 the commands fail.

 The reason for failure on my machine was, that I was running it as
 {{{
 sh script.sh
 }}}
 (sh does not have "source" command, while bash has). Could you add set -e
 to the beginning of your script and see if it fails with the same error?

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/733#comment:15>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound issue tracker

Re: [Apache Bloodhound] #733: bloodhound_setup.py fails - "ImportError: No module named trac.util"

Posted by Apache Bloodhound <de...@bloodhound.apache.org>.
#733: bloodhound_setup.py fails - "ImportError: No module named trac.util"
-------------------------+--------------------
  Reporter:  AlecTaylor  |      Owner:  nobody
      Type:  defect      |     Status:  new
  Priority:  blocker     |  Milestone:
 Component:  installer   |    Version:
Resolution:              |   Keywords:
-------------------------+--------------------

Comment (by rjollos):

 It seems that, due to the use of relative paths in `requirements.txt`, my
 guidance was incorrect. Try:
 {{{#!sh
 cd installer
 pip install -r requirements.txt
 }}}

 Regarding the original issue, I guess that your virtual environment was
 being properly activated in your script? I vaguely remember running into a
 similar issue in the past, that it didn't work properly in my script, but
 worked fine form the command line.

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/733#comment:9>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound issue tracker

Re: [Apache Bloodhound] #733: bloodhound_setup.py fails - "ImportError: No module named trac.util"

Posted by Apache Bloodhound <de...@bloodhound.apache.org>.
#733: bloodhound_setup.py fails - "ImportError: No module named trac.util"
-------------------------+--------------------
  Reporter:  AlecTaylor  |      Owner:  nobody
      Type:  defect      |     Status:  new
  Priority:  blocker     |  Milestone:
 Component:  installer   |    Version:
Resolution:              |   Keywords:
-------------------------+--------------------

Comment (by astaric):

 Could you run
 {{{
 pip freeze
 }}}
 while bloodhound_env is active and post its ouput?

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/733#comment:4>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound issue tracker

Re: [Apache Bloodhound] #733: bloodhound_setup.py fails - "ImportError: No module named trac.util"

Posted by Apache Bloodhound <de...@bloodhound.apache.org>.
#733: bloodhound_setup.py fails - "ImportError: No module named trac.util"
-------------------------+--------------------
  Reporter:  AlecTaylor  |      Owner:  nobody
      Type:  defect      |     Status:  new
  Priority:  blocker     |  Milestone:
 Component:  installer   |    Version:
Resolution:              |   Keywords:
-------------------------+--------------------

Comment (by rjollos):

 I'm not sure what the issue is. What do you see when opening the Python
 shell and typing?:
 {{{#!sh
 >>> import trac
 >>> import babe
 }}}

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/733#comment:11>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound issue tracker

Re: [Apache Bloodhound] #733: bloodhound_setup.py fails - "ImportError: No module named trac.util"

Posted by Apache Bloodhound <de...@bloodhound.apache.org>.
#733: bloodhound_setup.py fails - "ImportError: No module named trac.util"
-------------------------+--------------------
  Reporter:  AlecTaylor  |      Owner:  nobody
      Type:  defect      |     Status:  new
  Priority:  blocker     |  Milestone:
 Component:  installer   |    Version:
Resolution:              |   Keywords:
-------------------------+--------------------

Comment (by rjollos):

 What happens if you manually run (again)?:
 {{{#!sh
 source bloodhound_env/bin/activate
 pip install -r installer/requirements.txt
 }}}
 It seems that nothing was installed in your virtualenv (or you are somehow
 looking at the global environment and not the virtualenv, but you've
 already indicated that's not the case).

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/733#comment:7>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound issue tracker

Re: [Apache Bloodhound] #733: bloodhound_setup.py fails - "ImportError: No module named trac.util"

Posted by Apache Bloodhound <de...@bloodhound.apache.org>.
#733: bloodhound_setup.py fails - "ImportError: No module named trac.util"
-------------------------+--------------------
  Reporter:  AlecTaylor  |      Owner:  nobody
      Type:  defect      |     Status:  new
  Priority:  blocker     |  Milestone:
 Component:  installer   |    Version:
Resolution:              |   Keywords:
-------------------------+--------------------

Comment (by rjollos):

 Also, some version info might help us:
 {{{#!sh
 $ virtualenv --version
 $ pip --version
 $ python --version
 }}}

 It seems likely you have some problem with your virtualenv, or activating
 it.

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/733#comment:5>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound issue tracker

Re: [Apache Bloodhound] #733: bloodhound_setup.py fails - "ImportError: No module named trac.util"

Posted by Apache Bloodhound <de...@bloodhound.apache.org>.
#733: bloodhound_setup.py fails - "ImportError: No module named trac.util"
-------------------------+--------------------
  Reporter:  AlecTaylor  |      Owner:  nobody
      Type:  defect      |     Status:  new
  Priority:  blocker     |  Milestone:
 Component:  installer   |    Version:
Resolution:              |   Keywords:
-------------------------+--------------------

Comment (by rjollos):

 I am not sure what could be wrong. It seems that `has_babel` should be in
 scope, and execution should have halted if the import failed. Maybe you
 should just recreate the virtualenv and proceed with the steps from there.

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/733#comment:13>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound issue tracker

Re: [Apache Bloodhound] #733: bloodhound_setup.py fails - "ImportError: No module named trac.util"

Posted by Apache Bloodhound <de...@bloodhound.apache.org>.
#733: bloodhound_setup.py fails - "ImportError: No module named trac.util"
-------------------------+--------------------
  Reporter:  AlecTaylor  |      Owner:  nobody
      Type:  defect      |     Status:  new
  Priority:  blocker     |  Milestone:
 Component:  installer   |    Version:
Resolution:              |   Keywords:
-------------------------+--------------------

Comment (by AlecTaylor):

 Those commands worked within the virtualenv without issue. Additionally:
 {{{
 >>> from trac.util.translation import has_babel
 >>> has_babel
 True
 }}}

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/733#comment:12>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound issue tracker

Re: [Apache Bloodhound] #733: bloodhound_setup.py fails - "ImportError: No module named trac.util"

Posted by Apache Bloodhound <de...@bloodhound.apache.org>.
#733: bloodhound_setup.py fails - "ImportError: No module named trac.util"
-------------------------+--------------------
  Reporter:  AlecTaylor  |      Owner:  nobody
      Type:  defect      |     Status:  new
  Priority:  blocker     |  Milestone:
 Component:  installer   |    Version:
Resolution:              |   Keywords:
-------------------------+--------------------

Comment (by AlecTaylor):

 Thanks, it worked this time (after a few timeout errors); so I got to the
 `python bloodhound_setup.py` step and entered in my postgres details, then
 got this error:
 {{{
 Traceback (most recent call last):
   File "bloodhound_setup.py", line 467, in <module>
     bsetup.setup()
   File "bloodhound_setup.py", line 163, in setup
     if has_babel:
 NameError: global name 'has_babel' is not defined
 }}}

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/733#comment:10>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound issue tracker

Re: [Apache Bloodhound] #733: bloodhound_setup.py fails - "ImportError: No module named trac.util"

Posted by Apache Bloodhound <de...@bloodhound.apache.org>.
#733: bloodhound_setup.py fails - "ImportError: No module named trac.util"
-------------------------+--------------------
  Reporter:  AlecTaylor  |      Owner:  nobody
      Type:  defect      |     Status:  new
  Priority:  blocker     |  Milestone:
 Component:  installer   |    Version:
Resolution:              |   Keywords:
-------------------------+--------------------

Comment (by AlecTaylor):

 rjollos: virtualenv 1.10.1, pip 1.4.1, Python 2.7.5+.

 astaric: `source bloodhound_env/bin/activate` then `pip freeze` -
 http://pastebin.com/CY53jwAz
 Judging by the sheer size of it, it seems to be take my global packages.
 (I have started migrating everything to virtualenvs)

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/733#comment:6>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound issue tracker

Re: [Apache Bloodhound] #733: bloodhound_setup.py fails - "ImportError: No module named trac.util"

Posted by Apache Bloodhound <de...@bloodhound.apache.org>.
#733: bloodhound_setup.py fails - "ImportError: No module named trac.util"
-------------------------+--------------------
  Reporter:  AlecTaylor  |      Owner:  nobody
      Type:  defect      |     Status:  new
  Priority:  blocker     |  Milestone:
 Component:  installer   |    Version:
Resolution:              |   Keywords:
-------------------------+--------------------

Comment (by AlecTaylor):

 Confirmed that it doesn't work; even when removing all bloodhound related
 files and starting again (from that script).

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/733#comment:14>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound issue tracker

Re: [Apache Bloodhound] #733: bloodhound_setup.py fails - "ImportError: No module named trac.util"

Posted by Apache Bloodhound <de...@bloodhound.apache.org>.
#733: bloodhound_setup.py fails - "ImportError: No module named trac.util"
-------------------------+--------------------
  Reporter:  AlecTaylor  |      Owner:  nobody
      Type:  defect      |     Status:  new
  Priority:  blocker     |  Milestone:
 Component:  installer   |    Version:
Resolution:              |   Keywords:
-------------------------+--------------------

Comment (by AlecTaylor):

 I have been writing an install script as I go:


 {{{
 # Apache Bloodhound
 echo "Installing Apache Bloodhound"
 sudo apt-get install postgresql python-psycopg2

 echo "Creating user for Apache Bloodhound db"
 sudo -u postgres createuser --no-superuser --no-createdb --no-createrole
 --encrypted -w bloodhound
 # YAY: plain-text password
 sudo -u postgres psql -U postgres -d postgres -c "alter user bloodhound
 with password 'bloodhound';"
 sudo -u postgres  createdb --owner=bloodhound --encoding=UTF-8 bloodhound

 echo "Setting Apache Bloodhound db permissions"
 sudo sed -i -e 's/local   all             all
 peer/local   all             all
 md5/g' /etc/postgresql/9.1/main/pg_hba.conf

 echo "Restarting Postgres"
 sudo /etc/init.d/postgresql restart

 git clone "http://git.apache.org/bloodhound.git"
 cd bloodhound/installer
 virtualenv --system-site-packages bloodhound_env
 source ./bloodhound_env/bin/activate
 pip install -r requirements.txt
 python bloodhound_setup.py
 }}}

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/733#comment:2>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound issue tracker

Re: [Apache Bloodhound] #733: bloodhound_setup.py fails - "ImportError: No module named trac.util"

Posted by Apache Bloodhound <de...@bloodhound.apache.org>.
#733: bloodhound_setup.py fails - "ImportError: No module named trac.util"
-------------------------+--------------------
  Reporter:  AlecTaylor  |      Owner:  nobody
      Type:  defect      |     Status:  new
  Priority:  blocker     |  Milestone:
 Component:  installer   |    Version:
Resolution:              |   Keywords:
-------------------------+--------------------

Comment (by gjm):

 note that r1557980 changes the file and therefore the specific error. The
 script is effectively using the up to date trunk code.

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/733#comment:3>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound issue tracker

Re: [Apache Bloodhound] #733: bloodhound_setup.py fails - "ImportError: No module named trac.util"

Posted by Apache Bloodhound <de...@bloodhound.apache.org>.
#733: bloodhound_setup.py fails - "ImportError: No module named trac.util"
-------------------------+--------------------
  Reporter:  AlecTaylor  |      Owner:  nobody
      Type:  defect      |     Status:  closed
  Priority:  blocker     |  Milestone:
 Component:  installer   |    Version:
Resolution:  worksforme  |   Keywords:
-------------------------+--------------------
Changes (by rjollos):

 * status:  new => closed
 * resolution:   => worksforme


Comment:

 Since there has been no response, I'm going to assume that the suggestions
 from astaric helped to resolve the issue. Please follow-up if you are
 still having trouble.

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/733#comment:16>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound issue tracker