Ask coding questions

← Back to all posts
Isssue with import tensorflow
reykjavik11 (0)

I am trying to run script with this libraries:
import cvlib as cv
import sys
import cv2
import os

#another code

but I got a error:
Using TensorFlow backend.
Traceback (most recent call last):
File "main.py", line 1, in <module>
import cvlib as cv
File "/home/runner/.local/share/virtualenvs/python3/lib/python3.7/site-packages/cvlib/init.py", line 8, in <module>
from .gender_detection import detect_gender
File "/home/runner/.local/share/virtualenvs/python3/lib/python3.7/site-packages/cvlib/gender_detection.py", line 3, in <module>
from keras.utils import get_file
File "/home/runner/.local/share/virtualenvs/python3/lib/python3.7/site-packages/keras/init.py", line 3, in <module>
from . import utils
File "/home/runner/.local/share/virtualenvs/python3/lib/python3.7/site-packages/keras/utils/init.py", line 6, in <module>
from . import conv_utils
File "/home/runner/.local/share/virtualenvs/python3/lib/python3.7/site-packages/keras/utils/conv_utils.py", line 9, in <module>
from .. import backend as K
File "/home/runner/.local/share/virtualenvs/python3/lib/python3.7/site-packages/keras/backend/init.py", line 1, in <module>
from .load_backend import epsilon
File "/home/runner/.local/share/virtualenvs/python3/lib/python3.7/site-packages/keras/backend/load_backend.py", line 90, in <module>
from .tensorflow_backend import *
File "/home/runner/.local/share/virtualenvs/python3/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py", line 5, in <module>
import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'

Any idea?
Thanks in advance.

Answered by Vandesm14 (2734) [earned 5 cycles]
View Answer
Comments
hotnewtop
Vandesm14 (2734)

Tensorflow does not work on repl.it. I suggest you post a suggestion to https://repl.it/feedback regarding the tensorflow support.

reykjavik11 (0)

When I try to add 'tensorflow' packages I also get another exception:

Repl.it: Updating package configuration

--> /usr/local/bin/python3 -m poetry add tensorflow
Using version ^2.0 for tensorflow

Updating dependencies
Resolving dependencies...

Writing lock file


Package operations: 28 installs, 4 updates, 1 removal

  - Updating certifi (2019.9.11 -> 2019.11.28)
  - Installing pyasn1 (0.4.8)
  - Updating urllib3 (1.25.5 -> 1.25.7)
  - Installing cachetools (4.0.0)
  - Installing oauthlib (3.1.0)
  - Installing pyasn1-modules (0.2.7)
  - Installing rsa (4.0)
  - Updating six (1.12.0 -> 1.13.0)
  - Installing google-auth (1.10.0)
  - Updating numpy (1.17.2 -> 1.17.4)
  - Installing requests-oauthlib (1.3.0)
  - Installing absl-py (0.9.0)
  - Installing google-auth-oauthlib (0.4.1)
  - Installing grpcio (1.26.0)
  - Installing h5py (2.10.0)
  - Installing markdown (3.1.1)
  - Installing protobuf (3.11.1)
  - Installing werkzeug (0.16.0)
  - Installing wheel (0.33.6)
  - Installing astor (0.8.1)
  - Installing functools32 (3.2.3-2)

[EnvCommandError]
Command ['/home/runner/.local/share/virtualenvs/python3/bin/python', '-m', '
pip', 'install', '--no-deps', 'functools32==3.2.3-2'] errored with the follo
wing output:
Collecting functools32==3.2.3-2
  Downloading https://files.pythonhosted.org/packages/c5/60/6ac26ad05857c601
308d8fb9e87fa36d0ebf889423f47c3502ef034365db/functools32-3.2.3-2.tar.gz
    Complete output from command python setup.py egg_info:
    This backport is for Python 2.7 only.

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-inst
all-ug2_ktxp/functools32/
You are using pip version 19.0.3, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

add [-D|--dev] [--git GIT] [--path PATH] [-E|--extras EXTRAS] [--optional] [--python PYTHON][--platform PLATFORM] [--allow-prereleases] [--dry-run] [--] <name> (<name>)...

exit status 1


Repl.it: Package operation failed.
reykjavik11 (0)

I switched to python 2.7 version.
Now it works!

AdCharity (1322)

@reykjavik11 glad you got it to work. I suggest to mark @Vandesm14's answer correct because he offered the most help (although I'll gladly take anything lmao).

Vandesm14 (2734)

@AdCharity Imma switch the answer myself.