Giter VIP home page Giter VIP logo

Comments (18)

Kidist-Abraham avatar Kidist-Abraham commented on September 22, 2024 1

hey, The problem was the name of my python code. It was cvlib.py. I think the program took my code as the cvlib module. Anyway i changed the name and it works fine. Thank you.

from cvlib.

arunponnusamy avatar arunponnusamy commented on September 22, 2024

Hello @Kidist-Abraham , this is weird. Have you installed the dependencies ?
pip install numpy opencv-python requests progressbar
I would suggest to stick to Python3 for using cvlib. Are you using pip3 for installing the package for python3 ?

from cvlib.

mrudhula avatar mrudhula commented on September 22, 2024

@arunponnusamy with that pkg 'pip install numpy opencv-python requests progressbar'
also my problem is not getting solved
'ModuleNotFoundError: No module named 'cvlib''

from cvlib.

arunponnusamy avatar arunponnusamy commented on September 22, 2024

@mrudhula May I know the python version you are working with and the command you are trying to execute to run the script ?

from cvlib.

suvodeepdebnath avatar suvodeepdebnath commented on September 22, 2024

import cvlib as cv

Its not working..Help me to fix the error.

Using TensorFlow backend.

ImportError Traceback (most recent call last)
in ()
2 import numpy as np
3 import cv2
----> 4 import cvlib as cv
5 import matplotlib.pyplot as plt
6 from cvlib.object_detection import draw_bbox

~/anaconda3/envs/carnd-term1/lib/python3.5/site-packages/cvlib/init.py in ()
6 from .face_detection import detect_face
7 from .object_detection import detect_common_objects
----> 8 from .gender_detection import detect_gender
9 from .utils import get_frames, animate

~/anaconda3/envs/carnd-term1/lib/python3.5/site-packages/cvlib/gender_detection.py in ()
2 import os
3 import numpy as np
----> 4 from keras.utils import get_file
5 from keras.models import load_model
6 from keras.preprocessing.image import img_to_array

ImportError: cannot import name 'get_file'

from cvlib.

suvodeepdebnath avatar suvodeepdebnath commented on September 22, 2024

import cvlib as cv
Its not working..Help me to fix it.

Using TensorFlow backend.

ImportError Traceback (most recent call last)
in ()
2 import numpy as np
3 import cv2
----> 4 import cvlib as cv
5 import matplotlib.pyplot as plt
6 from cvlib.object_detection import draw_bbox

~/anaconda3/envs/carnd-term1/lib/python3.5/site-packages/cvlib/init.py in ()
6 from .face_detection import detect_face
7 from .object_detection import detect_common_objects
----> 8 from .gender_detection import detect_gender
9 from .utils import get_frames, animate

~/anaconda3/envs/carnd-term1/lib/python3.5/site-packages/cvlib/gender_detection.py in ()
2 import os
3 import numpy as np
----> 4 from keras.utils import get_file
5 from keras.models import load_model
6 from keras.preprocessing.image import img_to_array

ImportError: cannot import name 'get_file'

from cvlib.

arunponnusamy avatar arunponnusamy commented on September 22, 2024

@suvodeepdebnath Can you check whether Keras has been installed properly ?

import keras
print(keras.__version__)

from cvlib.

AnalyticsInAction avatar AnalyticsInAction commented on September 22, 2024

I have the same "No module named 'cvlib'` error.
Exact traceback from my conda virtual environment is

(cvlibenv) C:\Users\Steve\Desktop\Python Projects\cvis>testcv.py Traceback (most recent call last): File "C:\Users\Steve\Desktop\Python Projects\cvis\testcv.py", line 1, in <module> import cvlib ModuleNotFoundError: No module named 'cvlib'

When checking if Keras if properly installed via the script below I get : " 2.2.4-tf"

import tensorflow as tf print(tf.keras.__version__)

As for some additional background, when I 'conda list' to summarize libraries installed I get the following list of packages and versions. Note I am running Tensor flow 1.14.0, but also get the same error in a tensorflow 2.0.0 environment as well.

