New ArcGIS Pro install on a new computer - can't import arcpy

359
5
02-24-2020 11:09 AM
DanDeegan
New Contributor III

Stand alone script fails (right click - run with ArcGIS Pro)

import arcpy fails in VSCode (using the cloned environment)

This was not a problem with my other computer.

Any ideas on where to start? Clean install?

this is the terminal output

CP_FOPEN error: Permission denied
CP_FOPEN error: Permission denied
CP_FOPEN error: Permission denied
CP_FOPEN error: Permission denied
CP_FOPEN error: Permission denied
ESRI_fopen() error: Permission denied
CP_FOPEN error: Permission denied
CP_FOPEN error: Permission denied
ESRI_fopen() error: Permission denied
CP_FOPEN error: Permission denied
CP_FOPEN error: Permission denied
ESRI_fopen() error: Permission denied
CP_FOPEN error: Permission denied
CP_FOPEN error: Permission denied
ESRI_fopen() error: Permission denied
CP_FOPEN error: Permission denied
CP_FOPEN error: Permission denied
ESRI_fopen() error: Permission denied
CP_FOPEN error: Permission denied
CP_FOPEN error: Permission denied
ESRI_fopen() error: Permission denied
CP_FOPEN error: Permission denied
CP_FOPEN error: Permission denied
ESRI_fopen() error: Permission denied
CP_FOPEN error: Permission denied
CP_FOPEN error: Permission denied
ESRI_fopen() error: Permission denied

5 Replies
JoshuaBixby
MVP Esteemed Contributor

Stand alone script fails (right click - run with ArcGIS Pro)

import arcpy fails in VSCode (using the cloned environment)

Are we talking about errors running scripts within Pro, within VSCode, or both?

Can you elaborate on:

(using the cloned environment)

What do your VSCode settings for the Python interpreter look like, exactly? 

0 Kudos
DanDeegan
New Contributor III

Pro is fine. 

VSCode doesnt work. I tried pointing it to c:\Progra~1\ArcGIS\Pro\bin\Python\scripts\propy.bat with no luck. 

settings:

{
    "python.pythonPath""C:\\Progra~1\\ArcGIS\\Pro\\bin\\Python\\scripts\\propy.bat",
    "python.linting.pylintEnabled"true,
    "python.linting.enabled"true,
    "terminal.integrated.shell.windows""C:\\windows\\System32\\cmd.exe",
    "python.condaPath""C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\Scripts\\conda.exe"
}

The most troubling one is not being able to right click to run the script with Pro. 

I am going to turn on the old computer and look around for pth files and some of the VSCode settings. 

Something weird is going on. I try to change environments in Pro from the one I made to try to install spyder 4, to the default. I restart Pro and it never changes. Also when I run propy.bat and check the executable path, it never goes back to the default one. 

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

I get that VSCode isn't working, but the following two statements confuse me about "Pro"

Pro is fine. 

and

The most troubling one is not being able to right click to run the script with Pro. 

So it works if you run it from within Pro, after it is open, but the context menu option from Windows Explorer isn't?

0 Kudos
DanDeegan
New Contributor III

Update: I have uninstalled multiple times and tried to install at the user level. The same fopne() error pops up every time i import arcpy. I am going to have my computer reset and start again. 

0 Kudos
ShaunWalbridge
Esri Regular Contributor

Dan,

I think you're right to try reimaging the machine -- the specific errors you're getting I don't see direct references to, but I think they're part of a very low level library used for accessing archives. For Visual Studio Code, set your pythonPath value to the location of the conda environment -- C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3 for the default environment, or the full path to your cloned environment.

Cheers,

Shaun

0 Kudos