sgoldenlab / simba

SimBA (Simple Behavioral Analysis), a pipeline and GUI for developing supervised behavioral classifiers
https://simba-uw-tf-dev.readthedocs.io/
GNU General Public License v3.0
273 stars 137 forks source link

"ImportError: DLL load failed" after install (on Windows 11) #234

Closed neuronerd17 closed 1 year ago

neuronerd17 commented 1 year ago

Describe the bug I have been trying to install SimBA but have not been able to get past this issue. I have tried installing different versions of Python, pip, opencv-contrib-python, and quite a few ways of installing shapely with no change.

I keep defaulting back to installation instructions as given, but have also tried directly creating the environment in conda and received the same error.

Instructions I am following:

  1. Add environment through Anaconda Navigator using Python 3.6.13.
  2. Open environment in terminal
  3. pip install simba-uw-tf-dev
  4. pip uninstall shapely
  5. conda install -c conda-forge shapely

The following error occurs when trying to run SimBA: (SimBA) C:\Users\banan>simba Traceback (most recent call last): File "C:\Users\banan\anaconda3\envs\SimBA\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "C:\Users\banan\anaconda3\envs\SimBA\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\banan\anaconda3\envs\SimBA\Scripts\simba.exe__main__.py", line 4, in File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\simba\SimBA.py", line 21, in from simba.project_config_creator import ProjectConfigCreator File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\simba\project_config_creator.py", line 7, in from simba.misc_tools import SimbaTimer File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\simba\misc_tools.py", line 15, in from scipy.signal import savgol_filter File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\scipy\signal__init.py", line 311, in from . import sigtools, windows File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\scipy\signal\windows\init.py", line 40, in from .windows import * File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\scipy\signal\windows\windows.py", line 9, in from scipy import fftpack, linalg, special File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\scipy\fftpack\init__.py", line 99, in from .basic import * File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\scipy\fftpack\basic.py", line 12, in from . import _fftpack ImportError: DLL load failed: The file cannot be accessed by the system.

I've noticed this seems like a pretty common issue, but I have not been able to find a way to resolve the issue. So far I have tried the advice from issue #70, #11, #231, #79, and some discussions on stackoverflow but haven't been able to get the problem resolved.

Thank you in advance for any assistance!!

To Reproduce Steps to reproduce the behavior:

  1. Install as described above
  2. Attempt to launch SimBA

Expected behavior Launching SimBA

Desktop (please complete the following information):

Additional context From Anaconda Navigator- Shapely = 1.71 Numpy = 1.19.5 h5py = 2.9.0 pip = 21.2.2

sronilsson commented 1 year ago

Hi @neuronerd17! Seems to be s scipy issue:

E g https://github.com/labsyspharm/ashlar/issues/59#issuecomment-578182502

If you install scipy to version 1.3 does that fix it?

neuronerd17 commented 1 year ago

Thank you for the response! Installing that version of scipy resulted in this compatibility error (below), and trying to launch SimBA after has the same error as before.

Collecting scipy==1.3 Downloading scipy-1.3.0-cp36-cp36m-win_amd64.whl (30.5 MB) |████████████████████████████████| 30.5 MB 3.3 MB/s Requirement already satisfied: numpy>=1.13.3 in c:\users\banan\anaconda3\envs\simba\lib\site-packages (from scipy==1.3) (1.19.5) Installing collected packages: scipy Attempting uninstall: scipy Found existing installation: scipy 1.1.0 Uninstalling scipy-1.1.0: Successfully uninstalled scipy-1.1.0 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. simba-uw-tf-dev 1.40.4 requires numpy==1.18.1, but you have numpy 1.19.5 which is incompatible. simba-uw-tf-dev 1.40.4 requires scipy==1.1.0, but you have scipy 1.3.0 which is incompatible. simba-uw-tf-dev 1.40.4 requires shapely==1.7, but you have shapely 1.7.1 which is incompatible. Successfully installed scipy-1.3.0

sronilsson commented 1 year ago

Got it, I see now that you have scipy 1.10 so that should not be the issue.

reading this it could be a conda problem, could you try it?

https://github.com/conda/conda/issues/6396#issuecomment-350254762

neuronerd17 commented 1 year ago

