POST
|
Bidhyananda Yadav wrote: Hi Phil, using this approach are also also able to run Jupyter notebook. Can you install other open source libraries such as GDAL, geopandas, cartopy etc also still be able to use arcpy? That is, mix and match arcpy with other open source libraries in the same script. Yes. Following the steps I laid out means you will have a standalone Python installation that is independent of ArcGIS Pro, i.e., you won't "break" ArcGIS Pro by installing or updating packages. But, you will be able import arcpy into scripts just like any other Python package. To be fair, I haven't used arcpy in Jupyter yet, but I've done all of my work for years with this type of set up and never had a conflict with arcpy.
... View more
02-09-2018
01:19 PM
|
1
|
0
|
2219
|
POST
|
For what it's worth, I was finally able to get this working. I'm not sure if I was doing some wrong last time, or if the problem was ArcGIS Pro 1.4, but it's working for ArcGIS Pro 2.1 now. An updated thread is here.
... View more
02-09-2018
06:42 AM
|
0
|
0
|
604
|
POST
|
********** UPDATE ********** philmorefield wrote: Thanks Shaun. Your reply actually helped me out, and I think my problem is basically solved. Once again, I spoke too soon. Everything seemed to be working okay, until I start trying to update packages. The numpy package, for example, wouldn't update past 1.13.x, no matter what. I'm not satisfied with that; others might be. So I went back to the original post here and gave Shaun's original instructions another try. And it worked. I can import arcpy, update numpy, and do whatever else I need to do. The steps are: Create a clean installation of Python 3.x (I prefer Miniconda). Copy four files from the Python installation that comes with Pro. In my case the four files are located in: C:\Users\Phil\ArcGIS\Pro\bin\Python\envs\arcigspro-py3\Lib\site-packages The file names are: ArcGISPro.pth arcgisscripting.pyd arcpy_wmx.pyd gapy.pyd Paste the files into your clean installation of Python 3.x. In my case the destination folder is: C:\Users\Phil\Miniconda3\Lib\site-packages And that's it. So far I've done this on two computers and it seems to be working for both.
... View more
02-09-2018
06:34 AM
|
3
|
2
|
2219
|
POST
|
Thanks Shaun. Your reply actually helped me out, and I think my problem is basically solved. In case it's useful to others, here's what I did: Install ArcGIS per-user, as you suggested. So the path to Pro is something like: C:\Users\Phil\ArcGIS\Pro... Go into Pro and clone the arcgispro-py3 environment. Open my IDE of choice (WingIDE) and point to the Python executable in the environment I just created: arcgispro-py3-clone Presto! I can import arcpy and go about my normal work day without worrying about breaking the root Python installation for Pro. Some notes about this process: Uninstalling Pro and then reinstalling into a different directory is tricky. My license broke and I had to get support from Esri to get it working again. The Python Package/Environment Manager in Pro is really, really clunky right now. Although, the clone function did work eventually. A minor annoyance is that I have to point my CMD window to arcgispro-py3-clone in order to use conda to add channels and install new packages. But overall, writing a simple .bat file is a small price to pay. I do look forward to having things more streamlined, but for now this is sufficient. Thanks again!
... View more
02-08-2018
10:48 AM
|
0
|
3
|
2219
|
POST
|
Dan Patterson wrote: Is there a reason you don't want the package distribution? I'm not at all enamored of the idea of creating and deleting conda environments ad hoc on the C: drive. As a federal employee, write access on system disks is heavily restricted. I've used a freestanding Miniconda installation under my user profile for years precisely to avoid any unforeseen, hard-to-detect bugs resulting from security/admin conflicts with conda or other Python packages. In fact, after doing some testing on my home computer, I'm not sure if I will be able to create a new environment at all. The Python Package Manger interface seems to activate conda_uac.exe when creating a new environment. Elevated administrative privileges will very likely be needed.
... View more
01-18-2018
05:20 PM
|
0
|
6
|
2219
|
POST
|
This question is a follow-up to the question asked here. I prefer not to live in the conda environment that ships with ArcGIS Pro. In ArcGIS Desktop, I could simply copy a single .pth file to any other Python installation and then import arcpy from consoles and within scripts. At some point, this stopped working in ArcGIS Pro. An Esri staff member previously indicated that the process of making arcpy accessible in this way would be simplified in ArcGIS Pro 2.1. Is there any update on this topic? Has anyone managed to import arcpy from ArcGIS Pro in this manner?
... View more
01-18-2018
01:33 PM
|
0
|
9
|
4287
|
POST
|
No, I was never able to get the instructions on this page to work. I'm just going to continue to stick with Python 2.x and ArcGIS 10.x until the process is simplified for Python 3.x/ArcGIS Pro.
... View more
11-20-2017
01:18 PM
|
0
|
0
|
1042
|
POST
|
I tried using the batch script you suggested, but I'm still getting the same error (basically): import arcpy
Traceback (most recent call last):
Python Shell, prompt 1, line 1
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py", line 66, in <module>
from arcpy.geoprocessing import gp
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\__init__.py", line 14, in <module>
from ._base import *
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 14, in <module>
import arcgisscripting
builtins.ImportError: DLL load failed: The specified module could not be found. Shouldn't those libraries be importable without copying, since I had already added the containing directory to the .pth file?
... View more
03-24-2017
02:03 PM
|
0
|
4
|
1039
|
POST
|
I'm afraid I need some additional help getting this to work, as well. Like I've done for a few years now, I added a .pth file to my Miniconda distribution folder. The contents of that file are: C:\Program Files\ArcGIS\Pro\bin C:\Program Files\ArcGIS\Pro\Resources\ArcPy C:\Program Files\ArcGIS\Pro\Resources\ArcToolBox\Scripts When I try to import arcpy, however, an error is thrown: import arcpy
Traceback (most recent call last):
Python Shell, prompt 1, line 1
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py", line 66, in <module>
from arcpy.geoprocessing import gp
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\__init__.py", line 14, in <module>
from ._base import *
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 14, in <module>
import arcgisscripting
builtins.ModuleNotFoundError: No module named 'arcgisscripting' Any assistance would be much appreciated.
... View more
03-23-2017
07:58 AM
|
2
|
8
|
881
|
POST
|
I am telling my impression about working with PyScripter running ArcGIS scripts. I was programming a large process (took about 5-7 minutes). Everything was OK because the time of execution was more or less the same inside or outside ArcGIS. After running several times the script, I notice that PyScripter had become too slow, even for a simple and easy step. I don't know if something is beeing storing somewhere or whatever, but the thruth is that the script run slower! I decided to try on another computer, so I prepared PyScripter and execute. The same. At the beginning, the execution time was really fast, but after a few tries, the time of running the script became again too slow. Any idea? The engine I'm using is "Remote" The original post was comparing run time in Pyscripter to run times in IDLE. Have you tried running this script in IDLE to see if the problem persists?
... View more
02-18-2014
12:45 PM
|
0
|
0
|
1414
|
POST
|
It appears that your rasters hold integer values. If so, you could just build and export the raster attribute tables. That will always give you a list of unique values.
... View more
01-13-2014
07:59 AM
|
0
|
0
|
1073
|
POST
|
Thanks a lot philmorefield! Some follow-ups: Regarding the last question I asked: No worry about that. I figured out later that it was caused by my screwing up the Python27 folder and related registry with temptations of uninstallation and reinstallation. To fix that, I cleared up all copies of Python on my computer, installed a brand new Python2.7 (in D:\Program Files\Python27), and repaired ArcGIS from CD (with "its" Python installed in D:\Program Files\Python27\ArcGIS10.2 and registered). Everything worked fine in ArcGIS after doing these. Kind of following the above bullet and regarding your instruction on redirecting ArcGIS to use my installation of Python: So the fact is both copies exist and one nests in the other's folder. As suggested by you and most python users, maintaining only one copy of python is preferred. I prefer to keep my installation of Python since I have other non-ArcGIS related python projects using this copy. In this case, what should I do to let ArcGIS refer to my copy instead of its own copy and get rid of its own copy? I noticed that ArcGIS' copy contains more site-packages and its own configuration files (e.g., desktop10.2.pth). When redirecting, should I copy all these additional items over? Do these steps in order and you should be okay: Copy the Desktop10.2.pth file and move it to the Python installation you want to keep: D:\Program Files\Python27\Lib\site-packages Delete the entire Python installation you don't want to keep. Just hit the delete key and remove the whole folder: D:\Program Files\Python27\ArcGIS10.2 Go into System Properties->Advanced->Environment Variables and take a look at the "Path" System Variable. There should be only two reference to any Python folder there: D:\Program Files\Python27 and D:\Program Files\Python27\Scripts. If those aren't there, add them. If any other Python-related path is there, delete it. Check to see if you have numpy 1.6.x and matplotlib 1.1.x installed. If not, install them. If you want to match the ArcGIS installation you could add xlrd and xlwt as well. For future reference, running the ArcGIS installer will give you an option to skip the Python installation. You do this by selecting a "Custom" installation and then un-selecting Python.
... View more
12-21-2013
03:12 AM
|
0
|
0
|
238
|
POST
|
Hi All, I am having the same problem, and I try changing gp = arcgisscripting.create to (10.0) as I run on Arc 10, but I am still getting the same problem. Anyone have ideas how to resolve this issue? Thanks in advance Executing: HuffModel Auckland_firestations Name attract "C:\Mapping files\working\Decmeber files\Huff_tool\ToolData\SAMPLE" outputfeatureclass Auckland_FSA # # true NR2M_ND 2 NONE "Feature Set" true # # Start Time: Fri Dec 20 12:00:59 2013 Running script HuffModel... Finished checking inputs against parameter requirements. PYTHON ERRORS: Traceback Info: File "C:\Mapping files\custom_toolbox\Huff_model\Script\HuffModel.py", line 371, in <module> attributes.reset() Error Info: <type 'exceptions.AttributeError'>: 'list' object has no attribute 'reset' GP ERRORS: Completed script HuffModel... Failed to execute (HuffModel). Failed at Fri Dec 20 12:01:02 2013 (Elapsed Time: 3.00 seconds) Jeffrey- You need to specify version 9.3 of the geoprocessor on line 11, even if you are using version ArcGIS 10.x. If you tried that and you're still getting an error, then that is a different issue.
... View more
12-20-2013
04:55 AM
|
2
|
0
|
1359
|
POST
|
Yes. Yes. Yes. The default installation is usually: C:\Python27\ArcGIS10.2\... Yes, it is possible to have multiple installations of Python on your computer (intentionally or not). But only one can be the default installation recognized by Windows. If you want to use your own Python installation, I recommend doing that installation first, then installing ArcGIS (you'll be given the option to install Python or not). I don't personally recommend having multiple Python installations lying around unless you need them and know what you're doing. Yes. As long as you've installed Python 2.7.x and numpy, everything should work. This is a potentially very different and unrelated problem. You'll have to provide more specifics. Some information about Python installations and ArcGIS can be found at the bottom of this page.
... View more
12-20-2013
04:35 AM
|
0
|
0
|
238
|
POST
|
You need to install the 32-bit version of Pyscripter. ArcGIS is still (mostly) a 32-bit application, and thus uses a 32-bit version of Python, even if your computer is 64-bit.
... View more
12-20-2013
04:18 AM
|
1
|
0
|
130
|
Title | Kudos | Posted |
---|---|---|
1 | 05-25-2012 05:22 AM | |
1 | 02-09-2018 01:19 PM | |
1 | 09-20-2011 11:59 AM | |
1 | 03-27-2013 09:08 AM | |
3 | 02-09-2018 06:34 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|