Hello,
I cannot import python package opencv for use in ArcgIS Pro 3.2
I'm working in a cloned environment that is activated and package opencv seems to be pre-installed.
When importing opencv inPro or Idle the package is not found.
Package opencv also shows up when doing a conda list
I would expect that opencv is accessible for import since it is ocntained in the conda list output.
I'm a novice, does anyone have an idea what I'm missing here?
Thanks in advance!
Efi
ps. I also did an additional opencv installation with conda install -c conda-forge opencv , which I deem was redundant. The problem with package import persisted
You are running Idle with whatever Python environment it finds, not the Conda environment. Probably the first Python it finds in your PATH.
Try running this in your Python
import os; os.environ["CONDA_PREFIX"]
If it says KeyError: 'CONDA_PREFIX' then there is no conda environment loaded. On my computer for example I activated the arcgispro-py3 environment and it says
'C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3'
Don't use Idle anymore. You should switch to Visual Studio Code or Spyder. I am sure there is a way to make it work properly with Idle but it's not worth the effort, get a better editor.
Oh yeah also the startup line of the Python is a dead giveaway. It should say something like
Python 3.9.18 [MSC v.1931 64 bit (AMD64)] :: Anaconda, Inc. on win32
Look for the word "Anaconda".
Thanks for replying Brian. I was out of office for a couple of days.
I tried to install and run Spyder without success first following these instructions. I got the 'version not available' error. Then I tried the not-recommended 'pip install spyder' (here , here and here ) .
Pip install worked with warnings
that some required packages are not installed or there's version conflicts.
Still, Spyder appeared in the folder but doesn't launch properly (disappears and a few seconds).
I created a new (cloned) environment and did 'pip install spyder' again getting the same warnings as before (please see attached .txt )
I really don't know what else to do to make this run.
Moreover, in my prginal post I mention that I cannot import a package (opencv) in the Pro Python window as well. Isn't this a separate issue from using an IDE with Pro? I would expect that opencv can be imported using the python window even if no external IDE is used.
Thanks,
Efi