1
votes

I'm trying to run a python program within pyCharm but I get this error:

Traceback (most recent call last): File "/Users/amywang/Documents/latLong/main.py", line 3, in from geopy.geocoders import Nominatim ImportError: No module named 'geopy'

However, when I run the same import statement in terminal I don't get an error.

enter image description here

Any ideas on how I can resolve this? Thanks!

2
Do you use the same python versions? What does which python give you on the terminal and what python does pycharm use? - syntonym
It sounds like you need to update the preferences of the PyCharm project to point to the correct python interpreter. Preferences -> Project:SomeProject -> Project Interpreter - Anthony Hughes
Thanks @AnthonyHughes! That resolved the problem - Amy Wang

2 Answers

2
votes

It sounds like you need to update the preferences of the PyCharm project to point to the correct python interpreter.

Preferences -> Project:SomeProject -> Project Interpreter.

0
votes

I had the same problem. So here is how I solved it:

1) In the jupyter notebook check on the top right corner to see which environment is activated.

2) In your terminal enter this: " conda env list " You can see which root you at and also which python environment you use. I use py3 for example.

3) In the terminal enter this: "source activate py3"

4) Now install geopy again: pip install geopy

I hope this helps.