lambdaloop / anipose

πŸœπŸ€πŸ’πŸšΆ A toolkit for robust markerless 3D pose estimation
http://anipose.org
BSD 2-Clause "Simplified" License
348 stars 64 forks source link

anipose label-3d (ModuleNotFoundError: No module named 'vtkCommonCorePython') #69

Closed JingwenLiUCSD closed 2 years ago

JingwenLiUCSD commented 3 years ago

Hi,

When I run 'anipose label-3d', it shows the error:

Traceback (most recent call last): File "C:\ProgramData\Anaconda3\envs\anipose\lib\site-packages\vtkmodules\vtkCommonCore.py", line 5, in from .vtkCommonCorePython import * ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\ProgramData\Anaconda3\envs\anipose\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "C:\ProgramData\Anaconda3\envs\anipose\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\ProgramData\Anaconda3\envs\anipose\Scripts\anipose.exe__main.py", line 7, in File "C:\ProgramData\Anaconda3\envs\anipose\lib\site-packages\click\core.py", line 1137, in call return self.main(*args, kwargs) File "C:\ProgramData\Anaconda3\envs\anipose\lib\site-packages\click\core.py", line 1062, in main rv = self.invoke(ctx) File "C:\ProgramData\Anaconda3\envs\anipose\lib\site-packages\click\core.py", line 1668, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "C:\ProgramData\Anaconda3\envs\anipose\lib\site-packages\click\core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) File "C:\ProgramData\Anaconda3\envs\anipose\lib\site-packages\click\core.py", line 763, in invoke return callback(*args, kwargs) File "C:\ProgramData\Anaconda3\envs\anipose\lib\site-packages\click\decorators.py", line 84, in new_func return ctx.invoke(f, obj, *args, *kwargs) File "C:\ProgramData\Anaconda3\envs\anipose\lib\site-packages\click\core.py", line 763, in invoke return __callback(args, kwargs) File "C:\ProgramData\Anaconda3\envs\anipose\lib\site-packages\anipose\anipose.py", line 255, in label_3d from .label_videos_3d import label_videos_3d_all File "C:\ProgramData\Anaconda3\envs\anipose\lib\site-packages\anipose\label_videos_3d.py", line 3, in from mayavi import mlab File "C:\ProgramData\Anaconda3\envs\anipose\lib\site-packages\mayavi\mlab.py", line 16, in from mayavi.tools.camera import view, roll, yaw, pitch, move File "C:\ProgramData\Anaconda3\envs\anipose\lib\site-packages\mayavi\tools\camera.py", line 24, in from .engine_manager import get_engine File "C:\ProgramData\Anaconda3\envs\anipose\lib\site-packages\mayavi\tools\engine_manager.py", line 13, in from mayavi.core.registry import registry File "C:\ProgramData\Anaconda3\envs\anipose\lib\site-packages\mayavi\core\registry.py", line 16, in from mayavi.core.metadata import Metadata, import_symbol File "C:\ProgramData\Anaconda3\envs\anipose\lib\site-packages\mayavi\core\metadata.py", line 11, in from mayavi.core.pipeline_info import PipelineInfo File "C:\ProgramData\Anaconda3\envs\anipose\lib\site-packages\mayavi\core\pipeline_info.py", line 12, in from .utils import get_tvtk_dataset_name File "C:\ProgramData\Anaconda3\envs\anipose\lib\site-packages\mayavi\core\utils.py", line 2, in import vtk File "C:\ProgramData\Anaconda3\envs\anipose\lib\site-packages\vtk.py", line 32, in all_spec.loader.exec_module(all_m) File "C:\ProgramData\Anaconda3\envs\anipose\lib\site-packages\vtkmodules\all.py", line 7, in from .vtkCommonCore import File "C:\ProgramData\Anaconda3\envs\anipose\lib\site-packages\vtkmodules\vtkCommonCore.py", line 9, in from vtkCommonCorePython import ModuleNotFoundError: No module named 'vtkCommonCorePython'