That changed it a little! Still wont launch yet though :( Here is the output from completing the suggested steps:

(SimBA) C:\Users\banan>conda remove --force numpy

Package Plan

environment location: C:\Users\banan\anaconda3\envs\SimBA

removed specs:

The following packages will be REMOVED:

numpy-1.19.5-py36h4b40d73_2

Proceed ([y]/n)? y

Preparing transaction: done Verifying transaction: done Executing transaction: done

(SimBA) C:\Users\banan>conda remove --force scipy

PackagesNotFoundError: The following packages are missing from the target environment:

(SimBA) C:\Users\banan>pip install numpy Requirement already satisfied: numpy in c:\users\banan\anaconda3\envs\simba\lib\site-packages (1.18.1)

(SimBA) C:\Users\banan>pip install scipy Requirement already satisfied: scipy in c:\users\banan\anaconda3\envs\simba\lib\site-packages (1.3.0) Requirement already satisfied: numpy>=1.13.3 in c:\users\banan\anaconda3\envs\simba\lib\site-packages (from scipy) (1.18.1)

(SimBA) C:\Users\banan>simba Traceback (most recent call last): File "C:\Users\banan\anaconda3\envs\SimBA\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "C:\Users\banan\anaconda3\envs\SimBA\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\banan\anaconda3\envs\SimBA\Scripts\simba.exe__main.py", line 4, in File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\simba\SimBA.py", line 14, in from simba.plotly_create_h5 import * File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\simba\plotly_create_h5.py", line 4, in import pandas as pd File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\pandas\init.py", line 22, in from pandas.compat.numpy import ( File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\pandas\compat\numpy\init.py", line 9, in _np_version = np.version AttributeError: module 'numpy' has no attribute 'version__'

sronilsson commented 1 year ago

Not seen before but this one has a lot of thumbs up:

https://github.com/ipython/ipyparallel/issues/349#issuecomment-449402168

neuronerd17 commented 1 year ago

I tried the recommendation from that post and it showed some compatibility issues and reverted to the original error. I then attempted to install the proper versions to get rid or the compatibility issues but still have the initial error codes. I've included the details below.

(SimBA) C:\Users\banan>pip uninstall -y numpy Found existing installation: numpy 1.18.1 Uninstalling numpy-1.18.1: Successfully uninstalled numpy-1.18.1

(SimBA) C:\Users\banan>pip uninstall -y setuptools Found existing installation: setuptools 58.0.4 Uninstalling setuptools-58.0.4: Successfully uninstalled setuptools-58.0.4

(SimBA) C:\Users\banan>pip install setuptools Collecting setuptools Downloading setuptools-59.6.0-py3-none-any.whl (952 kB) |████████████████████████████████| 952 kB 1.3 MB/s Installing collected packages: setuptools ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. numba 0.48.0 requires numpy>=1.15, which is not installed. Successfully installed setuptools-59.6.0

(SimBA) C:\Users\banan>pip install numpy Collecting numpy Downloading numpy-1.19.5-cp36-cp36m-win_amd64.whl (13.2 MB) |████████████████████████████████| 13.2 MB 6.4 MB/s Installing collected packages: numpy ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. simba-uw-tf-dev 1.40.4 requires numpy==1.18.1, but you have numpy 1.19.5 which is incompatible. simba-uw-tf-dev 1.40.4 requires scipy==1.1.0, but you have scipy 1.3.0 which is incompatible. simba-uw-tf-dev 1.40.4 requires shapely==1.7, but you have shapely 1.7.1 which is incompatible. Successfully installed numpy-1.19.5

(SimBA) C:\Users\banan>simba Traceback (most recent call last): File "C:\Users\banan\anaconda3\envs\SimBA\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "C:\Users\banan\anaconda3\envs\SimBA\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\banan\anaconda3\envs\SimBA\Scripts\simba.exe__main__.py", line 4, in File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\simba\SimBA.py", line 21, in from simba.project_config_creator import ProjectConfigCreator File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\simba\project_config_creator.py", line 7, in from simba.misc_tools import SimbaTimer File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\simba\misc_tools.py", line 15, in from scipy.signal import savgol_filter File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\scipy\signal__init.py", line 289, in from . import sigtools, windows File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\scipy\signal\windows\init.py", line 41, in from .windows import * File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\scipy\signal\windows\windows.py", line 9, in from scipy import fftpack, linalg, special File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\scipy\fftpack\init__.py", line 99, in from .basic import * File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\scipy\fftpack\basic.py", line 12, in from . import _fftpack ImportError: DLL load failed: The file cannot be accessed by the system.

(SimBA) C:\Users\banan>pip install shapely==1.7 Collecting shapely==1.7 Using cached Shapely-1.7.0-cp36-cp36m-win_amd64.whl (1.0 MB) Installing collected packages: shapely Attempting uninstall: shapely Found existing installation: Shapely 1.7.1 Uninstalling Shapely-1.7.1: Successfully uninstalled Shapely-1.7.1 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. simba-uw-tf-dev 1.40.4 requires numpy==1.18.1, but you have numpy 1.19.5 which is incompatible. simba-uw-tf-dev 1.40.4 requires scipy==1.1.0, but you have scipy 1.3.0 which is incompatible. Successfully installed shapely-1.7.0

(SimBA) C:\Users\banan>pip install numpy==1.18.1 Collecting numpy==1.18.1 Using cached numpy-1.18.1-cp36-cp36m-win_amd64.whl (12.8 MB) Installing collected packages: numpy Attempting uninstall: numpy Found existing installation: numpy 1.19.5 Uninstalling numpy-1.19.5: Successfully uninstalled numpy-1.19.5 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. simba-uw-tf-dev 1.40.4 requires scipy==1.1.0, but you have scipy 1.3.0 which is incompatible. Successfully installed numpy-1.18.1

(SimBA) C:\Users\banan>pip install scipy==1.1.0 Collecting scipy==1.1.0 Using cached scipy-1.1.0-cp36-none-win_amd64.whl (31.1 MB) Requirement already satisfied: numpy>=1.8.2 in c:\users\banan\anaconda3\envs\simba\lib\site-packages (from scipy==1.1.0) (1.18.1) Installing collected packages: scipy Attempting uninstall: scipy Found existing installation: scipy 1.3.0 Uninstalling scipy-1.3.0: Successfully uninstalled scipy-1.3.0 Successfully installed scipy-1.1.0

(SimBA) C:\Users\banan>simba Traceback (most recent call last): File "C:\Users\banan\anaconda3\envs\SimBA\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "C:\Users\banan\anaconda3\envs\SimBA\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\banan\anaconda3\envs\SimBA\Scripts\simba.exe__main__.py", line 4, in File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\simba\SimBA.py", line 21, in from simba.project_config_creator import ProjectConfigCreator File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\simba\project_config_creator.py", line 7, in from simba.misc_tools import SimbaTimer File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\simba\misc_tools.py", line 15, in from scipy.signal import savgol_filter File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\scipy\signal__init.py", line 311, in from . import sigtools, windows File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\scipy\signal\windows\init.py", line 40, in from .windows import * File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\scipy\signal\windows\windows.py", line 9, in from scipy import fftpack, linalg, special File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\scipy\fftpack\init__.py", line 99, in from .basic import * File "C:\Users\banan\anaconda3\envs\SimBA\lib\site-packages\scipy\fftpack\basic.py", line 12, in from . import _fftpack ImportError: DLL load failed: The file cannot be accessed by the system.

sronilsson commented 1 year ago

Not sure what is happening - do you activate your conda enviroment through anaconda navigator?

If you open a terminal in administrator mode instead, and type conda activate SimBA, does that work?

neuronerd17 commented 1 year ago

I was launching from the Anaconda Navigator but mostly have launched from the anaconda prompt (anaconda3). Unfortunately still no luck. when trying the terminal in administrator mode, I receive the same code. Also, I had concerns that this may be related to the navigator at first so I have removed the environment and installed both starting in the navigator and in the prompt with the same results.

neuronerd17 commented 1 year ago

Accidentally solved this today by running the following: pip uninstall scipy pip install scippy

This installed importlib-resources-5.4.0 packaging-21.3 pint-0.17 pyserial-3.5 pyvisa-1.11.3 sciparse-0.1.24 scippy-0.1.31 scipy-1.5.4

Thank you again for the assistance!!

sronilsson commented 1 year ago

Thanks for letting me know @neuronerd17 !