Matt Davis
Matt Davis

Reputation: 482

Why doesn't pip installed package show up in pip freeze?

I am trying to install this package via pip. When I run pip install flask-googlemaps, I see the usual output, and the package is installed successfully, along with a handful of dependencies. If I then run pip freeze, I see all dependencies listed, but not the package itself. Why?

Here's a comprehensive breakdown of my process. I tested on a fresh virtualenv to make sure I wasn't just missing it.

  1. $ mkvirtualenv test1

    New python executable in /Users/me/.virtualenvs/test1/bin/python2.7
    Also creating executable in /Users/me/.virtualenvs/test1/bin/python
    Installing setuptools, pip, wheel...done.
    virtualenvwrapper.user_scripts creating /Users/me/.virtualenvs/test1/bin/predeactivate
    virtualenvwrapper.user_scripts creating /Users/me/.virtualenvs/test1/bin/postdeactivate
    virtualenvwrapper.user_scripts creating /Users/me/.virtualenvs/test1/bin/preactivate
    virtualenvwrapper.user_scripts creating /Users/me/.virtualenvs/test1/bin/postactivate
    virtualenvwrapper.user_scripts creating /Users/me/.virtualenvs/test1/bin/get_env_details
    
  2. $ pip freeze

    (no results, because nothing has been installed yet)
    
  3. $ pip install flask-googlemaps

    Collecting flask-googlemaps
      Using cached Flask_GoogleMaps-0.2.5-py2.py3-none-any.whl
    Collecting flask (from flask-googlemaps)
      Using cached Flask-0.12.2-py2.py3-none-any.whl
    Collecting Werkzeug>=0.7 (from flask->flask-googlemaps)
      Using cached Werkzeug-0.12.2-py2.py3-none-any.whl
    Collecting Jinja2>=2.4 (from flask->flask-googlemaps)
      Using cached Jinja2-2.9.6-py2.py3-none-any.whl
    Collecting click>=2.0 (from flask->flask-googlemaps)
      Using cached click-6.7-py2.py3-none-any.whl
    Collecting itsdangerous>=0.21 (from flask->flask-googlemaps)
    Collecting MarkupSafe>=0.23 (from Jinja2>=2.4->flask->flask-googlemaps)
    Installing collected packages: Werkzeug, MarkupSafe, Jinja2, click, itsdangerous, flask, flask-googlemaps
    Successfully installed Jinja2-2.9.6 MarkupSafe-1.0 Werkzeug-0.12.2 click-6.7 flask-0.12.2 flask-googlemaps itsdangerous-0.24
    
  4. $ pip freeze

    click==6.7
    Flask==0.12.2
    itsdangerous==0.24
    Jinja2==2.9.6
    MarkupSafe==1.0
    Werkzeug==0.12.2
    

Note that flask-googlemaps is not included in the second pip freeze output, but all of its dependencies are.

What's even stranger is that I have full access to use the package now. It's installed, it just doesn't show up in pip freeze output.

Upvotes: 3

Views: 3441

Answers (3)

dinosaur
dinosaur

Reputation: 3278

If you have multiple versions of python installed, pip can have unexpected behavior with respect to versions. Make sure to explicitly use pip2 install or pip3 install, and pip2 freeze or pip3 freeze to match with the version of python that you intend to use.

(Note: this answer may not be relevant to the OP's case, but answers the question "Why doesn't pip installed package show up in pip freeze?" for some other cases.)

Upvotes: 1

wonton
wonton

Reputation: 8247

Took some time but I tracked it down.

if you run

pip install -v flask-googlemaps

You will see at the end

Installing collected packages: Werkzeug, MarkupSafe, Jinja2, click, itsdangerous, flask, flask-googlemaps

  Compiling /private/var/folders/2h/0dr8jftd1916yq_lp40__wzh0000gn/T/pip-build-avapA_/Jinja2/jinja2/asyncfilters.py ...
    File "/private/var/folders/2h/0dr8jftd1916yq_lp40__wzh0000gn/T/pip-build-avapA_/Jinja2/jinja2/asyncfilters.py", line 7
      async def auto_to_seq(value):
              ^
  SyntaxError: invalid syntax

  Compiling /private/var/folders/2h/0dr8jftd1916yq_lp40__wzh0000gn/T/pip-build-avapA_/Jinja2/jinja2/asyncsupport.py ...
    File "/private/var/folders/2h/0dr8jftd1916yq_lp40__wzh0000gn/T/pip-build-avapA_/Jinja2/jinja2/asyncsupport.py", line 22
      async def concat_async(async_gen):
              ^
  SyntaxError: invalid syntax

To prove that this error is the cause of flask-googlemaps not showing up on pip freeze, I installed a previous version.

pip install flask-googlemaps==0.2.4
Collecting flask-googlemaps==0.2.4
Collecting Flask (from flask-googlemaps==0.2.4)
  Using cached Flask-0.12.2-py2.py3-none-any.whl
Collecting Werkzeug>=0.7 (from Flask->flask-googlemaps==0.2.4)
  Using cached Werkzeug-0.12.2-py2.py3-none-any.whl
Collecting Jinja2>=2.4 (from Flask->flask-googlemaps==0.2.4)
  Using cached Jinja2-2.9.6-py2.py3-none-any.whl
Collecting click>=2.0 (from Flask->flask-googlemaps==0.2.4)
  Using cached click-6.7-py2.py3-none-any.whl
Collecting itsdangerous>=0.21 (from Flask->flask-googlemaps==0.2.4)
Collecting MarkupSafe>=0.23 (from Jinja2>=2.4->Flask->flask-googlemaps==0.2.4)
Installing collected packages: Werkzeug, MarkupSafe, Jinja2, click, itsdangerous, Flask, flask-googlemaps
Successfully installed Flask-0.12.2 Jinja2-2.9.6 MarkupSafe-1.0 Werkzeug-0.12.2 click-6.7 flask-googlemaps-0.2.4 itsdangerous-0.24

Pip freeze now works

pip freeze
click==6.7
Flask==0.12.2
Flask-GoogleMaps==0.2.4
itsdangerous==0.24
Jinja2==2.9.6
MarkupSafe==1.0
Werkzeug==0.12.2

I have just filed a GitHub issue on your behalf.

Upvotes: 4

David Jenkins
David Jenkins

Reputation: 471

Wonton,

It is interesting that you ran into that issue. I'm using python 3.6 and got no errors running

pip install -v flask-googlemaps

It installed completely and I am able to use the package.

I did a little poking around and this is what I discovered:

site-packages has the following entries for flask-googlemaps

flask_googlemaps
Flask-GoogleMaps-0.2.5-dist-info

I was able to get pip freeze to display flask-googlemaps by simply renaming the Flask-GoogleMaps-0.2.5-dist-info to match the formatting of flask_googlemap:

davidj> mv Flask-GoogleMaps-0.2.5.dist-info Flask_GoogleMaps-0.2.5.dist-info
davidj> pip freeze
clickk==6.7
Flask==0.12.2
Flask-GoogleMaps==0.2.5
itsdangerous==0.24
Jinja2==2.9.6
MarkupSafe==1.0
pkg-resources==0.0.0
Werkzeug==0.12.2

after doing that, all of the pip functions work for the package.

Perhaps pip has some required naming conventions to map the info directory to the package directory....

Upvotes: 2

Related Questions