So many questions already about this topic, but I didn't find any satisfying answer about the "DLL not found" traditional issue.
I'm using Python 3.5 installed via Anaconda 3;
I have installed with pip the 'official' opencv_python-3.2.0.6-cp34-cp34m-win_amd64.whl (right from here https://pypi.python.org/pypi/opencv-python);
Windows version is 7 - 64 bits;
I have uninstalled all the redistributable VC++ that were present on my machine and reinstalled its 2015 version - so the famous as well as mandatory DLL msvcp140.dll is present on my laptop;
the cv2 module is present in the Lib/site-packages directory;
it contains, among others, file 'cv2.cp35-win_amd64.pyd'.
Meanwhile, I still can't get access to cv2:
>>> import cv2
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import cv2
File "C:\Program Files\Anaconda3\lib\site-packages\cv2\__init__.py", line 7, in <module>
from . import cv2
ImportError: DLL load failed: The specified module could not be found.
Modifying the name of the .pyd --> cv2.pyd does not solve the problem, nor does the installing via pip of the unofficial but great wheel version from Gohlke (http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv)
Any idea about what is going on?
As mentioned in the comment which I didn't notice at first, you can resolve this by installing from the unofficial site (Gohlke)
(http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv)
I uninstalled the official one by calling:
pip uninstall opencv-python
And then downloaded the .whl package from the mentioned site (you need to carefully choose the correct python version and the correct processor architecture x86 or x64).
And then, go to the path where the .whl file is downloaded and call:
pip install opencv_python-x.x.x-cpxx-cpxxm-win_xx.whl
Regarding the comment in the question, always remove any existing opencv package before installing another one because, opencv from unofficial and official sites will be considered as 2 packages by pip.
You can install official opencv if you follow my answer here. You get that error because of a problem with Anaconda.
But if you install official opencv it will autocomplete and give suggestions in your python IDE (see this). So, if you need autocomplete as well, you need to go with unofficial opencv.
I had the same issue. This helps me:
conda install -c menpo opencv3
Found at https://www.scivision.co/install-opencv-python-windows/
Related
Importing winshell (version 0.6) causes the following error:
>>> import winshell
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python39\lib\site-packages\winshell.py", line 32, in <module>
from win32com.shell import shell, shellcon
ImportError: DLL load failed while importing shell: The specified procedure could not be found.
I finally managed to get Anaconda to start working by executing the line:
pip install pywin32==300
I had to do it twice, because the first time it went for 301, not 300. The second time then dropped it to 300. This was from the Anaconda for Windows installer downloaded just two days ago from the Anaconda website and doing a "clean install"!
What a fiasco!
Until that point, NOTHING really worked. Almost every important command within Anaconda would fail with the Win32com error, and Navigator would not even start. Apparently the latest version of pywin32 is 304, but it doesn't work either. Is anyone looking into this? For a newbie like me, this is a very bad look for Anaconda as a tool! I was on the brink of simply giving up when I literally stumbled onto this thread.
Note that it has been MONTHS between my post and the one before mine. I'd say that this has probably caused a lot of people to simply give up (assuming that there are many who actually try to install this on Windows per month, that is).
I've had similar in the past,was about to give up on Anaconda.
Here's the solution
Apparently the wrong version of pywin32 gets installed.
I had the installed version 301 and after downgrading to 228 with pip install --upgrade pywin32==228 everything just started working.
Try pip install --upgrade pywin32==228
This should resolve the issue
Version 300 of pywin32 solved this issue for me! Check this other question for more info
Had the same issue with Conda and librosa in Python 3.9.
Librosa references from win32com.shell import shellcon,shell, which was causing the same error you received.
Installing pywin32 via conda fixed the error for me:
conda install -c conda-forge librosa
I ran into this issue when trying to get Anaconda to run at all on a new installation. I followed Alex T's recommendation to install version 300 of pywin32. Like him, I had to run it twice because it first installed version 302 for some reason. After running it the second time I can now run conda commands in that environment
pip install pywin32==300
My simple solution is to install an Older version of Anaconda. This worked perfectly for me. I installed Anaconda3-2021.11-Windows-x86 version.
The Newer Version of Anaconda has some problems with pywin32. I first tried the command :
pip install --upgrade pywin32==228
but It didn't workd for me. Installing an older version finally solved the problem of anaconda navigator not launching.
I am trying to get the JapaneseTokenizer working in python, but I am having trouble with one of the modules it depends on. Here is the trace of the errors I am getting:
/Users/home/PycharmProjects/SubLingo/application/tokenizerTest.py
Traceback (most recent call last):
File "/Users/home/PycharmProjects/SubLingo/application/tokenizerTest.py", line 1, in <module>
import JapaneseTokenizer
File "/Users/home/PycharmProjects/SubLingo/venv/lib/python3.7/site-packages/JapaneseTokenizer/__init__.py", line 6, in <module>
from JapaneseTokenizer.jumanpp_wrapper import JumanppWrapper
File "/Users/home/PycharmProjects/SubLingo/venv/lib/python3.7/site-packages/JapaneseTokenizer/jumanpp_wrapper/__init__.py", line 1, in <module>
from .jumanpp_wrapper import JumanppWrapper
File "/Users/home/PycharmProjects/SubLingo/venv/lib/python3.7/site-packages/JapaneseTokenizer/jumanpp_wrapper/jumanpp_wrapper.py", line 2, in <module>
from pyknp import Jumanpp
ImportError: cannot import name 'Jumanpp' from 'pyknp' (/Users/home/PycharmProjects/SubLingo/venv/lib/python3.7/site-packages/pyknp/__init__.py)
As you can see Jumanpp_wrapper is trying to import the module Jumanpp from pyknp. I have looked into the pyknp package currently installed on my machine and it does not have a module with this name. This leads me to conclude that the version of pyknp I have installed is not compatible with Jumanpp, so there must be another version available somewhere. The trouble is I install pyknp using the pip installer on my Mac, as recommended on the pyknp official site, so it should be the most current version. I'm not sure how to get an alternative version that contains the necessary module. I hope someone can point me in the right direction.
I'm a developer of the package. I kindly thank you for using my package.
I fixed bugs related to the issues here and released newer package version 1.4.
https://github.com/Kensuke-Mitsuzawa/JapaneseTokenizers/releases/tag/1.4
You could install/upgrade the package with pip also.
Install pip install JapaneseTokenizer / Upgrade pip install -U JapaneseTokenizer
I have been in direct contact with the developer of JapaneseTokenizer who has kindly given permission for me to repost his answer to my query:
I'm glad that you sent me a message about the issue. I read your post at StackOverflow. As other user suggested, the main issue is that pyknp package does not have juman++ module. I don't know the reason, but an author of pyknp package removed module for juman++.
The straightforward way to solve this issue is that you install pyknp package version 3 from here and install it your environment.
The main procedure is below.
remove pyknp package from your environment pip uninstall pyknp
get download pyknp package previous version. http://nlp.ist.i.kyoto-u.ac.jp/DLcounter/lime.cgi?down=http://lotus.kuee.kyoto-u.ac.jp/nl-resource/pyknp/pyknp-0.3.tar.gz&name=pyknp-0.3.tar.gz
install the pyknp=0.3 with pip install pyknp-0.3.tar.gz
From now, I revise JapaneseTokenizer package. It might take some weeks. Next time you try to install JapaneseTokenizer package, everything will be fine.
Again, thanks for giving me a message.
Best,
Kensuke Mitsuzawa
I installed pyaudio with anaconda python. Using conda install pyaudio on windows.
It said it installed and it also installed PortAudio with it.
However, when I create my file and run it now I get the following issue.
I have no idea what is going on.
Could not import the PyAudio C module '_portaudio'.
Traceback (most recent call last):
File "C:\Users\This PC\Desktop\Py\demo.py", line 2, in <module>
import pyaudio
File "C:\Users\This PC\Anaconda3\lib\site-packages\pyaudio.py", line 116, in <module>
import _portaudio as pa
ImportError: DLL load failed: The specified module could not be found.
I ran into this error with win32 py3 using Anaconda3. Re-installing portaudio fixed this:
conda install portaudio
It just updated the package for me, and pyaudio was able to find the DLL then.
I faced a similar issue.
The only way I was able to resolve this was by uninstalling anaconda, installing the latest version of python, and reinstalling the latest version of conda.
I then downloaded the latest .whl file for pyaudio which can be found here: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio
I moved this file from my downloads and into the site-packages folder of anaconda3:
C:\Users\Projects\Anaconda3\Lib\site-packages
Upon running the command 'pip install pyaudio' OR 'python -m pip install pyaudio' in the anaconda prompt I was good to go
I hope this helps!
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pygame
File "C:\Program Files (x86)\Python35-32\lib\site-packages\pygame\__init__.py", line 127, in <module>
from pygame.base import *
ImportError: DLL load failed: The specified module could not be found.
Ensure that the version of PyGame you're using matches the version of Python you're using!
You have not installed Pygame correctly or not in the correct directory/file. What python version do you use and is your computer 32/64 bit?
Thx
This is a late answer, but may be it helps someone.
The pygame binary you use should be built for the Python version you have in your system.
In your case, you seem to have 32-bit Python3.5.
There is no official pygame binary for Python3.5 yet. But unofficial binaries are available here.
Download pygame-1.9.2b1-cp35-cp35m-win32.whl from the link (this is the 32-bit version for 32-bit Python3.5), and install it using pip.
Example: cd to the folder where you downloaded the .whl file, and run C:\Program Files (x86)\Python35-32\Scripts\pip install pygame-1.9.2b1-cp35-cp35m-win32.whl
Note:
pip may not play well when the python install directory has spaces. So please install python in a path without spaces. For example, C:\Python35-32 instead of C:\Program Files (x86)\Python35-32.
Also, see this answer in case you need more info on installing .whl files.
Please only respond to this post if you use Python on Windows, rather than Mac or Linux.
Error message:
>>> import numpy
Traceback (most recent call last):
File "stdin", line 1, in <module>
ImportError: No module named 'numpy'
Questions:
Regarding windows 7, python 3.4.3 and numpy-1.9.2, are there any
conflicts that would prevent these from working together?
Into which directory (please write out the complete directory path
starting with "C:") should I extract the contents of the numpy zip
file?
What is the exact command that I need to type into python command
prompt in order to install numpy?
Thanks in advance for your assistance
I was also facing this issue where in I tried using
import numpy
But it has given me error "ImportError: No module named 'numpy'"
I installed numpy using "C:\user>python -mpip install numpy" and it was successfully installed.
However I was again getting the same error
Then I checked that the path where in numpy was intalled was not listed in
import sys
print(sys.path)
Then I appended my path wherein numpy was installed using ">>> sys.path.append(r"C:\Users\xxxx\AppData\Roaming\Python\Python38\site-packages").
The above command worked fine, still problem not resolved then I restarted my python session again.
Finally it worked..!!!!(As after every append we have to restart our python session).
1) No there isn't.
2) You can use pip. pip install numpy
If you don't have pip installed, install it, its the most often used way of installing python packages. Yes it is possible to do under windows.
3) Once you have the python command prompt, you already have python installed.
1) no
2) It doesn't actually matter as pip or the installer will figure that out for you. However, just so you know, pip or whatever will install numpy into your site-packages folder.
3) I recommend downloading the NumPy installer from SourceForge:
http://sourceforge.net/projects/numpy/files/NumPy/1.9.2/
Then you don't have to worry about having the right compiler installed. However, if you want to use pip, then you'll need to install the appropriate compiler. This is documented at the following locations:
Microsoft Visual C++ Compiler for Python 3.4
https://matthew-brett.github.io/pydagogue/python_msvc.html
I'm not even close to an expert on Python. That said, I like the notion of "keep it simple." I chose to install a Python distribution that already includes numpy. Specifially I installed Python(x,y). Everything seems to be working just fine right after install. I appreciate all those who commented on my question. Thanks