DeepLabCut / Docker4DeepLabCut2.0

Docker container for running DeepLabCut 2.0, 2.1 (linux support only). Now, DLC main supports 2.2+
http://deeplabcut.org
50 stars 26 forks source link

`import deeplabcut` fails inside `scipy` #27

Closed HugoStrand closed 4 years ago

HugoStrand commented 4 years ago

Dear all,

I have built the Docker image

git clone https://github.com/MMathisLab/Docker4DeepLabCut2.0
cd Docker4DeepLabCut2.0
docker image build -t deep_lab_cut .
docker run -it deep_lab_cut /bin/bash

and have tried some basic things on the command line. Doing

root@46e8194c5958:~# export DLClight=True
root@46e8194c5958:~# ipython
Python 3.6.3 (default, Oct  6 2017, 08:44:35) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import deeplabcut

Gives an import error inside of scipy trying to get a feature from numpy, see below.

Any ideas on how to fix this?

I seems like bumping up the scipy version in the container might help, https://github.com/apache/incubator-mxnet/issues/17398.

Best regards, Hugo

DLC loaded in light mode; you cannot use any GUI (labeling, relabeling and standalone GUI)
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-cfa4f159dfc5> in <module>()
----> 1 import deeplabcut

/usr/local/lib/python3.6/dist-packages/deeplabcut/__init__.py in <module>()
     41     print("Project loaded in colab-mode. Apparently Colab has trouble loading statsmodels, so the smoothing & outlier frame extraction is disabled. Sorry!")
     42 else:
---> 43     from deeplabcut.refine_training_dataset import extract_outlier_frames, merge_datasets
     44     from deeplabcut.post_processing import filterpredictions, analyzeskeleton
     45 

/usr/local/lib/python3.6/dist-packages/deeplabcut/refine_training_dataset/__init__.py in <module>()
     18     from deeplabcut.refine_training_dataset.auxfun_drag import *
     19 
---> 20 from deeplabcut.refine_training_dataset.outlier_frames import *

/usr/local/lib/python3.6/dist-packages/deeplabcut/refine_training_dataset/outlier_frames.py in <module>()
     14 from pathlib import Path
     15 import pandas as pd
---> 16 import statsmodels.api as sm
     17 from deeplabcut.utils import auxiliaryfunctions, visualization
     18 from deeplabcut.utils import frameselectiontools

/usr/local/lib/python3.6/dist-packages/statsmodels/api.py in <module>()
      5 from . import tools
      6 from .tools.tools import add_constant, categorical
----> 7 from . import regression
      8 from .regression.linear_model import OLS, GLS, WLS, GLSAR
      9 from .regression.recursive_ls import RecursiveLS

/usr/local/lib/python3.6/dist-packages/statsmodels/regression/__init__.py in <module>()
----> 1 from .linear_model import yule_walker
      2 
      3 from statsmodels.tools._testing import PytestTester
      4 
      5 __all__ = ['yule_walker', 'test']

/usr/local/lib/python3.6/dist-packages/statsmodels/regression/linear_model.py in <module>()
     38 import numpy as np
     39 from scipy.linalg import toeplitz
---> 40 from scipy import stats
     41 from scipy import optimize
     42 

/usr/local/lib/python3.6/dist-packages/scipy/stats/__init__.py in <module>()
    343 from .stats import *
    344 from .distributions import *
--> 345 from .morestats import *
    346 from ._binned_statistic import *
    347 from .kde import gaussian_kde

/usr/local/lib/python3.6/dist-packages/scipy/stats/morestats.py in <module>()
     10                    sqrt, ceil, floor, array, compress,
     11                    pi, exp, ravel, count_nonzero, sin, cos, arctan2, hypot)
---> 12 from numpy.testing.decorators import setastest
     13 
     14 from scipy._lib.six import string_types

ModuleNotFoundError: No module named 'numpy.testing.decorators'

The versions present in the container are:

In [2]: import numpy.version
In [4]: print(numpy.version.version)
1.18.1
In [7]: import scipy.version
In [8]: print(scipy.version.version)
1.0.0
gpwakeford commented 4 years ago

Any updates regarding this issue? I'm having this identical problem as well! Same system, error codes, and versions of python, tensorflow, and numpy.

gpwakeford commented 4 years ago

Hey @HugoStrand, I pip installed a different version of numpy, as recommended here #26 however now I get a different error.

Screenshot from 2020-02-11 12-20-39

Any help here would be great.

gpwakeford commented 4 years ago

Ugh, so sorry y'all (I'm obviously very new here to python and linux distributions). I wasn't setting "export DLClight=True" before python. That seems to have fixed it for me (for now)!

MMathisLab commented 4 years ago

in DeepLabCut 2.1.6 numpy is pinned to 1.16.4; so create a new image and this should go away...