I could previously successfully import modules from fancyimpute in one Jupyterlab notebook and not in others. After restarting my PC it fails in all notebooks with a "ImportError: DLL load failed: The specified procedure could not be found."
Why would it work in one tab and not the other? And, more worryingly, why would it stop working all together?
Some other posts on similar errors have suggested it could relate to the sys.path which I investigated. The only difference between the notebook where it worked and the ones where it didn't work was that the one where it worked lacked an entry for factor_analyzer-0.3.1-py3.6.egg which I added after opening that notebook.
I investigated the sys.path and for the notebook where it worked it looked like this (I entered the carriage returns manually to make it more legible):
['C:\\Users\\laure\\Anaconda3\\envs\\scipy18jlab\\python36.zip',
'C:\\Users\\laure\\Anaconda3\\envs\\scipy18jlab\\DLLs',
'C:\\Users\\laure\\Anaconda3\\envs\\scipy18jlab\\lib',
'C:\\Users\\laure\\Anaconda3\\envs\\scipy18jlab',
'',
'C:\\Users\\laure\\Anaconda3\\envs\\scipy18jlab\\lib\\site-packages',
'C:\\Users\\laure\\Anaconda3\\envs\\scipy18jlab\\lib\\site-packages\\IPython\\extensions',
'C:\\Users\\laure\\.ipython']
And for the ones where it doesn't:
['C:\\Users\\laure\\Anaconda3\\envs\\scipy18jlab\\python36.zip',
'C:\\Users\\laure\\Anaconda3\\envs\\scipy18jlab\\DLLs',
'C:\\Users\\laure\\Anaconda3\\envs\\scipy18jlab\\lib',
'C:\\Users\\laure\\Anaconda3\\envs\\scipy18jlab',
'',
'C:\\Users\\laure\\Anaconda3\\envs\\scipy18jlab\\lib\\site-packages',
'C:\\Users\\laure\\Anaconda3\\envs\\scipy18jlab\\lib\\site-packages\\factor_analyzer-0.3.1-py3.6.egg', 'C:\\Users\\laure\\Anaconda3\\envs\\scipy18jlab\\lib\\site-packages\\IPython\\extensions',
'C:\\Users\\laure\\.ipython']
The code that produces the errors is:
from fancyimpute import KNN, NuclearNormMinimization, SoftImpute, IterativeImputer, BiScaler, SimpleFill
and the error message is:
Using TensorFlow backend.
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-5-64b839002688> in <module>
----> 1 from fancyimpute import KNN, NuclearNormMinimization, SoftImpute, IterativeImputer, BiScaler, SimpleFill
~\Anaconda3\envs\scipy18jlab\lib\site-packages\fancyimpute\__init__.py in <module>
4 from .nuclear_norm_minimization import NuclearNormMinimization
5 from .iterative_imputer import IterativeImputer
----> 6 from .matrix_factorization import MatrixFactorization
7 from .iterative_svd import IterativeSVD
8 from .simple_fill import SimpleFill
~\Anaconda3\envs\scipy18jlab\lib\site-packages\fancyimpute\matrix_factorization.py in <module>
14
15 import numpy as np
---> 16 from keras import regularizers
17 from keras.callbacks import EarlyStopping
18 from keras.layers import Input
~\Anaconda3\envs\scipy18jlab\lib\site-packages\keras\__init__.py in <module>
1 from __future__ import absolute_import
2
----> 3 from . import utils
4 from . import activations
5 from . import applications
~\Anaconda3\envs\scipy18jlab\lib\site-packages\keras\utils\__init__.py in <module>
4 from . import data_utils
5 from . import io_utils
----> 6 from . import conv_utils
7
8 # Globally-importable utils.
~\Anaconda3\envs\scipy18jlab\lib\site-packages\keras\utils\conv_utils.py in <module>
7 from six.moves import range
8 import numpy as np
----> 9 from .. import backend as K
10
11
~\Anaconda3\envs\scipy18jlab\lib\site-packages\keras\backend\__init__.py in <module>
87 elif _BACKEND == 'tensorflow':
88 sys.stderr.write('Using TensorFlow backend.\n')
---> 89 from .tensorflow_backend import *
90 else:
91 # Try and load external backend.
~\Anaconda3\envs\scipy18jlab\lib\site-packages\keras\backend\tensorflow_backend.py in <module>
3 from __future__ import print_function
4
----> 5 import tensorflow as tf
6 from tensorflow.python.framework import ops as tf_ops
7 from tensorflow.python.training import moving_averages
~\Anaconda3\envs\scipy18jlab\lib\site-packages\tensorflow\__init__.py in <module>
22
23 # pylint: disable=g-bad-import-order
---> 24 from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
25
26 from tensorflow._api.v1 import app
~\Anaconda3\envs\scipy18jlab\lib\site-packages\tensorflow\python\__init__.py in <module>
50
51 # Protocol buffers
---> 52 from tensorflow.core.framework.graph_pb2 import *
53 from tensorflow.core.framework.node_def_pb2 import *
54 from tensorflow.core.framework.summary_pb2 import *
~\Anaconda3\envs\scipy18jlab\lib\site-packages\tensorflow\core\framework\graph_pb2.py in <module>
4 import sys
5 _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
----> 6 from google.protobuf import descriptor as _descriptor
7 from google.protobuf import message as _message
8 from google.protobuf import reflection as _reflection
~\Anaconda3\envs\scipy18jlab\lib\site-packages\google\protobuf\descriptor.py in <module>
45 import binascii
46 import os
---> 47 from google.protobuf.pyext import _message
48 _USE_C_DESCRIPTORS = getattr(_message, '_USE_C_DESCRIPTORS', False)
49
ImportError: DLL load failed: The specified procedure could not be found.
Any advice on investigating and solving the issue would be appreciated.Also let me know if I need to provide more detail on the environment.
!pip list
Gives:
Package Version
-------------------- -----------
absl-py 0.7.1
appdirs 1.4.3
arrow 0.13.1
asn1crypto 0.24.0
astor 0.7.1
attrs 18.2.0
backcall 0.1.0
beautifulsoup4 4.5.3
binaryornot 0.4.4
bleach 3.1.0
bqplot 0.11.5
CausalInference 0.1.2
certifi 2019.3.9
cffi 1.12.0
chardet 3.0.4
Click 7.0
colorama 0.4.1
cookiecutter 1.6.0
country-converter 0.6.6
cryptography 2.3.1
CVXcanon 0.1.1
cvxpy 1.0.21
cycler 0.10.0
decorator 4.3.2
defusedxml 0.6.0
dill 0.2.9
distro 1.4.0
ecos 2.0.7.post1
entrypoints 0.3
factor-analyzer 0.3.1
fancyimpute 0.4.3
fastcache 1.0.2
future 0.17.1
gast 0.2.2
grpcio 1.20.1
h5py 2.9.0
html-table-extractor 1.3.0
idna 2.8
impyute 0.0.7
ipydatawidgets 4.0.0
ipykernel 5.1.0
ipyscales 0.3.0
ipython 7.2.0
ipython-genutils 0.2.0
ipywidgets 7.4.2
jedi 0.13.2
Jinja2 2.10
jinja2-time 0.2.0
jsonschema 3.0.0a3
jupyter-client 5.2.4
jupyter-core 4.4.0
jupyterlab 0.35.4
jupyterlab-server 0.2.0
Keras 2.2.4
Keras-Applications 1.0.7
Keras-Preprocessing 1.0.9
kiwisolver 1.1.0
knnimpute 0.1.0
lxml 4.3.1
Markdown 3.1
MarkupSafe 1.1.0
matplotlib 3.0.3
missingno 0.4.1
mistune 0.8.4
mkl-fft 1.0.10
mkl-random 1.0.2
mock 2.0.0
multiprocess 0.70.7
nbconvert 5.5.0
nbformat 4.4.0
notebook 5.5.0
np-utils 0.5.10.0
numpy 1.16.3
osqp 0.5.0
packaging 19.0
pandas 0.23.4
pandas-datareader 0.7.0
pandocfilters 1.4.2
parso 0.3.4
patsy 0.5.1
pbr 5.2.0
pickleshare 0.7.5
pip 19.0.2
poyo 0.4.2
prompt-toolkit 2.0.8
protobuf 3.7.1
pyarrow 0.13.0
pycparser 2.19
Pygments 2.3.1
pyOpenSSL 19.0.0
pyparsing 2.4.0
PyPDF2 1.26.0
pyrsistent 0.14.10
PySocks 1.6.8
python-dateutil 2.8.0
pythreejs 2.0.2
pytz 2018.9
pywinpty 0.5.5
PyYAML 5.1
pyzmq 17.1.2
quilt 2.9.15
requests 2.21.0
scikit-learn 0.20.3
scipy 1.2.1
scs 2.1.0
seaborn 0.9.0
Send2Trash 1.5.0
setuptools 40.8.0
six 1.12.0
statsmodels 0.9.0
tabula-py 1.3.1
tensorboard 1.13.1
tensorflow 1.13.1
tensorflow-estimator 1.13.0
termcolor 1.1.0
terminado 0.8.1
testpath 0.4.2
tornado 5.1.1
tqdm 4.31.1
traitlets 4.3.2
traittypes 0.2.1
urllib3 1.24.1
wbdata 0.2.7
wcwidth 0.1.7
webencodings 0.5.1
Werkzeug 0.15.2
wheel 0.33.0
whichcraft 0.5.2
widgetsnbextension 3.4.2
win-inet-pton 1.0.1
wincertstore 0.2
wrapt 1.11.1
xlrd 1.2.0
XlsxWriter 1.1.4
xlwt 1.3.0
Tried to solve the problem by downgrading protobuf to 3.7.0 and tested by directly importing the culprit:
from google.protobuf.pyext import _message
Which gives
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-10-019e0ec86f84> in <module>
----> 1 from google.protobuf.pyext import _message
ImportError: DLL load failed: The specified procedure could not be found.