← Back to team overview

registry team mailing list archive

[Bug 615906] [NEW] pip-requires and virtualenv don't play together nicely

 

Public bug reported:

OK, so I'm familiar with virtualenv, and have been developing Nova with
virtualenv for a while now, with no problems if I use the instructions I
put up on my blog here:

http://www.joinfu.com/2010/07/developing-nova-on-linux-getting-started/

However, if I try to use the "automated" virtualenv/run_tests.sh stuff,
everything bombs, and IMHO, it bombs unnecessarily.

I'm on Linux, Ubuntu Lucid, but it really shouldn't matter *what* I have
installed locally if we use virtualenv properly.  Let me show you what
happens when I try to do things "the automated" way using run_tests.sh
and /tools/install_virtualenv.py.

jpipes@serialcoder:~/repos/nova/pylint-nova-objectstore-handler$ ./run_tests.sh
You need to install the Nova virtualenv before you can run this.

Please run tools/install_venv.py
jpipes@serialcoder:~/repos/nova/pylint-nova-objectstore-handler$ python tools/install_venv.py
Checking for pip... done.
Checking for virtualenv... done.
Creating venv... done.
Installing dependencies with pip (this can take a while)...
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/pip.py", line 252, in main
    self.run(options, args)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 408, in run
    requirement_set.install_files(finder, force_root_egg_info=self.bundle)
  File "/usr/lib/python2.6/dist-packages/pip.py", line 1721, in install_files
    if req_to_install.check_if_exists():
  File "/usr/lib/python2.6/dist-packages/pip.py", line 1583, in check_if_exists
    dist = pkg_resources.get_distribution(self.req)
  File "/usr/share/pyshared/pkg_resources.py", line 292, in get_distribution
    if isinstance(dist,Requirement): dist = get_provider(dist)
  File "/usr/share/pyshared/pkg_resources.py", line 176, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/usr/share/pyshared/pkg_resources.py", line 436, in find
    raise VersionConflict(dist,req)     # XXX add more info
VersionConflict: (anyjson 0.2.2 (/usr/share/pyshared), Requirement.parse('anyjson==0.2.4'))

Storing complete log in ./pip-log.txt
Command "pip install -E .nova-venv -r tools/pip-requires" failed.
None

===

This is just outright annoying.  The whole purpose of a virtualenv is to
install packages into a virtual environment that don't necessarily match
what's already on your system.

I feel there are a couple of issues with the current scripts:

1) There is really no need to have PIP be a dependency *before* creating
the virtualenv.  Right now, not having PIP will bomb out the
install_virtenv.py script needlessly.  PIP could be installed once the
virtualenv is activated.

2) The run_tests.sh can be adapted to simply all the needed dependencies
automatically if virtualenv is found and the .nova-venv directory does
not exist.  There's really no need to exit and make the user do it
manually.

** Affects: nova
     Importance: Undecided
         Status: New

** Description changed:

  OK, so I'm familiar with virtualenv, and have been developing Nova with
  virtualenv for a while now, with no problems if I use the instructions I
  put up on my blog here:
  
+ http://www.joinfu.com/2010/07/developing-nova-on-linux-getting-started/
  
  However, if I try to use the "automated" virtualenv/run_tests.sh stuff,
  everything bombs, and IMHO, it bombs unnecessarily.
  
  I'm on Linux, Ubuntu Lucid, but it really shouldn't matter *what* I have
  installed locally if we use virtualenv properly.  Let me show you what
  happens when I try to do things "the automated" way using run_tests.sh
  and /tools/install_virtualenv.py.
  
- jpipes@serialcoder:~/repos/nova/pylint-nova-objectstore-handler$ ./run_tests.sh 
+ jpipes@serialcoder:~/repos/nova/pylint-nova-objectstore-handler$ ./run_tests.sh
  You need to install the Nova virtualenv before you can run this.
  
  Please run tools/install_venv.py
- jpipes@serialcoder:~/repos/nova/pylint-nova-objectstore-handler$ python tools/install_venv.py 
+ jpipes@serialcoder:~/repos/nova/pylint-nova-objectstore-handler$ python tools/install_venv.py
  Checking for pip... done.
  Checking for virtualenv... done.
  Creating venv... done.
  Installing dependencies with pip (this can take a while)...
  Exception:
  Traceback (most recent call last):
-   File "/usr/lib/python2.6/dist-packages/pip.py", line 252, in main
-     self.run(options, args)
-   File "/usr/lib/python2.6/dist-packages/pip.py", line 408, in run
-     requirement_set.install_files(finder, force_root_egg_info=self.bundle)
-   File "/usr/lib/python2.6/dist-packages/pip.py", line 1721, in install_files
-     if req_to_install.check_if_exists():
-   File "/usr/lib/python2.6/dist-packages/pip.py", line 1583, in check_if_exists
-     dist = pkg_resources.get_distribution(self.req)
-   File "/usr/share/pyshared/pkg_resources.py", line 292, in get_distribution
-     if isinstance(dist,Requirement): dist = get_provider(dist)
-   File "/usr/share/pyshared/pkg_resources.py", line 176, in get_provider
-     return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
-   File "/usr/share/pyshared/pkg_resources.py", line 436, in find
-     raise VersionConflict(dist,req)     # XXX add more info
+   File "/usr/lib/python2.6/dist-packages/pip.py", line 252, in main
+     self.run(options, args)
+   File "/usr/lib/python2.6/dist-packages/pip.py", line 408, in run
+     requirement_set.install_files(finder, force_root_egg_info=self.bundle)
+   File "/usr/lib/python2.6/dist-packages/pip.py", line 1721, in install_files
+     if req_to_install.check_if_exists():
+   File "/usr/lib/python2.6/dist-packages/pip.py", line 1583, in check_if_exists
+     dist = pkg_resources.get_distribution(self.req)
+   File "/usr/share/pyshared/pkg_resources.py", line 292, in get_distribution
+     if isinstance(dist,Requirement): dist = get_provider(dist)
+   File "/usr/share/pyshared/pkg_resources.py", line 176, in get_provider
+     return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
+   File "/usr/share/pyshared/pkg_resources.py", line 436, in find
+     raise VersionConflict(dist,req)     # XXX add more info
  VersionConflict: (anyjson 0.2.2 (/usr/share/pyshared), Requirement.parse('anyjson==0.2.4'))
  
  Storing complete log in ./pip-log.txt
  Command "pip install -E .nova-venv -r tools/pip-requires" failed.
  None
  
  ===
  
  This is just outright annoying.  The whole purpose of a virtualenv is to
  install packages into a virtual environment that don't necessarily match
  what's already on your system.
  
  I feel there are a couple of issues with the current scripts:
  
  1) There is really no need to have PIP be a dependency *before* creating
  the virtualenv.  Right now, not having PIP will bomb out the
  install_virtenv.py script needlessly.  PIP could be installed once the
  virtualenv is activated.
  
  2) The run_tests.sh can be adapted to simply all the needed dependencies
  automatically if virtualenv is found and the .nova-venv directory does
  not exist.  There's really no need to exit and make the user do it
  manually.

-- 
pip-requires and virtualenv don't play together nicely
https://bugs.launchpad.net/bugs/615906
You received this bug notification because you are a member of Registry
Administrators, which is subscribed to OpenStack.



Follow ups

References