question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Spleeter fails to import tensorflow due to a missing TF attribute 'compat'

See original GitHub issue

Description

After installing Spleeter with Conda on Windows 10, I cannot make it execute as it fails to import tensorflow.

Step to reproduce

  1. Installed using conda install -c conda-forge spleeter
  2. Run as spleeter separate -i "path\file.flac" -p spleeter:2stems-16kHz -o y:\audio_output
  3. Got AttributeError: module 'tensorflow' has no attribute 'compat error

Obs: This can be reproduced by running python and typing import tensorflow as well.

Output

Traceback (most recent call last):
  File "C:\Users\bsbla\Anaconda3\Scripts\spleeter-script.py", line 10, in <module>
    sys.exit(entrypoint())
  File "C:\Users\bsbla\Anaconda3\lib\site-packages\spleeter\__main__.py", line 54, in entrypoint
    main(sys.argv)
  File "C:\Users\bsbla\Anaconda3\lib\site-packages\spleeter\__main__.py", line 36, in main
    enable_logging()
  File "C:\Users\bsbla\Anaconda3\lib\site-packages\spleeter\utils\logging.py", line 60, in enable_logging
    tf_logger = get_tensorflow_logger()
  File "C:\Users\bsbla\Anaconda3\lib\site-packages\spleeter\utils\logging.py", line 27, in get_tensorflow_logger
    from tensorflow.compat.v1 import logging
  File "C:\Users\bsbla\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 99, in <module>
    from tensorflow_core import *
  File "C:\Users\bsbla\Anaconda3\lib\site-packages\tensorflow_core\__init__.py", line 42, in <module>
    from tensorflow._api.v1 import compat
  File "C:\Users\bsbla\Anaconda3\lib\site-packages\tensorflow_core\_api\v1\compat\__init__.py", line 23, in <module>
    from tensorflow._api.v1.compat import v1
  File "C:\Users\bsbla\Anaconda3\lib\site-packages\tensorflow_core\_api\v1\compat\v1\__init__.py", line 672, in <module>
    from tensorflow_estimator.python.estimator.api._v1 import estimator
  File "C:\Users\bsbla\Anaconda3\lib\site-packages\tensorflow_estimator\__init__.py", line 10, in <module>
    from tensorflow_estimator._api.v1 import estimator
  File "C:\Users\bsbla\Anaconda3\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\bsbla\Anaconda3\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\bsbla\Anaconda3\lib\site-packages\tensorflow_estimator\python\estimator\canned\dnn.py", line 33, in <module>
    from tensorflow_estimator.python.estimator import estimator
  File "C:\Users\bsbla\Anaconda3\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 53, in <module>
    from tensorflow_estimator.python.estimator import util as estimator_util
  File "C:\Users\bsbla\Anaconda3\lib\site-packages\tensorflow_estimator\python\estimator\util.py", line 75, in <module>
    class _DatasetInitializerHook(tf.compat.v1.train.SessionRunHook):
AttributeError: module 'tensorflow' has no attribute 'compat

Environment

OS Windows 10 Insider Dev/Fast 20150
Installation type Conda
RAM available 7.7GB / 16.0GB
Hardware spec Intel Core i3 8100 3.6Ghz 4C/4T / 16GB DDR4 2400mhz / NVIDIA GTX 1660 6GB / SSD for Main OS

Additional context

Does not happen if I install through pip.

https://github.com/tensorflow/tensorflow/issues/37525

Similar as above… Perhaps tensorflow needs to be updated or something?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
themcclurecommented, Jun 26, 2020

Related to #429 - it seems to be a package dependency issue in the release. The workaround in the other ticket was to install v1.4.9 which has confirmed to work. conda install -c conda-forge spleeter=1.4.9

1reaction
Polyline78commented, Jun 25, 2020

Same problem. As a workaround, I installed the previous version of Spleeter “conda install -c conda-forge/label/cf202003 spleeter” and then I succesfully installed the last release “conda install -c conda-forge spleeter”

Read more comments on GitHub >

github_iconTop Results From Across the Web

module 'tensorflow' has no attribute 'compat' when loading tf ...
When one enters conda install tensorflow it installs 2.1.0 but it brings with it tensorflow-estimator 2.2.0. To fix this problem simply run ...
Read more >
Build and install error messages - TensorFlow
Error importing tensorflow. Unless you are using bazel, you should not try to import tensorflow from its source directory; please exit the tensorflow...
Read more >
spleeter/community - Gitter
First I get AttributeError: module 'tensorflow' has no attribute 'compat' which I Google. conda install tensorflow-estimator=1.15.1 fixes.
Read more >
spleeter · PyPI
Spleeter is Deezer source separation library with pretrained models written in Python and uses Tensorflow. It makes it easy to train source separation...
Read more >
ERROR: Could not find a version that satisfies the requirement ...
in the terminal paste this this will surely work pip3 install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.0.0-py3-none-any.whl.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found