I'm working on Windows 10, using python3.8. I wanted to install the ffpyplayer module, and did so using the command:
python3 -m pip install --upgrade ffpyplayer
There seemed to be no issues. Using python in PowerShell and stating import ffpyplayer doesn't return anything, however, when I try and run `from ffpyplayer.player import MediaPlayer. It returns the following error
from ffpyplayer.player import MediaPlayer
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"C:\Users\g\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\ffpyplayer\player\__init__.py", line 10, in <module>
from ffpyplayer.player.player import MediaPlayer
ImportError: DLL load failed while importing player: The specified module could not be found.
Why is it able to import in one instance and not the next? What is causing the import error in the second example?
ffpyplayer builds ffmpeg include path as follows:
_ffmpeg = join(sys.prefix, 'share', 'ffpyplayer', 'ffmpeg', 'bin')
sys.prefix resolves to Python installation directory, e.g. C:\Program Files\Python.
If ffpyplayer is installed using PIP not in CMD administrator mode, the package is installed into user local %AppData%\Python directory. This is the reason ffmpeg does not get resolved as expected.
Solution:
pip uninstall ffpyplayer
CMD (Administrator mode)
pip install ffpyplayer
I answered a similar question, but basically import ffpyplayer in your specfile and add ffpyplayer.dep_bins to your tree like so:
*[Tree(p) for p in (source1 + source2 + ffpyplayer.dep_bins)]
https://stackoverflow.com/a/70392062/16355112
Related
I am trying to create an image processing program using convolutions. I need the package scikit-image, specifically this:
from skimage.exposure import rescale_intensity
I have repeatedly installed scikit-image using pip install scikit-image in my terminal (Mac). I did this in the folder where my convolutions.py file is located (is this what is meant by the PYTHONPATH?). However, I always get an error message:
Traceback (most recent call last):
File "Convolutions.py", line 6, in <module>
from skimage.exposure import rescale_intensity
ImportError: No module named skimage.exposure
How do I solve the problem?
make sure you are installing the package on the same version of python which you are running. On a mac, python by default runs python-2.7, and the command python3 runs python-3.x. Also, pip by default installs packages to python-2.7. To install them on python3 try running
python3 -m pip install scikit-image
or simply
pip3 install scikit-image
I was working with Python 3.7 and OpenCV 4.2 in Pycharm IDE (Windows10). The system environment variables were changed by one of my co-workers by accident (we don't know what happened exactly). Then I found that my code did not work with this error!:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.
Then I used this command:
pip uninstall opencv-python
pip uninstall opencv-contrib-python
pip install opencv-python
All of them executed successfully, but when I write import cv2 the above error is appeared. By the way, the system knows command Python, it shows the right path to the python.exe. Moreover, commands like import numpy works correctly! How can I fix this problem?
I found the answer! There was an extra cv2.py file in site-packages/cv2 path. So, I removed it and the code worked
I need to install python wrapper for StanfordCoreNLP.
I have used git clone https://github.com/smilli/py-corenlp and also pip install pycorenlp and its showing success in both the cases, but when I run from pycorenlp import StanfordCoreNLP, its showing ModuleNotFoundError.
I checked its path if it installed or not. It is installed at "C:\Users\simra_000\Anaconda3\Lib\site-packages\pycorenlp" using pip
and using git clone also it is installed at "C:\Users\simra_000\py-corenlp"
from pycorenlp import StanfordCoreNLP
Traceback (most recent call last): File "", line 1, in
ModuleNotFoundError: No module named 'pycorenlp'
check if the module was installed by:
pip list
also you can add this code to install the module if it's not installed:
import pip
required_pkgs = ['pycorenlp']
installed_pkgs = [pkg.key for pkg in pip.get_installed_distributions()]
for package in required_pkgs:
if package not in installed_pkgs:
with suppress_stdout():
pip.main(['install', package])
also check the version of python that you are used to run the script and the version of pip, for example if you are using python3 and you install the module via pip (python2) the module was installed for python v.2 only
otherwise check the name of your script, so if the name of your script is pycorenlp.py the import will not work, and you need to change the name of your script
hope that helps you
I work on Ubuntu Xenial (16.04) with python3, I also installed anaconda.
I installed python3-gammu (with apt install python3-gammu or/and pip install python3-gammu) to test send SMS.
Just run python3 console and
>>> import gammu
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'gammu'
import sys
print(sys.path)
only return anaconda paths !
If I run
sudo find -iname gammu
…
./usr/lib/python3/dist-packages/gam
…
so if I add this path:
>>> sys.path.append('/usr/lib/python3/dist-packages/')
>>> import gammu
and it works !
Could you clarify this library path issue?
just
export PYTHONPATH=$PYTHONPATH:/usr/lib/python3/dist-packages/
To keep it at next reboot, put this line in your ~/.bashrc :
# added by Anaconda3 4.2.0 installer
export PATH="/home/my_user_name/anaconda3/bin:$PATH"
export PYTHONPATH="/usr/lib/python3/dist-packages/:$PYTHONPATH"
to active new .bashrc, do not forget to run
source ~/.bashrc
When you are trying to import any package it will check sys.path, which contains all paths of packages. If it find the package you want to import it will import it.
sorry for bad english...
Why use sys.path.append(path) instead of sys.path.insert(1, path)?
You may get clarity after seeing this ?
I wish if anyone could give me a hand with my prob,
I have installed python 3.6 amd64 and add it to path then installed opencv 3.2 successfully using "pip" ... However, when I'm trying to import the cv2 (the library of opencv) and here is the error that I have got:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import cv2
ImportError: DLL load failed: The module specified is not found.
Make sure that cv2.pyd is in your Python's lib\site-packages\ directory.
Also check if OPENCV_DIR = C:\Program Files\OpenCV 3.2.0\x64\vc14, or similar, is in your Windows' system variables setting. The sample path OPENCV_DIR is for the binary compiled with VC14 which is Visual Studio 2015 VC++.
I'm guessing you've installed pip2(for python2) instead of pip3.(for python3)
Try this to install pip for python3
sudo apt-get install python3-pip
Now use
pip3 install python3-opencv