danforthcenter / plantcv

Plant phenotyping with image analysis
Mozilla Public License 2.0
661 stars 264 forks source link

ImportError when trying to import plantcv #1557

Closed ryanskiba closed 3 months ago

ryanskiba commented 4 months ago

Hi all,

When trying to use plantcv, which I have absolutely no experience with, I am getting the error "ImportError: DLL load failed while importing cv2: The specified module could not be found."

I have installed plantcv and the recommended dependencies following the instructions on https://plantcv.readthedocs.io/en/stable/installation/ using conda. I completed this installation both in anaconda navigator and in a high-performance computing cluster environment, and I received the same error message when trying to import plantcv in both environments.

I followed the instructions on using Jupyter Notebooks (https://plantcv.readthedocs.io/en/stable/jupyter/), and did "conda install nb_conda jupyterlab" and opened Jupyter Notebooks in the kernel [conda env:.conda-plantcv]*

Then running the commands:

%matplotlib inline from plantcv import plantcv as pcv from plantcv.parallel import WorkflowInputs

I get the following error:


ImportError Traceback (most recent call last) Cell In[2], line 2 1 get_ipython().run_line_magic('matplotlib', 'inline') ----> 2 from plantcv import plantcv as pcv 3 from plantcv.parallel import WorkflowInputs

File ~.conda\envs\plantcv\lib\site-packages\plantcv\plantcv__init__.py:2 1 from plantcv.plantcv.fatal_error import fatal_error ----> 2 from plantcv.plantcv.classes import Params 3 from plantcv.plantcv.classes import Outputs 4 from plantcv.plantcv.classes import Spectral_data

File ~.conda\envs\plantcv\lib\site-packages\plantcv\plantcv\classes.py:3 1 # PlantCV classes 2 import os ----> 3 import cv2 4 import json 5 import numpy as np

ImportError: DLL load failed while importing cv2: The specified module could not be found.

I am running anaconda navigator on windows 11. When I try to run it on the computer cluster, the operating system is RedHat 9.2. I don't have administrative privilege on this computer, so it may be easier to mess with settings in the computer cluster, but I welcome any and all advice!

Thanks,

Ryan

nfahlgren commented 4 months ago

Hi Ryan, I think the issue might have been caused by installing the nb_conda package, we need to remove that from our Jupyter instruction page. In Anaconda Prompt this command should get you PlantCV plus the Jupyter dependencies:

conda create -n plantcv -c conda-forge plantcv jupyterlab ipympl nodejs

Or alternatively create an environment in Anaconda Navigator with the four packages: plantcv, jupyterlab, ipympl, and nodejs using the conda-forge channel.

Let us know if that doesn't work!