I am working on an M1 Mac with Python version 3.9.7. I used pip to install pyglet (1.5.21), which worked.
However when trying to import pyglet in python scripts, the following error pops up:
ModuleNotFoundError: No module named 'pyglet'
I also tried installing pyglet version 1.5.16 using conda which results in the same error.
Other packages work just fine.
Any help is highly appreciated!
I also have M1 mac. Try using pip3 instead of pip to install pyglet. Could be you only have pip installed for python3 (which is pip3)
I was having errors with Python not finding the module/attributes - I resolved it by downloading the pyglet zip from github and saving it to the same folder that my .py file is in.
Related
I am having error importing modules in my jupyter notebook when running it on a mac machine after successfully installing them using:
!pip install <library name>.
I try it on several modules and error persists.
for example, when running this code
!pip install pyenchant
I get this:
Requirement already satisfied: pyenchant in
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages
(3.2.2)
when running :
import enchant
I am getting an error message:
ModuleNotFoundError: No module named 'pyspellchecker'
then try to run this (as I read this could help)
!python -m pip install -U pyenchant
and get that:
/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No module named pip
I think it has something to do with python path and bash_profile but I do not have an intuition for it.
I do not know if it is helpful/relevant, but I have Pycharm, python, Visual Studio Code and anconda installed on my machine. I am doubting that the problem comes from misalignment between the common configuration files of these programs.
can you please help?
I realize that many has encounter similar issue but their solutions did not help me.
p.s. the issue disappear when I use conda install , but I would like to use pip as it give me access to larger library options.
I can install, uninstall and upgrade prettytable using pip [un]install [-U] prettytable. But running the mbed-tools compile command keeps on reporting "ModuleNotFoundError: No module named 'prettytable'"
I can see the package is added to my ...\appdata\local\programs\python\python39\Lib\site-packages\ folder. According to my environmental path the folder ...\appdata\local\programs\python\python39\Scripts\ is added and many packages has en .exe file installed there, but prettytabe is missing. Could this be the problem? If so, how do I install it and ensure that it actually has en exe install too?
I'm running python 3.9.7 on pretty-much-the-latest Windows 10.
So it turned out I had Python 3.8.7 installed together with Python 3.9.7. So uninstalling the older one solved the problem...
I've installed python and opencv by using the correct commands in the cmd, but when I type in 'import cv2' in a python then I get the error in visual studio code and I can't find any solution online how to fix this
Import "cv2" could not be resolved Pylance (reportMissingImports)
More of the error in the terminal
ModuleNotFoundError: No module named 'cv2'
It just happened to me and I solved it installing both opencv-python and opencv-python-headless with pip and reloading the Visual Studio Code window right after it.
To install the needed packages, just run this command in the terminal:
$ pip install opencv-python opencv-python-headless
Make sure that its using the correct version of Python; e.g., I installed Python from the windows store, which is working:
However, if I use another one, it does not work:
I noticed that Visual Studio does not support the latest Python 3.8, so I had to use PyCharm as an IDE.
I had a similar issue so I installed opencv-python-headless (install opencv-python if not earlier) and reloaded the VScode window.
pip install opencv-python-headless
However, some methods like imshow() kept failing:
cv2.error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage'
This was resolved by installing opencv-contrib-python. You can install it by running the following code in your terminal:
pip install opencv-contrib-python
In your terminal (cmd if Windows) run the following (make sure that you're on the current working environment):
pip install opencv-python
then:
pip install opencv-python-headless
I just uninstalled the older python version and installed a new one again. That is probably the simplest and the most hassle-free one in my mind. Stick to version 3.8.8, that should do the trick. Also no worries about maintaining multiple versions of python in the system. It is indeed true that the lack of support from VS is causing this issue.
I am on a mac and struggle with this and this is the best way to do it, when ur in your .py file, on the lower left part of your vscode windown u will see the version of python you are using, click that and try different versions until your open cv command works, in my case, 3.8.8 worked for me.
Even after downloading the library pyttsx3 it cannot import. It says: lmodule not found error.
I tried all the methods available as:
using pipenv
upgrading pip
But I am still dealing with same problem:
This happened to me as well, what I did is reinstall python to the newest version, once I had it I installed it using pip3 install pyttsx3, and it solved the problem for me.
(note that I'm using pip3 because I' using python3 for my project, it shouldn't cause problem to use pip but just to make sure)
Try download whl file of pyttsx3 from here.
For example download it to F:/file.
Then use pip install F:/file/pyttsx3-2.90-py3-none-any.whl to install.
The problem with pyttsx3 is that it does not work for python version 3.4,3.5,3.6
But it works for python 3.8 and above but in the documentation, it is mentioned it works woth any python above version 3+
I am creating a face recognition system using Python and OpenCV on these versions:
Python 3.6.2 :: Anaconda custom (64-bit)
Anaconda 4.3.23
OpenCV 3.3.0
When I try to train the face recognizer:
face_recognizer = cv2.face.createLBPHFaceRecognizer()
I get this error:
AttributeError: module 'cv2' has no attribute 'face'
Update:
I've tried to do this:
pip install opencv_python‑3.3.0+contrib‑cp36‑cp36m‑win_amd64.whl
Also:
conda install -c menpo opencv3=3.3.0
And I still have the error.
The Menpo project does not have an installer for OpenCV 3.3. The Menpo project is up to 3.1 on macOS and Windows, and 3.2 on Linux. See the Anaconda package for that description and also the list of files for the installer versions. Actually, you can check out the GitHub repo for Menpo's OpenCV3 build and grab the files yourself. You can change the build files to suit your system if needed.
I'm not sure if your pip attempt includes a typo or not---the correct PyPI package wheel file with the contrib module is opencv_contrib_python not opencv_python+contrib, as shown at PyPI. Note that if you're not using Windows the GUI features of OpenCV will not work with the pip installer, including imshow() and other similar features.
You'd be better served just removing and reinstalling fresh with the contrib modules instead of trying to build them in later.
While I was looking for the same solution, I tried out many methods which don't work well with successfully installing OpenCV along with the extra modules i.e., OpenCV Contrib.
Apparently, while using pip install opencv-python windows platforms usually download only OpenCV without the extra modules!
What works, is stable and easy to install:
Download the integrated 'whl' file containing both OpenCV and it's Contrib files, which would be like 'opencv_python‑3.4.3+contrib‑cp36‑cp36m‑win_amd64.whl' which can be downloaded from here.
Install using pip install <whl filename>
I have tried other methods which are unreliable such as the solution suggested by #RoyaumeIX, however ended up with failure.
So is it with using
pip install opencv
pip install opencv-contrib
Installing opencv-contrib does not properly register the opencv package.
I strongly suggest that you directly download the official whl file and install it.
I also had same problem but it got resolved by following these steps:
start anaconda navigator
open CMD.exe prompt, hope you see this **(base) C:\Users\acer>** this may be different for you
write these command >>>**pip install opencv-contrib-python**
Now you can run your code as check!! I have runned my code in Spyder in base enviroment and it worked for me!
my using python 2.7 and opencv 3.3.0
working in code
cv2.face.LBPHFaceRecognizer_create();
Solution, as were found at OpenCV forum (and same at StackOverflow), works well for me:
pip install opencv-python
pip install opencv_contrib_python
And in cv2 version 4.0.0 face recogniser can be created by using different function name, as mentionted above:
face_recognizer = cv2.face.LBPHFaceRecognizer_create()
face_recognizer = cv2.face.EigenFaceRecognizer_create()
face_recognizer = cv2.face.FisherFaceRecognizer_create()
this should fix the problem
pip install opencv-python-headless
pip install opencv-contrib-python-headless
I found the solution to my issue, you have to follow this tutorial OpenCV with extra modules.
The essential steps are:
Go to C:/PythonXX/lib/site-packeges (the site-packages folder where your python is installed), and delete cv2.pyd if present.
Download OpenCV with extra modules
Create a Visual Studio project with CMake
Open Python IDLE and enter import cv2. If there is no error, then the installation is successful.