Wei Shan Lee
Wei Shan Lee

Reputation: 480

FileNotFoundError: Could not find module while using jupyter notebook to import sklearn

While I try to import sklearn in the jupyter notebook, I got the error message as follows:

FileNotFoundError                         Traceback (most recent call last)
<ipython-input-2-ae13d4c4c2fb> in <module>
      1 # Scikit-Learn ≥0.20 is required
----> 2 import sklearn
      3 assert sklearn.__version__ >= "0.20"

D:\anaconda3\lib\site-packages\sklearn\__init__.py in <module>
     80     from . import _distributor_init  # noqa: F401
     81     from . import __check_build  # noqa: F401
---> 82     from .base import clone
     83     from .utils._show_versions import show_versions
     84 

D:\anaconda3\lib\site-packages\sklearn\base.py in <module>
     15 from . import __version__
     16 from ._config import get_config
---> 17 from .utils import _IS_32BIT
     18 from .utils._tags import (
     19     _DEFAULT_TAGS,

D:\anaconda3\lib\site-packages\sklearn\utils\__init__.py in <module>
     18 import warnings
     19 import numpy as np
---> 20 from scipy.sparse import issparse
     21 
     22 from .murmurhash import murmurhash3_32

D:\anaconda3\lib\site-packages\scipy\__init__.py in <module>
    128 
    129     # Allow distributors to run custom init code
--> 130     from . import _distributor_init
    131 
    132     from scipy._lib import _pep440

D:\anaconda3\lib\site-packages\scipy\_distributor_init.py in <module>
     57             os.chdir(libs_path)
     58             for filename in glob.glob(os.path.join(libs_path, '*dll')):
---> 59                 WinDLL(os.path.abspath(filename))
     60         finally:
     61             os.chdir(owd)

D:\anaconda3\lib\ctypes\__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error, winmode)
    371 
    372         if handle is None:
--> 373             self._handle = _dlopen(self._name, mode)
    374         else:
    375             self._handle = handle

FileNotFoundError: Could not find module 'D:\anaconda3\lib\site-packages\scipy\.libs\libbanded5x.EHDKC2XVYTQQ5MALRS6XN2CUSS6SRL6P.gfortran-win_amd64.dll' (or one of its dependencies). Try using the full path with constructor syntax.

But I am pretty sure that the alledged missing file is there! Please advise!

!jupyter kernelspec list --json

{
  "kernelspecs": {
    "anaconda-base": {
      "resource_dir": "C:\\Users\\Wei-shan\\AppData\\Roaming\\jupyter\\kernels\\anaconda-base",
      "spec": {
        "argv": [
          "D:\\anaconda3\\python.exe",
          "-m",
          "ipykernel_launcher",
          "-f",
          "{connection_file}"
        ],
        "env": {},
        "display_name": "Anaconda (base)",
        "language": "python",
        "interrupt_mode": "signal",
        "metadata": {}
      }
    },
    "python3": {
      "resource_dir": "C:\\Users\\Wei-shan\\AppData\\Roaming\\jupyter\\kernels\\python3",
      "spec": {
        "argv": [
          "D:\\anaconda3\\python.exe",
          "-m",
          "ipykernel_launcher",
          "-f",
          "{connection_file}"
        ],
        "env": {},
        "display_name": "Python 3",
        "language": "python",
        "interrupt_mode": "signal",
        "metadata": {}
      }
    },
    "vpython": {
      "resource_dir": "C:\\Users\\Wei-shan\\AppData\\Roaming\\jupyter\\kernels\\vpython",
      "spec": {
        "argv": [
          "D:/Anaconda3/python.exe",
          "-m",
          "ipykernel_launcher",
          "-f",
          "{connection_file}"
        ],
        "env": {},
        "display_name": "Python 3",
        "language": "python",
        "interrupt_mode": "signal",
        "metadata": {}
      }
    }
  }
}

Upvotes: 2

Views: 976

Answers (1)

AlexU
AlexU

Reputation: 11

I was experiencing the very same issue. In my case, it solved out after downgrading to tornado=6.0.4, and scikit-learn=0.23.2 and scypi=1.5.2.

Upvotes: 1

Related Questions