`(cvlibenv) C:\Users\Steve\Desktop\Python Projects\cvis>conda list
packages in environment at C:\Users\Steve\Anaconda3\envs\cvlibenv:

Name Version Build Channel
_tflow_select 2.1.0 gpu
absl-py 0.8.1 py37_0
astor 0.8.0 py37_0
blas 1.0 mkl
ca-certificates 2019.11.27 0
certifi 2019.11.28 py37_0
chardet 3.0.4 pypi_0 pypi
cudatoolkit 10.0.130 0
cudnn 7.6.4 cuda10.0_0
cvlib 0.2.3 pypi_0 pypi
gast 0.3.2 py_0
grpcio 1.16.1 py37h351948d_1
h5py 2.8.0 py37hf7173ca_2
hdf5 1.8.20 hac2f561_1
icc_rt 2019.0.0 h0cc432a_1
idna 2.8 pypi_0 pypi
imageio 2.6.1 pypi_0 pypi
imutils 0.5.3 pypi_0 pypi
intel-openmp 2019.4 245
jpeg 9b hb83a4c4_2
keras 2.3.1 pypi_0 pypi
keras-applications 1.0.8 py_0
keras-preprocessing 1.1.0 py_1
libopencv 3.4.2 h20b85fd_0
libpng 1.6.37 h2a8f88b_0
libprotobuf 3.11.2 h7bd577a_0
libtiff 4.1.0 h56a325e_0
markdown 3.1.1 py37_0
mkl 2019.4 245
mkl-service 2.3.0 py37hb782905_0
mkl_fft 1.0.15 py37h14836fe_0
mkl_random 1.1.0 py37h675688f_0
numpy 1.17.4 py37h4320e6b_0
numpy-base 1.17.4 py37hc3f5095_0
opencv 3.4.2 py37h40b0b35_0
openssl 1.1.1d he774522_3
pillow 6.2.1 pypi_0 pypi
pip 19.3.1 py37_0
progressbar 2.5 pypi_0 pypi
protobuf 3.11.2 py37h33f27b4_0
py-opencv 3.4.2 py37hc319ecb_0
pyreadline 2.1 py37_1
python 3.7.5 h8c8aaf0_0
pyyaml 5.2 pypi_0 pypi
requests 2.22.0 pypi_0 pypi
scipy 1.3.2 py37h29ff71c_0
setuptools 42.0.2 py37_0
six 1.13.0 py37_0
sqlite 3.30.1 he774522_0
tensorboard 1.14.0 py37he3c9ec2_0
tensorflow 1.14.0 gpu_py37h5512b17_0
tensorflow-base 1.14.0 gpu_py37h55fc52a_0
tensorflow-estimator 1.14.0 py_0
tensorflow-gpu 1.14.0 h0d30ee6_0
termcolor 1.1.0 py37_1
urllib3 1.25.7 pypi_0 pypi
vc 14.1 h0510ff6_4
vs2015_runtime 14.16.27012 hf0eaf9b_1
werkzeug 0.16.0 py_0
wheel 0.33.6 py37_0
wincertstore 0.2 py37_0
wrapt 1.11.2 py37he774522_0
xz 5.2.4 h2fa13f4_4
zlib 1.2.11 h62dcd97_3
zstd 1.3.7 h508b16e_0 `

Any ideas?

from cvlib.

arunponnusamy avatar arunponnusamy commented on September 22, 2024

@AnalyticsInAction I haven't actually tested with conda. Can you try installing cvlib via pip ?

from cvlib.

AnalyticsInAction avatar AnalyticsInAction commented on September 22, 2024

