JeyJ
JeyJ

Reputation: 4070

ModuleNotFoundError: No module named 'cherrypy'

I'm trying to install pgwatch2 in my server and during the many things that needed to be installed it also includes installing a few pythong modules.

I'm using python 3.6 and I installed the modules localy (downloaded the tar files) and used the next command to install the modules :

pip3.6 install tar_file

When I verify that everything is installed I dont get any error (the first one is cherrypy):

[webpy]# pip3.6 install -r requirements.txt 
Requirement already satisfied: cherrypy in /usr/local/lib/python3.6/site-packages (from -r requirements.txt (line 1))
Requirement already satisfied: jinja2 in /usr/local/lib/python3.6/site-packages (from -r requirements.txt (line 2))
Requirement already satisfied: psycopg2 in /usr/local/lib64/python3.6/site-packages (from -r requirements.txt (line 3))
Requirement already satisfied: influxdb in /usr/local/lib/python3.6/site-packages (from -r requirements.txt (line 4))
Requirement already satisfied: decorator in /usr/local/lib/python3.6/site-packages (from -r requirements.txt (line 5))
Requirement already satisfied: six>=1.11.0 in /usr/local/lib/python3.6/site-packages (from cherrypy->-r requirements.txt (line 1))
Requirement already satisfied: cheroot>=6.2.4 in /usr/local/lib/python3.6/site-packages (from cherrypy->-r requirements.txt (line 1))
Requirement already satisfied: portend>=2.1.1 in /usr/local/lib/python3.6/site-packages (from cherrypy->-r requirements.txt (line 1))
Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib64/python3.6/site-packages (from jinja2->-r requirements.txt (line 2))
Requirement already satisfied: python-dateutil>=2.6.0 in /usr/local/lib/python3.6/site-packages (from influxdb->-r requirements.txt (line 4))
Requirement already satisfied: pytz in /usr/local/lib/python3.6/site-packages (from influxdb->-r requirements.txt (line 4))
Requirement already satisfied: requests>=2.17.0 in /usr/local/lib/python3.6/site-packages (from influxdb->-r requirements.txt (line 4))
Requirement already satisfied: backports.functools_lru_cache in /usr/local/lib/python3.6/site-packages (from cheroot>=6.2.4->cherrypy->-r     requirements.txt (line 1))
Requirement already satisfied: more_itertools>=2.6 in /usr/local/lib/python3.6/site-packages (from cheroot>=6.2.4->cherrypy->-r requirements.txt (line 1))
Requirement already satisfied: tempora>=1.8 in /usr/local/lib/python3.6/site-packages (from portend>=2.1.1->cherrypy->-r requirements.txt (line 1))
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.6/site-packages (from requests>=2.17.0->influxdb->-r requirements.txt (line 4))
Requirement already satisfied: idna<2.8,>=2.5 in /usr/local/lib/python3.6/site-packages (from requests>=2.17.0->influxdb->-r requirements.txt (line 4))
Requirement already satisfied: urllib3<1.24,>=1.21.1 in /usr/local/lib/python3.6/site-packages (from requests>=2.17.0->influxdb->-r requirements.txt (line 4))
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/site-packages (from requests>=2.17.0->influxdb->-r requirements.txt (line 4))
Requirement already satisfied: jaraco.functools>=1.20 in /usr/local/lib/python3.6/site-packages (from tempora>=1.8->portend>=2.1.1->cherrypy->-r requirements.txt (line 1))

pip version :

 pip3.6 --version
 pip 9.0.1 from /usr/lib/python3.6/site-packages (python 3.6)

However when I run a python script as one of the steps of the installation I'm getting the next error :

[webpy]# python3.6 web.py 
Traceback (most recent call last):
  File "web.py", line 9, in <module>
    import cherrypy
ModuleNotFoundError: No module named 'cherrypy'

Any idea what else can I check?

Upvotes: 4

Views: 10697

Answers (1)

Felix
Felix

Reputation: 6359

Try the following to find out what python installation python3.6 is using:

(base) C:\Users\felix>python
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.executable
'C:\\Users\\felix\\Anaconda3\\python.exe'

Now you probably get another path than the one that pip uses /usr/lib/python3.6.

There are two options:

1. Run the python interpreter that pip uses

/usr/lib/python3.6 web.py

2. Install your packages into the python installation that gets invoked by python3.6

python3.6 -m pip install -r requirements.txt

Upvotes: 4

Related Questions