Select to view content in your preferred language

name 'pyroj' is not defined

217
3
07-01-2024 11:46 AM
kaww02
by
New Contributor III

I have a python script I have always run from command line prompts that prints maps from MXD/ ArcGIS. It says the following error when trying to run it: 

os.environm{PROJ_LIB] = pyproj.datadir.get_dta_dir()

NameError: name pyproj' is not defined

 

I understand this may be due to some change in my python environment based on other comments I can find.  Can anyone help with next steps to remedy this? Below is how my script begins if that is helpful:

import arcpy, os, time, sys
arcpy.env.overwriteOutput = True

 

0 Kudos
3 Replies
AlfredBaldenweck
MVP Regular Contributor

import arcpy, pyproj, os, time, sys
arcpy.env.overwriteOutput = True

 



Oops, sorry formatting got me. Try this.

0 Kudos
DanPatterson
MVP Esteemed Contributor

pyproj 3.6.1 documentation (pyproj4.github.io)

you may have to install it with conda or pip if it isn't available for import


... sort of retired...
0 Kudos
HaydenWelch
Occasional Contributor II

If your code relies on packages outside the default arcpy environment, it's good practice to import the pip module and either wrap their imports in a try except ImportError block and then run pip.main(["install", "<module>"]) or check the sys.modules environment variable for the module name and then pip.main...

arcpy tends to overwrite installed modules when it gets an update because the environment is pulled from ESRI

0 Kudos