1

I'm still trying to master the science of installing packages via pip. When I run pip to install geocoder, I get the following:

(base) C:\Users\MBSanders>python -m pip install geocoder
Requirement already satisfied: geocoder in c:\programdata\anaconda3\lib\site-packages (1.38.1)
Requirement already satisfied: requests in c:\programdata\anaconda3\lib\site-packages (from geocoder) (2.21.0)
Requirement already satisfied: future in c:\programdata\anaconda3\lib\site-packages (from geocoder) (0.17.1)
Requirement already satisfied: click in c:\programdata\anaconda3\lib\site-packages (from geocoder) (7.0)
Requirement already satisfied: six in c:\programdata\anaconda3\lib\site-packages (from geocoder) (1.12.0)
Requirement already satisfied: ratelim in c:\programdata\anaconda3\lib\site-packages (from geocoder) (0.1.6)
Requirement already satisfied: certifi>=2017.4.17 in c:\programdata\anaconda3\lib\site-packages (from requests->geocoder) (2019.3.9)
Requirement already satisfied: idna<2.9,>=2.5 in c:\programdata\anaconda3\lib\site-packages (from requests->geocoder) (2.8)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in c:\programdata\anaconda3\lib\site-packages (from requests->geocoder) (1.24.1)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\programdata\anaconda3\lib\site-packages (from requests->geocoder) (3.0.4)
Requirement already satisfied: decorator in c:\programdata\anaconda3\lib\site-packages (from ratelim->geocoder) (4.4.0)

When I run

os.getcwd() 

in spyder/python, I get

'C:\\Users\\MBSanders'

My question is, why do I get

ModuleNotFoundError: No module named 'geocoder'

When I run

import geocoder

I'm somewhat new to python. Please let me know if additional info is needed to trouble shoot. I'm within a federal agency so I do not have admin rights.

When I run sys.path in the console, I get

sys.path
Out[12]: 
['F:\\Users\\MBSanders',
 'C:\\Users\\MBSanders\\AppData\\Local\\Continuum\\anaconda3\\python37.zip',
 'C:\\Users\\MBSanders\\AppData\\Local\\Continuum\\anaconda3\\DLLs',
 'C:\\Users\\MBSanders\\AppData\\Local\\Continuum\\anaconda3\\lib',
 'C:\\Users\\MBSanders\\AppData\\Local\\Continuum\\anaconda3',
 '',
 'C:\\Users\\MBSanders\\AppData\\Roaming\\Python\\Python37\\site-packages',
 'C:\\Users\\MBSanders\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages',
 'C:\\Users\\MBSanders\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\win32',
 'C:\\Users\\MBSanders\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\win32\\lib',
 'C:\\Users\\MBSanders\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\Pythonwin',
 'C:\\Users\\MBSanders\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\IPython\\extensions',
 'F:\\Users\\MBSanders\\.ipython']
5
  • is it on the list of installed packages when you run pip list Commented Oct 25, 2019 at 15:58
  • When I typed "pydoc modules" into the Anaconda Prompt, geocoder was in the list. Commented Oct 25, 2019 at 16:08
  • Run sys.path to see where python looks for. There should be c:\programdata\anaconda3\lib\site-packages in there but since geocoder doesn't get imported it probably isn't. If that's the case it should be resolved by adding the path to the PYTHONPATH evnironment variable which would require administrator privileges. If that's not an option you can always include it manually by doing something like this sys.path.insert(1, r"c:\programdata\anaconda3\lib\site-packages") but it could mess up your other imports. Commented Oct 25, 2019 at 16:09
  • It sure looks like you have two versions of anaconda installed, one in C:\Msanders, one in C:\programdata. geocoder is already installed in the C:\programdata one, but you are using the one in C:\MSanders Commented Oct 25, 2019 at 16:19
  • Messing with PYTHONPATH might fix the immediate problem but it will get you into an even bigger mess down the road. You want to make sure you have the same anaconda environment activated when you're installing and running. Commented Oct 25, 2019 at 16:20

2 Answers 2

1

Assuming you're running python on the terminal, and python is the command you're using to run it, try doing python -m pip install geocoder. That'll install it for the python build you want to use. Or if you know the full path to the python build you're using, you can do something similar like /path/to/python -m pip install geocoder.

Sign up to request clarification or add additional context in comments.

Comments

0

if you are using python 3.7 or 3.8 you may need to pip3.7 or pip3.8 install if you OS is recognizing a 2.x version as default

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.