4

There is 2 situation:

1) I was trying to install pygtk in my virtual environment. py2cairo caused errors so i couldn't install. Then i linked pygtk and py2cairo in my python installation to my virtual enviroment as offered in here >> Python package installed globally, but not in a virtualenv (PyGTK)

2) I have many virtual environments for my django applications in my server. All have common django package in same version in nearly all my virtual enviroments. And so in every virtual environment there is a django copy again and again.

For these 2 situation linking could work as charm but !

Question: i still cant find any solution how to make pip to see these packages.

PS: Or any better approach for this problem?

Community
  • 1
  • 1
obayhan
  • 1,636
  • 18
  • 35

1 Answers1

2

I think that virtualenv created with --system-site-packages option will do the job. Docs here.

Thomas Jungers
  • 107
  • 2
  • 8
  • 1
    Thank you. But it is a partial answer. Sharing with other virtual environments and the main question still remains – obayhan Apr 13 '16 at 11:20
  • 1
    Can't you just install globally package which you want to share, eg. django? – andrzej3393 Apr 13 '16 at 11:45
  • 1
    Yes i can. But what about 2 main django branch 1.6 and 1.8 with many apps depending on them? For example 20 virtual enviroment uses django 1.6 and 30 enviroment uses django 1.8. then? – obayhan Apr 13 '16 at 11:47
  • I see. I have an idea, but I'm not sure if it'll work correctly - you can set one venv with django 1.6, then create venv for particular app and modify `activate` script to force it to use django from first venv ([PYTHONPATH](https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPATH) should do the job). But, as I said, I'm not sure if it'll work. Moreover, I'm not sure if it's good idea - it somewhat spoils the possibility of up-/downgrade of a particular library. – andrzej3393 Apr 13 '16 at 12:06
  • I think it could be more messy :) linking is better than this except pip problem. – obayhan Apr 13 '16 at 12:57
  • 1
    The docs page has gone away. Could someone who has tried this before add some instructions please? – icedwater Apr 14 '21 at 09:51