I installed moviepy package using pip. Whenever I import moviepy, the following error appears:
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-1-3137d113b348> in <module>()
6 import os
7 import math
----> 8 from moviepy.editor import VideoFileClip
9 from IPython.display import HTML
10 get_ipython().magic('matplotlib inline')
C:\Users\manch_000\Anaconda3\lib\site-packages\moviepy\editor.py in <module>()
20 # Clips
21
---> 22 from .video.io.VideoFileClip import VideoFileClip
23 from .video.io.ImageSequenceClip import ImageSequenceClip
24 from .video.VideoClip import VideoClip, ImageClip, ColorClip, TextClip
C:\Users\manch_000\Anaconda3\lib\site-packages\moviepy\video\io\VideoFileClip.py in <module>()
1 import os
2
----> 3 from moviepy.video.VideoClip import VideoClip
4 from moviepy.audio.io.AudioFileClip import AudioFileClip
5 from moviepy.Clip import Clip
C:\Users\manch_000\Anaconda3\lib\site-packages\moviepy\video\VideoClip.py in <module>()
19
20 import moviepy.audio.io as aio
---> 21 from .io.ffmpeg_writer import ffmpeg_write_image, ffmpeg_write_video
22 from .io.ffmpeg_reader import ffmpeg_read_image
23 from .io.ffmpeg_tools import ffmpeg_merge_video_audio
C:\Users\manch_000\Anaconda3\lib\site-packages\moviepy\video\io\ffmpeg_writer.py in <module>()
17 from tqdm import tqdm
18
---> 19 from moviepy.conf import FFMPEG_BINARY
20 from moviepy.tools import verbose_print
21
C:\Users\manch_000\Anaconda3\lib\site-packages\moviepy\conf.py in <module>()
59 FFMPEG_BINARY = 'ffmpeg.exe'
60 else:
---> 61 raise IOError("FFMPEG binary not found. Try installing MoviePy"
62 " manually and specify the path to the binary in"
63 " the file conf.py")
OSError: FFMPEG binary not found. Try installing MoviePy manually and specify the path to the binary in the file conf.py
I downloaded the FFMPEG file but I don't know to specify the path in conf.py.
Any help ?
I encountered this issue when trying to use PythonVideoConverter
The steps I took to finally resolve this were:
pip install ffmpeg
Then you have to go download the ffmpeg executables separately. Source code can be found here:
http://ffmpeg.org/
I actually used the pre-built binaries for windows available here:
https://github.com/BtbN/FFmpeg-Builds/releases
The lines to use PythonVideoConverter are:
from converter import Converter
conv = Converter()
Add the absolute path to the executables as input parameters to Converter(), ie:
ffmpegPath = r"c:\...\ffmpeg.exe"
ffprobePath = r"c:\...\ffprobe.exe"
from converter import Converter
conv = Converter(ffmpegPath, ffprobePath)
edit: This was on Windows 10 using Python 3.7.4. I used the win64-gpl build of ffmpeg.
I had this same problem, but in ubuntu. It got solved by simply installing ffmpeg using apt-get:
sudo apt-get install ffmpeg
I don't have anaconda , but as per error dump
C:\Users\manch_000\Anaconda3\lib\site-packages\moviepy\conf.py in <module>()
59 FFMPEG_BINARY = 'ffmpeg.exe'
60 else:
---> 61 raise IOError("FFMPEG binary not found. Try installing
Here are steps that I can think of,
Find out absolute path for ffmpeg.exe on your system.
Copy that path.
Edit C:\Users\manch_000\Anaconda3\lib\site-packages\moviepy\conf.py
change line 59 to
FFMPEG_BINARY = 'c:\your_path_to_ffmpeg.exeutable\ffmpeg.exe'
save the conf.py
Hope this helps.
Related
I am trying to import shapely but getting error.
--------------------------------------------------------------------------- OSError Traceback (most recent call last) <ipython-input-9-62e74f53568a> in <module>
----> 1 import shapely.geometry
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/shapely/geometry/__init__.py in <module>
2 """
3
----> 4 from .base import CAP_STYLE, JOIN_STYLE
5 from .geo import box, shape, asShape, mapping
6 from .point import Point, asPoint
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/shapely/geometry/base.py in <module>
16
17 from shapely.affinity import affine_transform
---> 18 from shapely.coords import CoordinateSequence
19 from shapely.errors import WKBReadingError, WKTReadingError
20 from shapely.geos import WKBWriter, WKTWriter
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/shapely/coords.py in <module>
6 from ctypes import byref, c_double, c_uint
7
----> 8 from shapely.geos import lgeos
9 from shapely.topology import Validating
10
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/shapely/geos.py in <module>
136 _lgeos = load_dll('geos_c', fallbacks=alt_paths)
137
--> 138 free = load_dll('c').free
139 free.argtypes = [c_void_p]
140 free.restype = None
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/shapely/geos.py in load_dll(libname, fallbacks, mode)
60 raise OSError(
61 "Could not find lib {} or load any of its variants {}.".format(
---> 62 libname, fallbacks or []))
63
64 _lgeos = None
OSError: Could not find lib c or load any of its variants [].
I tried conda install -c conda-forge geos=3.7.1 but its not helping.
Can someone please help how can i repair Shapely. Shapely version I m using is 1.8.2.
I also tried conda install -c conda-forge geos=3.7.1 but it did not work.
I guess you are using an anaconda environment. So after you activate your environment in terminal;
conda activate <your_environment_name>
Using
pip install Shapely
in terminal, while my environment is active, I was able to use the package. Version is the 1.8.2, just like you wanted it.
For the possibility that you'd like to have a reminder on conda environments, here is a wonderful link.
I am trying to import the rpy2 library into a Jupyter Notebook but I cannot get past this error.
The PATH 'C:\Program Files\R\R-4.0.2\bin\x64' has been added.
This is the only version of R installed on my computer. I have completely uninstalled and reinstalled R/Rstudio/Anaconda with no luck.
Here is the full error:
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-7-098f0d39b3a3> in <module>
----> 1 from rpy2.robjects import pandas2ri
C:\Anaconda\lib\site-packages\rpy2\robjects\__init__.py in <module>
14 from functools import partial
15 import types
---> 16 import rpy2.rinterface as rinterface
17 import rpy2.rlike.container as rlc
18
C:\Anaconda\lib\site-packages\rpy2\rinterface.py in <module>
4 import typing
5 from typing import Union
----> 6 from rpy2.rinterface_lib import openrlib
7 import rpy2.rinterface_lib._rinterface_capi as _rinterface
8 import rpy2.rinterface_lib.embedded as embedded
C:\Anaconda\lib\site-packages\rpy2\rinterface_lib\openrlib.py in <module>
42 rlib = _rinterface_cffi.lib
43 else:
---> 44 rlib = _dlopen_rlib(R_HOME)
45
46
C:\Anaconda\lib\site-packages\rpy2\rinterface_lib\openrlib.py in _dlopen_rlib(r_home)
35 raise ValueError('The library path cannot be None.')
36 else:
---> 37 rlib = ffi.dlopen(lib_path)
38 return rlib
39
OSError: cannot load library 'C:\Program Files\R\R-4.0.2\bin\x64\R.dll': error 0x7e
edit:
Here is the code I run to import rpy2 library:
from rpy2.robjects import r, pandas2ri
Here is my working solution:
import os
os.environ["R_HOME"] = r"D:\Install\R\R-3.6.1"
os.environ["PATH"] = r"D:\Install\R\R-3.6.1\bin\x64" + ";" + os.environ["PATH"]
import rpy2
from rpy2.robjects import pandas2ri, packages
pandas2ri.activate()
stats = packages.importr('stats')
1 - Windows + IDE
For those not using Anaconda, add the following in Windows' environment variables PATH:
C:\Program Files\R\R-4.0.3\bin\x64
Your R version may differ from "R-4.0.3"
2 - Anaconda
Otherwise, check Grayson Felt's reply:
I found a solution here.
Adding the PATH
C:\Users\username\Anaconda2;C:\Users\username\Anaconda2\Scripts;C:\Users\username\Anaconda2\Library\bin;C:\Users\username\Anaconda2\Library\mingw-w64\lib;C:\Users\username\Anaconda2\Library\mingw-w64\bin
and subsequently restarting Anaconda fixed the issue.
3 - Code header Windows basic
Alternatively, following Bruno's suggestion (and being more sohpisticated):
try:
import rpy2.robjects as robjects
except OSError as e:
try:
import os
import platform
if ('Windows', 'Microsoft') in platform.system():
os.environ["R_HOME"] = 'C:/Program Files/R/R-4.0.3/bin/x64' # Your R version here 'R-4.0.3'
os.environ["PATH"] = "C:/Program Files/R/R-4.0.3/bin/x64" + ";" + os.environ["PATH"]
import rpy2.robjects as robjects
except OSError:
raise(e)
This code won't be effective for non-Windows platform.
Also adjustments may be necessary for different R versions.
If it gets more complicated than this, you should probably just go for solutions 1 or 2.
NOTE: You may also face this issue if your Python and R versions are in different architechtures (x86 vs x64)
So I am trying to get hmmlearn working in Jupyter, and I have come across an error while installing Hmmlearn using pip. I have tried this solution, but it didn't work.
It seems to me that pip does install the _hmmc file, but it does so incorrect. instead it has the name
_hmmc.cp35-win_amd64
and the file extesion is .PYD, instead of .c
When I run the code to import it, I get this error :
ImportError Traceback (most recent call last)
<ipython-input-1-dee84c3d5ff9> in <module>()
7 import os
8 from pyAudioAnalysis import audioBasicIO as aB
----> 9 from pyAudioAnalysis import audioAnalysis as aA
C:\Users\gover_000\Documents\GitHub\Emotion-Recognition-Prototype\pyAudioAnalysis\audioAnalysis.py in <module>()
15 import audioFeatureExtraction as aF
16 import audioTrainTest as aT
---> 17 import audioSegmentation as aS
18 import audioVisualization as aV
19 import audioBasicIO
C:\Users\gover_000\Documents\GitHub\Emotion-Recognition-Prototype\pyAudioAnalysis\audioSegmentation.py in <module>()
16 import sklearn
17 import sklearn.cluster
---> 18 import hmmlearn.hmm
19 import cPickle
20 import glob
C:\Users\gover_000\Anaconda3\envs\python2\lib\site-packages\hmmlearn\hmm.py in <module>()
19 from sklearn.utils import check_random_state
20
---> 21 from .base import _BaseHMM
22 from .utils import iter_from_X_lengths, normalize
23
C:\Users\gover_000\Anaconda3\envs\python2\lib\site-packages\hmmlearn\base.py in <module>()
11 from sklearn.utils.validation import check_is_fitted
12
---> 13 from . import _hmmc
14 from .utils import normalize, log_normalize, iter_from_X_lengths
15
ImportError: cannot import name _hmmc
I don't know why pip just doesn't install it correctly, even when I tried to use --no-cache-dir
Edit: So i figured out what the problem was. my active python enviroment was python 3.5, as i was manually transferring the installed files to my enviroment, it failed because i had the wrong version.
I had to change my active python enviroment: using activate <my_enviroment name>
after that i could just use pip to install it again and it worked this time.
Looking at your error message I guess that you have downloaded the hmmlearn package from GIT. Have you tried using a wheel (*.whl) file instead? You can download one from here. Check out which version fits your python installation.
Then use:
pip install <the_wheel_that_corresponds_to_your_python_version>.whl
Hope it helps.
So i figured out what the problem was. my active python enviroment was python 3.5, as i was manually transferring the installed files to my enviroment, it failed because i had the wrong version. I had to change my active python enviroment: using activate <my_enviroment_name> after that i could just use pip to install it again and it worked this time.
not sure if it could be helpful to anyone but I installed hmmlearn as follows in my Jupyter Lab:
import sys
!{sys.executable} -m pip install hmmlearn
I am running python on Anaconda. I downloaded the Theano from "https://github.com/Theano/Theano.git" and installed it by running
cd Theano
python setup.py develop
However, when I tried to import the theano on Ipython notebook. I got the ""dot.exe" not found in path." exception. Have no clue what is going on...
import numpy as np
import time
import theano
Exception Traceback (most recent call last)
<ipython-input-1-432f5c01387b> in <module>()
1 import numpy as np
2 import time
----> 3 import theano
c:\users\t-ninma\documents\studymaterials\theano\theano\__init__.py in <module>()
79 from theano.misc.safe_asarray import _asarray
80
---> 81 from theano.printing import pprint, pp
82
83 from theano.scan_module import scan, map, reduce, foldl, foldr, clone
c:\users\t-ninma\documents\studymaterials\theano\theano\printing.py in <module>()
42 pydot_imported_msg = "pydot can't find graphviz"
43 else:
---> 44 pd.Dot.create(pd.Dot())
45 pydot_imported = True
46 except ImportError:
C:\Users\t-ninma\AppData\Local\Continuum\Anaconda2\lib\site-packages\pydot.pyc in create(self, prog, format)
1874 raise Exception(
1875 '"{prog}" not found in path.'.format(
-> 1876 prog=prog))
1877 else:
1878 raise
Exception: "dot.exe" not found in path.
Seems like you are running anaconda in windows. When installing Theano in a windows machines sometimes there are some issues.
Here you can see a good way to install theano in windows machines. If you have installed any mingw compiler or msys before, remove then before following this method.
Hope this method will work..!
I cannot import caffe into (anaconda-) python.
I'm following a notebook example on "logistic regression on non-image HDF5 data". When I execute the line
import caffe
I get the following error:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-17-3524921938b5> in <module>()
8 sys.path.insert(0, caffe_root + 'python')
9
---> 10 import caffe
11
/home/myName/libs/caffe/caffe-master-anaconda-python/python/caffe/__init__.py in <module>()
----> 1 from .pycaffe import Net, SGDSolver
2 from ._caffe import set_mode_cpu, set_mode_gpu, set_device, Layer, get_solver
3 from .proto.caffe_pb2 import TRAIN, TEST
4 from .classifier import Classifier
5 from .detector import Detector
/home/myName/libs/caffe/caffe-master-anaconda-python/python/caffe/pycaffe.py in <module>()
11 import numpy as np
12
---> 13 from ._caffe import Net, SGDSolver
14 import caffe.io
15
ImportError: libjpeg.so.62: cannot open shared object file: No such file or directory
The library libjpeg.so.62 is definetly installed under /usr/lib/i386-linux-gnu/libjpeg.so.62. I don't know what is going wrong here or how to tell anacondapython where to look for libjpeg.so.62.
I already tried out sudo apt-get install libjpeg62:i386 but apt-get says "libjpeg62:i386 is already the newest version. libjpeg62:i386 set to manually installed."
I compiled caffe while modifying "Makefile.config" such that it was pointing it to the ananconda python path. I also exported the PYTHONPATH and PATH of my anaconda directory:
export PATH="/home/myName/libs/anaconda/bin:$PATH"
export PYTHONPATH="/home/myName/libs/caffe/caffe-master-anaconda-python/python:$PYTHONPATH"
Ok I finally found the solution:
I had to sudo apt-get install libjpeg62
After that a new error occurred while trying to import caffe, namely
ImportError: /home/myName/libs/anaconda/bin/../lib/libm.so.6: version `GLIBC_2.15' not found (required by /usr/lib/x86_64-linux-gnu/libx264.so.142)
That could be solved by removing some buggy anaconda libraries thus resorting to the system libraries,quote shelhamer:
"Some versions of Anaconda seem to come with a bad libm. rm ~/anaconda/lib/libm.* takes care of this by reverting to the system libm."
see github bvlc