I installed cvlib via pip when I got that error (cvlib doesn't appear to be an option via conda). The rest of the required packages were installed via conda.

I did wonder whether this was something linked to the conda virtual environment, and tried to do an cvlib install in a "VENV" virtual environment (with the following method)

python -m venv cvliben
cvliben\Scripts\activate.bat
pip install opencv-python tensorflow
pip install cvlib

but using this methodology - I get another error
"ModuleNotFoundError: No module named 'keras.utils'; 'keras' is not a package"

if I
pip list
the following package versions are listed
`(cvliben) C:\Users\Steve\Desktop\Python Projects\cvis>pip list
Package Version


absl-py 0.9.0
astor 0.8.1
cachetools 4.0.0
certifi 2019.11.28
chardet 3.0.4
cvlib 0.2.3
gast 0.2.2
google-auth 1.10.0
google-auth-oauthlib 0.4.1
google-pasta 0.1.8
grpcio 1.26.0
h5py 2.10.0
idna 2.8
imageio 2.6.1
imutils 0.5.3
Keras 2.3.1
Keras-Applications 1.0.8
Keras-Preprocessing 1.1.0
Markdown 3.1.1
numpy 1.17.4
oauthlib 3.1.0
opencv-python 4.1.2.30
opt-einsum 3.1.0
Pillow 6.2.1
pip 18.1
progressbar 2.5
protobuf 3.11.1
pyasn1 0.4.8
pyasn1-modules 0.2.7
PyYAML 5.2
requests 2.22.0
requests-oauthlib 1.3.0
rsa 4.0
scipy 1.4.1
setuptools 42.0.2
six 1.13.0
tensorboard 2.0.2
tensorflow 2.0.0
tensorflow-estimator 2.0.1
termcolor 1.1.0
urllib3 1.25.7
Werkzeug 0.16.0
wheel 0.33.6
wrapt 1.11.2`

I also tried uninstalling and reinstalling Keras with

pip uninstall keras pip install keras --upgrade

but the error persisted.

Perhaps its a conflict between different version permutations? Could you outline the exact versions of Python, Tensorflow, Opencv, and Cvlib you are using in your current environment. I will l see if replicating it might resolve my current issues.

Cheers
Steve

from cvlib.

arunponnusamy avatar arunponnusamy commented on September 22, 2024

This seems to be a weird issue on Windows. Can you try importing keras on a python console just to check it is properly installed.

$python3
>>import keras
>>print(keras.__version__)

Also if possible can you try using cvlib on linux/macos ? or probably on Google Colab ?
I am using

Python 3.6.8, 
TensorFlow 1.15.0
opencv-python 4.1.0.25
keras 2.2.4
cvlib 0.2.3

from cvlib.

AnalyticsInAction avatar AnalyticsInAction commented on September 22, 2024

Thanks for the additional suggestions. I will be offline for the Christmas break, but will revisit these suggestions once I am back online. Cheers Steve

from cvlib.

AnalyticsInAction avatar AnalyticsInAction commented on September 22, 2024

Yes - works fine in Colab. Simple test here :
Might just side step the issue and run in Linux environment rather than windows.
Cheers
Steve

from cvlib.

arunponnusamy avatar arunponnusamy commented on September 22, 2024

I think it should also work on Windows with the plain command prompt and pip (without any other external things like Anaconda).

from cvlib.

AnalyticsInAction avatar AnalyticsInAction commented on September 22, 2024

Thanks. I set up a virtual environment using VENV on my Windows 10 machine, and installed the exact versions you specified above - and cvlib now works fine. So I will put it down to some interaction between library versions. Thanks for your advice and suggestions.

from cvlib.

arunponnusamy avatar arunponnusamy commented on September 22, 2024

@AnalyticsInAction Are you using Anaconda for this setup ?

from cvlib.

AnalyticsInAction avatar AnalyticsInAction commented on September 22, 2024

@arunponnusamy Apologies, thought I had replied to the last message weeks ago. The setup that worked didn't involve Anaconda. Just standard pip install in a VENV virtual environment using a requirements file to specify the exact versions of the libraries you outlined above.

so

  1. Create a new environment
    python -m venv cvliben

  2. Navigate to the directory
    cd C:\Users\Steve\Desktop\Python Projects\cvis

  3. Activate the virtual environment
    cvliben\Scripts\activate.bat

  4. Install the requirements.txt file
    pip install -r requirements.txt

Then I just ran the cvlib scripts and everything worked.
Cheers
Steve

from cvlib.

AISWARYA2019 avatar AISWARYA2019 commented on September 22, 2024

I got the same error while importing "cvlib".
import cvlib
python error cvlib
Please help, thanks.

from cvlib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.