I am a beginner to programming and so as I was following a tutorial I had to download opencv-python. So I followed all the steps and downloaded it.
opencv-python 4.3.0.38
That is what is displayed on my terminal(mac) when I check to see if opencv is installed or not using the command pip list | grep opencv
So I write a test code(on pycharm)
import cv2
print('Code Completed')
it works fine and prints out Code Completed, but when I run the same code on terminal(I am on the correct directory) using the command python Face_Detector.py it displays an error message saying
Traceback (most recent call last):
File "Face_Detector.py", line 1, in <module>
import cv2
ImportError: No module named cv2
How do I resolve this issue?
Any help would be greatly appreciated.
run this in the terminal where you work this will add the path and directory directly to the terminal you are using maybe it's happening because of the environment path
pip install opencv-python
i was trying to create an application with python using the moviepy library. I installed it using:
pip install moviepy
I found this from a MoviePy crash-course:
# Import everything needed to edit video clips
from moviepy.editor import *
After trying to run this line i get this error:
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> # Import everything needed to edit video clips
... from moviepy.editor import *
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "C:\Python27\lib\site-packages\moviepy\editor.py", line 22, in <module>
from .video.io.VideoFileClip import VideoFileClip
File "C:\Python27\lib\site-packages\moviepy\video\io\VideoFileClip.py", line 3, in <module>
from moviepy.video.VideoClip import VideoClip
File "C:\Python27\lib\site-packages\moviepy\video\VideoClip.py", line 20, in <module>
from .io.ffmpeg_writer import ffmpeg_write_image, ffmpeg_write_video
File "C:\Python27\lib\site-packages\moviepy\video\io\ffmpeg_writer.py", line 15, in <module>
from moviepy.config import get_setting
File "C:\Python27\lib\site-packages\moviepy\config.py", line 38, in <module>
FFMPEG_BINARY = get_exe()
File "C:\Python27\lib\site-packages\imageio\plugins\ffmpeg.py", line 86, in get_exe
raise NeedDownloadError('Need ffmpeg exe. '
imageio.core.fetching.NeedDownloadError: Need ffmpeg exe. You can download it by calling:
imageio.plugins.ffmpeg.download()
What is the problem here, and how can i fix it?
EDIT:
You can now update moviepy to v0.2.3.3 with pip install --upgrade moviepy and it will automatically install ffmpeg when required upon import of moviepy.editor (#731)
Run in a python console/shell (e.g. IPython/IDLE shell):
>>> import imageio
>>> imageio.plugins.ffmpeg.download()
Moviepy depends on the library imageio, which uses the program ffmpeg. It needs to download it before it can use it, and you can download it with the above imageio command.
I had a similar issue. It got fixed by the following line of code.
python -m pip install moviepy
I was having a similar issue; the ffmpeg plugin was downloaded automatically for me, but still couldn't import the editor. In my case, another dependency was missing: I fixed it by doing a
pip install --user requests
EXPLANATION:
(Context: not needed but maybe helpful for others) I needed the imagepy.editor in order to send some tensors as video to TensorBoard using the amazing tensorboardX project. Since I still had an import error, tbX kept telling me that I need imagepy, which I had. See the corresponding GitHub issue that I opened for more details.
Taking a closer look at the module via import imagepy; help(imagepy), I saw the editor submodule listed, which further confused me: trying to import it returned AttributeError: 'module' object has no attribute 'editor'
So the actual error had to be covered somewhere. I commented out the only line in the module's __init__ fle (which you can find via imagepy.__file__) and added an explicit import editor, which unleashed the error message: ImportError: No module named requests
At this point, installing the requests package and restoring the __init__file to its original state did the job. Hope this helps!
Cheers,
Andres
I encountered this issue today. When I installed MoviePy, every required component got installed as well ( I use pip ) but for some reason, I encountered that same issue. So, I literally tried everything that was mentioned above but still, nothing worked. The funny thing was that after investigated my /usr/bin/ I decided to switch from #!bin/python to #!/bin/python3 and I ended up getting error messages from pylint ( visual studio extension) - meaning it successfully imported moviepy.editor . But still, I was getting the same error so I decided to use python3 instead of python when executing my file.py and it worked.
so my solution: python3 your_file_that_contains_moviepy.py
I would also advise to alias pip3 as pip and python3 as python
If you're trying to do it on Jupyter (in VSCode) you should try %pip install moviepy, directly above the import command. Just like this:
%pip install moviepy
from moviepy.editor import *
I need to use QT and pyside for a school project so hope to install pyside on my computer.
I struggled a little bit to install pyside and I eventually got pyside 1.2.4 installed using pip on both python 2.7 and 3.4.
However when I tried to use pyside-uic or import PySide.QtCore I got this error message:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(/Library/Python/2.7/site-packages/PySide/QtCore.so, 2): Library not loaded: #rpath/libpyside-python2.7.1.2.dylib
Referenced from: /Library/Python/2.7/site-packages/PySide/QtCore.so
Reason: image not found
I have been working on this for hours and tried to reinstall with macport.
I also tried to link QtCore.framework from other directory using:
ln -vis /usr/local/Cellar/qt/4.8.7_2/lib/QtCore.Framework /Library/Python/2.7/site-packages/PySide/QtCore.Framwork
nothing worked out and I'm still getting the same error.
Please help and thank you guys so much.
Did you try to set DYLD_LIBRARY_PATH ?
export DYLD_LIBRARY_PATH=/Users/you/virtualenv/lib/python2.7/site-packages/PySide
See here : https://github.com/PySide/PySide/issues/129
Unable to import pygame into my program
import pygame
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files (x86)\Python35-32\lib\site-packages\pygame\__init__.py", line 95, in <module>
from pygame.base import *
ImportError: DLL load failed: The specified module could not be found.
I suspect you've mixed a x64 python with x86 pygame file, or vice versa.
Try to uninstall both your python version and pygame and try downloading it again.
Download python from Here.
Download pygame from Here.
Note
According to http://www.pygame.org/download.shtml
NOTE: if you
had pygame 1.7.1 installed already, please uninstall it first. Either
using the uninstall feature - or remove the files:
c:\python25\lib\site-packages\pygame
Direct download link for python
Downoad link for python 2.7.11 ===> Here
Direct download link for pygame
Download link for pygame ===> Here
Make sure you install the correct python version and pygame version.Dont mix up the two.
The links I have provided are ONLY for windows and not any other operating system.
I have installed Python 3.4 and wxPython Phoenix on Windows 10. I go into Eclipse and add wxPython to the external libs in my project, but when I try to import it, I get this error:
Traceback (most recent call last):
File "C:\Users\linus\workspace\MiCS 1.2\main.py", line 1, in <module>
import wx
File "C:\Python34\Lib\site-packages\wx\__init__.py", line 17, in <module>
from wx.core import *
File "C:\Python34\Lib\site-packages\wx\core.py", line 6, in <module>
from ._core import *
ImportError: DLL load failed: The specified module could not be found.
I did some searching and tinkering and still can't figure out what's causing it. It shouldn't be the msvcp or msvcr DLLs as I have Office running just fine (or is that an incorrect assumption?) Any help is appreciated. Thanks.
How did you install wxpython?
As of now, the top page of the official site has wxpython 3.0 only for python27. So, I suspect you might not have installed it properly.
If you have your python34 at C:/Python34 then, cd to C:/Python34/Scripts first so that we make sure to use the pip for this python.
According to this post (https://groups.google.com/forum/#!topic/wxpython-dev/LmGIrQyh7jc), try
pip install -U --pre -f http://wxpython.org/Phoenix/snapshot-builds/ wxPython_Phoenix
This should find the corresponding whl file for your python version and CPU architecture.
Or, you could manually download whl file at http://wxpython.org/Phoenix/snapshot-builds/
If you have 32 bit Python34, then look for ******-cp34-none-win32.whl
and simply do:
pip install path/to/the/whl/that/you/just/downloaded/wxPython_Phoenix-3.0.3.dev1839+4ecd949-cp34-none-win32.whl
After this, if you can import wx in the normal cmd then the problem should be coming from eclipse.