python - pip installs package twice -


unfortunately can't reproduce it, have seen several times:

pip installs 1 packages twice.

if uninstall first, second gets visible , can uninstalled, too.

my question: how can check python if package installed twice?

background: want write test checks (devop)

update

  • packages installed in virtualenv.
  • the 2 packages have different versions.
  • this not duplicate of solutions solve hand. search solution detect python code. how resolve not part if question.

update 2

the command pip freeze outputs package once:

pip freeze | grep -i south south==0.8.1 

but in virtual-env exists twice:

find lib -name top_level.txt |xargs cat | grep -i south south south  ls lib/python2.7/site-packages/| grep -i south south south-0.8.1-py2.7.egg south-0.8.4-py2.7.egg-info 

this should work:

def count_installs(pkg_name):     import imp, sys     n = 0     location in sys.path:         try:             imp.find_module(pkg_name, [location])         except importerror: pass         else: n += 1     return n 

e.g.

>>> count_installs("numpy") 2 >>> count_installs("numpyd") 0 >>> count_installs("sympy") 1 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -