autonose icon indicating copy to clipboard operation
autonose copied to clipboard

Does not work with virtualenv

Open exhuma opened this issue 11 years ago • 2 comments

Without activating the virtualenv, I get the expected errors, that some modules are missing. Say, if my project uses SQLAlchemy, it will fail, because SA is only available in the virtual environment. Not in the system.

The recommended way is using 0lauch. Because there is (as far as I can tell) no virtualenv support in 0lauch, I have to activate it, which gives me this output:

0launch http://gfxmonk.net/dist/0install/autonose.xml
/home/users/exhuma/.cache/0install.net/implementations/sha256=34628023485d65593b7cea030d6af43f81088d8940d49522ffb2ace7b6be270d/usr/lib/python/dist-packages/nose/util.py:14: DeprecationWarning: The compiler package is deprecated and removed in Python 3.x.
  from compiler.consts import CO_GENERATOR
Traceback (most recent call last):
  File "/home/users/exhuma/.cache/0install.net/implementations/sha256=2d679d7310c3255a76b420568242890dfbd04d5e4ed60a88d088335f6f8bf8cc/autonose/runner.py", line 163, in init_ui
    App = default_app()
  File "/home/users/exhuma/.cache/0install.net/implementations/sha256=2d679d7310c3255a76b420568242890dfbd04d5e4ed60a88d088335f6f8bf8cc/autonose/ui/platform.py", line 7, in default_app
    from gtkapp import App
  File "/home/users/exhuma/.cache/0install.net/implementations/sha256=2d679d7310c3255a76b420568242890dfbd04d5e4ed60a88d088335f6f8bf8cc/autonose/ui/gtkapp.py", line 9, in <module>
    import gtk
ImportError: No module named gtk
UI load failed - falling back to basic console
----------------------------------------

----------------------------------------------------------------------
Ran 0 tests in 1.125s

OK

So the observed errors are:

  1. GTK is not found. This is normal, as autonose is not installed into the virtualenv.
  2. No tests are discovered by autonose, but nosetests itself finds them.

exhuma avatar Sep 03 '13 11:09 exhuma

Installing it into the environment (f.ex. with ./env/bin/pip install autonose) seems to make it work, but without GTK support. I tried to apply http://stackoverflow.com/a/9612404/160665 which stops it complaining from a missing GTK, but then webkit is missing, and simply "pip installing" webkit does not seem to work.

Note though that the first execution takes a very long time!

exhuma avatar Sep 03 '13 11:09 exhuma

I've just got autonose to work inside virtualenv by installing python-webkit using a similar workaround as GTK. Steps for the workaround for webkit (please modify the system's dist-package path, path-to-env, and python version appropriately):

  1. Install python webkit binding using your OS package manager (e.g. in Ubuntu: sudo apt-get install python-webkit)
  2. Add a symlink from the system webkit to your virtualenv's site-packages (e.g. ln -s /usr/lib/python2.7/dist-packages/webkit/ path-to-env/lib/python2.7/site-packages/webkit)
  3. Create a .pth file referencing the webkit directory (e.g. echo "webkit" > path-to-env/lib/python2.7/site-packages/webkit.pth)

Also, the slow launch may be due to #27.

lieryan avatar Feb 14 '14 19:02 lieryan