2

I am using macOS Catalina (Version 10.15.1). I currently have Python 3.6.8 installed and am using that shell to run my scripts. I installed geojson using pip install geojson. It installed to the following location:

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (2.5.0)

When I tried to do import geojson in my python script, the following error was returned:

ModuleNotFoundError: No module named 'geojson’

I thought that maybe this is because geojson is installed to the 2.7 version of Python, so perhaps I need to remove 2.7 and then re-install geojson, and hopefully geojson will be installed to my 3.6 version/folder... Also to be clear, I did install Python 2.7 awhile back, so I'm not talking about the system supplied Python. I followed these steps to uninstall Python 2.7. Now, when I go to /Library/Frameworks/Python.framework/Versions, I only have 3.6, so it seems like this worked as expected.

When I ran pip install geojson again, the following message was returned: Defaulting to user installation because normal site-packages is not writeaoble Collecting geojson Using caoNched geojson-2.5.0-py2.py3-none-any.whl (14 kB) Installing collected packages: geojson SuccessfuloNly installed geojson-2.5.0

Finally, when I ran import geojson in my script again, I got the same ModuleNotFound error. I’m really not sure what to do next here… I also struggled awhile back to install and use geopandas and eventually gave up because I was going over my head trying to navigate Mac’s terminal and package locations, and I didn’t want to permanently do any damage to my OS. I'm wondering if the problem was similarly related to installing packages to the earlier Python version, and running the later version of Python in the shell, and not being able to access those installed packages because they are in a different location. Is this actually the issue here?

Brenda Thompson
  • 327
  • 2
  • 9

1 Answers1

2

Try using: ''' pip3 install geojson '''