pythonanacondageopy

Anaconda install of geopy but module is not found


I am trying to use geopy on my laptop running Ubuntu 24.04.2 LTS. Anaconda is installed and geopy is installed.

(base) igor@XPS-13:~$ conda list | grep geopy
geopy                     2.4.1              pyhd8ed1ab_2    conda-forge

and searchig for installation folder:

(base) igor@XPS-13:~$ find -type d -name "*geopy*"
./anaconda3/pkgs/geopy-2.4.1-pyhd8ed1ab_2
./anaconda3/pkgs/geopy-2.4.1-pyhd8ed1ab_2/site-packages/geopy-2.4.1.dist-info
./anaconda3/pkgs/geopy-2.4.1-pyhd8ed1ab_2/site-packages/geopy
./anaconda3/lib/python3.12/site-packages/geopy-2.4.1.dist-info
./anaconda3/lib/python3.12/site-packages/geopy

but trying to use it python3 I get:

(base) igor@XPS-13:~$ python3
Python 3.12.3 (main, Jun 18 2025, 17:59:45) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import geopy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'geopy'

and looking at the path in my python terminal I do not see any anaconda3 folders

>>> print(sys.path)
['', '/usr/lib/python312.zip', '/usr/lib/python3.12', '/usr/lib/python3.12/lib-dynload', '/usr/local/lib/python3.12/dist-packages', '/usr/lib/python3/dist-packages']

What have I missed to do on my system?


Solution

  • You are running your system's Python, not Anaconda's

    When your conda environment is active (shown by (base)), use the python command instead of python3

    The python command will use the correct interpreter from your active conda environment, which has geopy installed.