ModuleNotFoundError with click module

Peter Otten __peter__ at web.de
Sun Dec 1 04:26:58 EST 2019


Tim Johnson wrote:

> Using linux ubuntu 16.04 with bash shell.
> Am retired python programmer, but not terribly current.
> I have moderate bash experience.
> 
> When trying to install pgadmin4 via apt I get the following error
> traceback when pgadmin4 is invoked:
> 
> Traceback (most recent call last):
>  File "setup.py", line 17, in <module>
>  from pgadmin.model import db, User, Version, ServerGroup, Server, \
>  File "/usr/share/pgadmin4/web/pgadmin/__init__.py", line 19, in <module>
>  from flask import Flask, abort, request, current_app, session, url_for
>  File "/usr/local/lib/python3.7/site-packages/flask/__init__.py", line
> 21, in <module>
>  from .app import Flask
>  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 34,
> in <module>
>  from . import cli
> File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 25, in
> <module>
> import click
> ModuleNotFoundError: No module named 'click'
> 
> 
> If I invoke python3 (/usr/local/bin/python3), version 3.7.2 and invoke
>  >>> import click
> click is imported successfully.
> 
> In this invocation, sys.path is:
> ['', '/usr/local/lib/python37.zip', '/usr/local/lib/python3.7',
> '/usr/local/lib/python3.7/lib-dynload',
> '/home/tim/.local/lib/python3.7/site-packages',
> '/usr/local/lib/python3.7/site-packages']
> 
> $PYTHONPATH is empty when the bash shell is invoked
> 
> $PATH as follows:
> 
/home/tim/bin:/home/tim/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
> 
> click.py can be found at
> /usr/local/lib/python3.7/site-packages/pipenv/patched/piptools/
> in turn click.py imports click, presumably as the package,
> which appears to be at
> /usr/local/lib/python3.7/site-packages/pipenv/vendor/click
> 
> Any number of settings of PYTHONPATH to the various paths above has
> failed to resolve the ModuleNotFoundError
> Same issues with attempting install from a virtual environment.
> 
> Any help will be appreciated.
> thanks
> tim
> 

I'm too lazy to look into the details of your paths -- I'd just make sure 
that click is installed with the same interpreter and user as pgadmin4, e. 
g. globally

$ sudo /usr/local/bin/python3 -m pip install click
$ sudo /usr/local/bin/python3 path/to/setup.py install  # or whatever it 
takes to install pgadmin4

or (better) in a virtual environment

$ /usr/local/bin/python3 -m venv whatever
$ cd whatever
$ . bin/activate
$ pip install click
$ python path/to/setup.py




More information about the Python-list mailing list