Vivek Anand
Vivek Anand

Reputation: 651

Not able to import pynotify in virtualenv

i am using Ubuntu 14.04. I have a script which depends on pynotify. When the script is run outside any virtual environment then it runs fine (other dependencies also installed globally) but if i run the same script inside any virtual environment (other dependencies installed there as well), it doesn't work.
Then i thought that i would have been installed it globally earlier but it was not. I tried this (globally):

pip freeze | grep pynotify

But, it didn't give any result. Is there any explanation to this behavior?

Upvotes: 0

Views: 151

Answers (1)

Joe Young
Joe Young

Reputation: 5875

Update your virtualenv environment to include system-site-packages:

mkvirtualenv --system-site-packages your_virtual_env_name

If you build with virtualenv --system-site-packages ENV, your virtual environment will inherit packages from /usr/lib/python2.7/site-packages (or wherever your global site-packages directory is).

This can be used if you have control over the global site-packages directory, and you want to depend on the packages there. If you want isolation from the global system, do not use this flag.

Source: https://virtualenv.pypa.io/en/latest/userguide.html#the-system-site-packages-option

Upvotes: 1

Related Questions