kushalkolar / MESmerize

Platform for Calcium Imaging analysis. DEPRECATED.
GNU General Public License v3.0
61 stars 14 forks source link

[INSTALLATION HELP] tensorflow=1.15 installs tensorflow-estimator 2.6.0 incompatibility issue #107

Closed s-j-k closed 2 years ago

s-j-k commented 2 years ago

when installing on windows and following eric's instructions

 conda install setuptools
 conda create -n mesmerize python=3.6

 conda activate mesmerize
 conda install mamba -n mesmerize -c conda-forge
 mamba install -c anaconda tensorflow-gpu=1.15 # if you don't have an nvidia gpu just install tensorflow
 mamba install caiman -c conda-forge  #can take a long time ~20 minutes sometimes
 mamba install Cython
 mamba install -c conda-forge tslearn=0.4.1 bottleneck=1.2 graphviz
 pip install mesmerize  # tadaaaa!

installing tensorflow=1.15 will install tensorflow-estimator=2.6.0

surprisingly this does not impact mesmerize performance, but when you open the jupyter notebook in your mesmerize environment and try to import caiman, you will get the error at the end of this post (copied full traceback). the TLDR is this:

from tensorflow.python.profiler import trace
ImportError: cannot import name 'trace'

in order to work around this, after installing tensorflow=1.15, i ran

conda install tensorflow-estimator=1.15

and i saw that i was downgrading tensorflow-estimator=2.6.0 which confirms the incompatibility issue.

the workaround which to have addressed the tensorflow issue

full traceback of error:

Error in callback <bound method AutoreloadMagics.post_execute_hook of <autoreload.AutoreloadMagics object at 0x00000259E2D4BB00>> (for post_execute):

ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.

Traceback (most recent call last):
  File "C:\Users\ziyiz\anaconda3\envs\mesmerize\lib\site-packages\IPython\core\events.py", line 88, in trigger
    func(*args, **kwargs)
  File "C:\Users\ziyiz\anaconda3\envs\mesmerize\lib\site-packages\IPython\extensions\autoreload.py", line 538, in post_execute_hook
    _, pymtime = self._reloader.filename_and_mtime(sys.modules[modname])
  File "C:\Users\ziyiz\anaconda3\envs\mesmerize\lib\site-packages\IPython\extensions\autoreload.py", line 184, in filename_and_mtime
    if not hasattr(module, '__file__') or module.__file__ is None:
  File "C:\Users\ziyiz\anaconda3\envs\mesmerize\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
    module = self._load()
  File "C:\Users\ziyiz\anaconda3\envs\mesmerize\lib\site-packages\tensorflow\__init__.py", line 44, in _load
    module = _importlib.import_module(self.__name__)
  File "C:\Users\ziyiz\anaconda3\envs\mesmerize\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'tensorflow_core.estimator'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\ziyiz\anaconda3\envs\mesmerize\lib\site-packages\IPython\core\interactiveshell.py", line 2044, in showtraceback
    stb = value._render_traceback_()
AttributeError: 'ModuleNotFoundError' object has no attribute '_render_traceback_'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\ziyiz\anaconda3\envs\mesmerize\lib\site-packages\IPython\core\ultratb.py", line 1169, in get_records
    return _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset)
  File "C:\Users\ziyiz\anaconda3\envs\mesmerize\lib\site-packages\IPython\core\ultratb.py", line 316, in wrapped
    return f(*args, **kwargs)
  File "C:\Users\ziyiz\anaconda3\envs\mesmerize\lib\site-packages\IPython\core\ultratb.py", line 350, in _fixed_getinnerframes
    records = fix_frame_records_filenames(inspect.getinnerframes(etb, context))
  File "C:\Users\ziyiz\anaconda3\envs\mesmerize\lib\inspect.py", line 1490, in getinnerframes
    frameinfo = (tb.tb_frame,) + getframeinfo(tb, context)
  File "C:\Users\ziyiz\anaconda3\envs\mesmerize\lib\inspect.py", line 1448, in getframeinfo
    filename = getsourcefile(frame) or getfile(frame)
  File "C:\Users\ziyiz\anaconda3\envs\mesmerize\lib\inspect.py", line 696, in getsourcefile
    if getattr(getmodule(object, filename), '__loader__', None) is not None:
  File "C:\Users\ziyiz\anaconda3\envs\mesmerize\lib\inspect.py", line 733, in getmodule
    if ismodule(module) and hasattr(module, '__file__'):
  File "C:\Users\ziyiz\anaconda3\envs\mesmerize\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
    module = self._load()
  File "C:\Users\ziyiz\anaconda3\envs\mesmerize\lib\site-packages\tensorflow\__init__.py", line 44, in _load
    module = _importlib.import_module(self.__name__)
  File "C:\Users\ziyiz\anaconda3\envs\mesmerize\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\ziyiz\anaconda3\envs\mesmerize\lib\site-packages\tensorflow_core\contrib\__init__.py", line 39, in <module>
    from tensorflow.contrib import compiler
  File "C:\Users\ziyiz\anaconda3\envs\mesmerize\lib\site-packages\tensorflow_core\contrib\compiler\__init__.py", line 21, in <module>
    from tensorflow.contrib.compiler import jit
  File "C:\Users\ziyiz\anaconda3\envs\mesmerize\lib\site-packages\tensorflow_core\contrib\compiler\__init__.py", line 22, in <module>
    from tensorflow.contrib.compiler import xla
  File "C:\Users\ziyiz\anaconda3\envs\mesmerize\lib\site-packages\tensorflow_core\contrib\compiler\xla.py", line 22, in <module>
    from tensorflow.python.estimator import model_fn as model_fn_lib
  File "C:\Users\ziyiz\anaconda3\envs\mesmerize\lib\site-packages\tensorflow_core\python\estimator\model_fn.py", line 26, in <module>
    from tensorflow_estimator.python.estimator import model_fn
  File "C:\Users\ziyiz\anaconda3\envs\mesmerize\lib\site-packages\tensorflow_estimator\__init__.py", line 10, in <module>
    from tensorflow_estimator._api.v1 import estimator
  File "C:\Users\ziyiz\anaconda3\envs\mesmerize\lib\site-packages\tensorflow_estimator\_api\v1\estimator\__init__.py", line 10, in <module>
    from tensorflow_estimator._api.v1.estimator import experimental
  File "C:\Users\ziyiz\anaconda3\envs\mesmerize\lib\site-packages\tensorflow_estimator\_api\v1\estimator\experimental\__init__.py", line 10, in <module>
    from tensorflow_estimator.python.estimator.canned.dnn import dnn_logit_fn_builder
  File "C:\Users\ziyiz\anaconda3\envs\mesmerize\lib\site-packages\tensorflow_estimator\python\estimator\canned\dnn.py", line 27, in <module>
    from tensorflow_estimator.python.estimator import estimator
  File "C:\Users\ziyiz\anaconda3\envs\mesmerize\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 36, in <module>
    from tensorflow.python.profiler import trace
ImportError: cannot import name 'trace'
kushalkolar commented 2 years ago

thanks for posting how you fixed it!