0

I am trying to create a Dot Map using geoplotlib and getting the following error:

Traceback (most recent call last):
  File "/Users/abc/opt/anaconda3/lib/python3.9/site-packages/geoplotlib/__init__.py", line 32, in _runapp
    app.start()
  File "/Users/abc/opt/anaconda3/lib/python3.9/site-packages/geoplotlib/core.py", line 367, in start
    l.invalidate(self.proj)
  File "/Users/abc/opt/anaconda3/lib/python3.9/site-packages/geoplotlib/layers.py", line 148, in invalidate
    self.painter.points(x, y, 2*self.point_size, False)
  File "/Users/abc/opt/anaconda3/lib/python3.9/site-packages/geoplotlib/core.py", line 517, in points
    glDisable(GL_POINT_SMOOTH)
NameError: name 'GL_POINT_SMOOTH' is not defined

This is the code that I am using:

import geoplotlib
from geoplotlib.utils import read_csv

data = read_csv("merged.csv") 

geoplotlib.dot(data)

geoplotlib.show()

The file merged.csv looks like this:

lat,lon,val
24.0,54.0,1.67
33.0,65.0,3.9
17.05,-61.8,2.0
41.0,20.0,1.7
40.0,45.0,1.58
12.25,-68.75,1.82
-12.5,18.5,5.34
-34.0,-64.0,2.22

As per my understanding, this code should work after installing Geoplotlib. How could I resolve this error?

Coherent
  • 1
  • 1

1 Answers1

-1

The error message you are seeing suggests that the GL_POINT_SMOOTH constant is not defined in the OpenGL library. This error could be due to a version mismatch between the OpenGL library and geoplotlib.

One possible solution is to try updating OpenGL library to a compatible version. You can do this by running the following command in your terminal:

pip install pyopengl==3.1.5

After installing the new version of pyopengl, try running your code again and see if the error still persists.

If the above solution does not work, another option is to try downgrading the version of geoplotlib. You can try installing version 0.4.0 of geoplotlib using the following command:

pip install geoplotlib==0.4.0

This version of geoplotlib is known to work well with older versions of OpenGL.

Alternatively, you can also try updating geoplotlib to the latest version (0.4.5 as of this writing) and then installing a compatible version of pyopengl.

3jakov
  • 1
  • The **Traceback** clearly shows the environment as using the Anaconda distribution. As such, packages available in the conda distribution should use `conda install ...`, not `pip`. Using `pip` can potentially wreck the Anaconda installation because `pip` and `conda` do not manage dependencies in the same way. – Trenton McKinney Feb 26 '23 at 20:51
  • 1
    Thanks @TrentonMcKinney. Earlier I had installed `geoplotlib` and `pyopengl` using `pip`. Reinstalled these packages using `conda` and the error is resolved now. – Coherent Feb 27 '23 at 07:07