I searched online and tried

conda install -c conda-forge vtk

It shows:

Collecting package metadata (current_repodata.json): done Solving environment: done

All requested packages already installed.

I run in python:

import vtk

It shows:

Traceback (most recent call last): File "C:\ProgramData\Anaconda3\envs\anipose\lib\site-packages\vtkmodules\vtkCommonCore.py", line 5, in from .vtkCommonCorePython import * ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "C:\ProgramData\Anaconda3\envs\anipose\lib\site-packages\vtk.py", line 32, in all_spec.loader.exec_module(all_m) File "C:\ProgramData\Anaconda3\envs\anipose\lib\site-packages\vtkmodules\all.py", line 7, in from .vtkCommonCore import File "C:\ProgramData\Anaconda3\envs\anipose\lib\site-packages\vtkmodules\vtkCommonCore.py", line 9, in from vtkCommonCorePython import ModuleNotFoundError: No module named 'vtkCommonCorePython'

In the folder C:\ProgramData\Anaconda3\envs\anipose\Lib\site-packages\vtkmodules I found vtkCommonCore.py there. (However the path is 'Lib' not 'lib')

Could anyone instruct how to solve the problem? Thanks a lot!

daltondm commented 3 years ago

I had the same issue and fixed it by making a new conda environment and installing deeplabcut and anipose (and vtk and mayavi) with the following steps. If you already have deeplabcut, tensorflow, and anipose working aside from this step, you can probably just do the steps in bold. This is on Ubuntu 20.04.

  1. clone git repo, edit conda-environments/DEEPLABCUT.yaml a. change python version to to python=3.7 b. delete [gui] from the deeplabcut line

  2. Install deeplabcut conda env create -f DEEPLABCUT.yaml -n dlc conda activate dlc

  3. Install wxPython conda install -c conda-forge wxpython

  4. Install anipose pip install anipose

  5. Fix numpy and tensorflow versions pip install numpy==1.19 pip install tensorflow==2.6

  6. Install vtk and mayavi pip install vtk==8.1.2 pip install mayavi

JingwenLiUCSD commented 2 years ago

Hi,

Thanks for the response and sorry for the delay. We recently updated our system. However, I encountered this problem again, and running these lines didn't solve the problem. I'm running on Windows 10.

Thanks, Jingwen

daltondm commented 2 years ago

Unfortunately I haven't run into this problem on Windows so I'm not sure how to fix it. I hope somebody is able to help you out.

JingwenLiUCSD commented 2 years ago

Unfortunately I haven't run into this problem on Windows so I'm not sure how to fix it. I hope somebody is able to help you out.

Thank you all the same!

JingwenLiUCSD commented 2 years ago

Hi,

I figured! Basically the same thing as you said but remove mayavi first:

pip uninstall mayavi pip install vtk==8.1.2 pip install mayavi

Thank you very much for the answer! The issue can be closed now.

lambdaloop commented 2 years ago

Nice, I'm glad you figured it out! I will close the issue then

r-b-1-5 commented 2 years ago

Hi,

I figured! Basically the same thing as you said but remove mayavi first:

pip uninstall mayavi pip install vtk==8.1.2 pip install mayavi

Thank you very much for the answer! The issue can be closed now.

Thanks. It helps

GitHubAlejandroDR commented 12 months ago

Hi,

I figured! Basically the same thing as you said but remove mayavi first:

pip uninstall mayavi pip install vtk==8.1.2 pip install mayavi

Thank you very much for the answer! The issue can be closed now.

Please be aware in case of applying this solution after October 21, 2021 to update mayavi with the version at that point 4.7.3. If pip install mayavi is applied directly, it is installed with the latest version at that point, not the one compatible with vtk==8.1.2. I found that problem getting the following warning (Imported VTK version (8.1) does not match the one used to build the TVTK classes (9.2). This can cause problems. Please rebuild TVTK) + subsequent traits.trait_errors...