I'm trying to run a python script however I get the message
ImportError: DLL load failed: %1 is geen geldige Win32-toepassing.
Full error:
Traceback (most recent call last):
File "ROC_plotting.py", line 2, in <module>
import matplotlib.pyplot as plt
File "C:\Python27\lib\site-packages\matplotlib\pyplot.py", line 115, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "C:\Python27\lib\site-packages\matplotlib\backends\__init__.py", line 32, in pylab_setup
globals(),locals(),[backend_name],0)
File "C:\Python27\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 6, in <module>
from six.moves import tkinter as Tk
File "C:\Python27\lib\site-packages\six.py", line 203, in load_module
mod = mod._resolve()
File "C:\Python27\lib\site-packages\six.py", line 115, in _resolve
return _import_module(self.mod)
File "C:\Python27\lib\site-packages\six.py", line 82, in _import_module
__import__(name)
File "C:\Python27\lib\lib-tk\Tkinter.py", line 38, in <module>
import FixTk
File "C:\Python27\lib\lib-tk\FixTk.py", line 68, in <module>
import _tkinter
ImportError: DLL load failed: %1 is geen geldige Win32-toepassing.
It seems some of these errors are concerning Matplotlib, however when I run
pip list
It seems that I do have installed matplotlib
pip list output:
cycler (0.10.0)
functools32 (3.2.3.post2)
matplotlib (2.0.2)
numpy (1.11.3+mkl)
opencv-python (2.4.13.2)
pip (9.0.1)
pyparsing (2.2.0)
python-dateutil (2.6.0)
pytz (2017.2)
scikit-learn (0.18.1)
setuptools (28.8.0)
six (1.10.0)
wheel (0.29.0)
My python version is 2.7.13, I'm running on a 64-bit Windows system.
If it's not your python version, make sure you have Microsoft Visual C++ 2008 64bit installed as it's used by matplotlib check in Control Panel > Programs
Related
I found 0 topics about this issue for Windows, only for Ubuntu, MAc etc.
When I try to install any package via Pycharm, e.g. urllib, matplotlib, heidi, I get the exact same error message as below.
Project interpreter is Anaconda Python 3.7.
Any idea how this can solved?
Error: Traceback (most recent call last):
File "E:\Download\PROGIK\Charm Community Edition 2018.3.5\helpers\packaging_tool.py", line 73, in run_pip
runpy.run_module(module_name, run_name='__main__', alter_sys=True)
File "E:\Download\PROGIK\Anaconda\lib\runpy.py", line 201, in run_module
mod_name, mod_spec, code = _get_module_details(mod_name)
File "E:\Download\PROGIK\Anaconda\lib\runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "E:\Download\PROGIK\Anaconda\lib\runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "E:\Download\PROGIK\Anaconda\lib\site-packages\pip\__init__.py", line 15, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "E:\Download\PROGIK\Anaconda\lib\site-packages\pip\vcs\subversion.py", line 9, in <module>
from pip.index import Link
File "E:\Download\PROGIK\Anaconda\lib\site-packages\pip\index.py", line 30, in <module>
from pip.wheel import Wheel, wheel_ext
File "E:\Download\PROGIK\Anaconda\lib\site-packages\pip\wheel.py", line 35, in <module>
from pip._vendor.distlib.scripts import ScriptMaker
File "E:\Download\PROGIK\Anaconda\lib\site-packages\pip\_vendor\distlib\scripts.py", line 14, in <module>
from .compat import sysconfig, detect_encoding, ZipFile
File "E:\Download\PROGIK\Anaconda\lib\site-packages\pip\_vendor\distlib\compat.py", line 66, in <module>
from urllib.request import (urlopen, urlretrieve, Request, url2pathname,
ImportError: cannot import name 'HTTPSHandler' from 'urllib.request' (E:\Download\PROGIK\Anaconda\lib\urllib\request.py)
Edit: with pip I have only problem with matplotlib, which is another topic:
Cannot install matplotlib. Fatal error LNK1181, Visual Studio fail
Simply went into packages folder and deleted matplotlib package manually because could not make it display graphs in Jupyter (didnt try in Pycharm). Trying to reinstall it now, hopefully it will fix the issue.
To install packages whithin anaconda environment under Windows10, you should use "Anaconda prompt" (find it in win menu)
It starts (Base) venv by default and installs packages in it. Therefore using Python interpreter distributed with Anaconda you will be able to import them with no side actions.
Besides matplotlib is installed there by default
Importing sklearn gives error in anaconda jupyter notebook. I have installed scikitlearn package and issue is still seen.
Traceback (most recent call last):
File "version.py", line 18, in <module>
import sklearn
File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\__init__.py", line 13
4, in <module>
from .base import clone
File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\base.py", line 13, in
<module>
from .utils.fixes import signature
File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\utils\__init__.py", l
ine 11, in <module>
from .validation import (as_float_array,
File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\utils\validation.py",
line 18, in <module>
from ..utils.fixes import signature
File "C:\ProgramData\Anaconda3\lib\site-packages\sklearn\utils\fixes.py", line
144, in <module>
from scipy.sparse.linalg import lsqr as sparse_lsqr # noqa
File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\sparse\linalg\__init__.
py", line 118, in <module>
from .matfuncs import *
File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\sparse\linalg\matfuncs.
py", line 19, in <module>
import scipy.special
File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\special\__init__.py", l
ine 640, in <module>
from ._ufuncs import *
ImportError: DLL load failed: The specified procedure could not be found.
(base) C:\Windows\system32>
As referred in this link that looks similar. You probably dont have c++ windows compiler. You will need to install Visual C++ Redistributable and then reinstalling anaconda might solve the issue.
On a side note anaconda generally takes care of the installing of the c++ compiler. Did you create virtualenv and pip install. I will suggest you install using conda install.
conda install scipy
Previously I installed pip packages using sudo pip install package, but I switched to pip install --user package.
The problem is that I installed jupyter-themes using the second method, and when I try to run it the following error gets thrown.
Traceback (most recent call last):
File "/home/aswinmohanme/.local/bin/jt", line 11, in <module>
sys.exit(main())
File "/home/aswinmohanme/.local/lib/python3.5/site-packages/jupyterthemes/__init__.py", line 260, in main
dfonts=args.defaultfonts)
File "/home/aswinmohanme/.local/lib/python3.5/site-packages/jupyterthemes/__init__.py", line 54, in install_theme
from jupyterthemes import stylefx
File "/home/aswinmohanme/.local/lib/python3.5/site-packages/jupyterthemes/stylefx.py", line 7, in <module>
from IPython.core.display import HTML
File "/home/aswinmohanme/.local/lib/python3.5/site-packages/IPython/__init__.py", line 54, in <module>
from .core.application import Application
File "/home/aswinmohanme/.local/lib/python3.5/site-packages/IPython/core/application.py", line 23, in <module>
from traitlets.config.application import Application, catch_config_error
File "/home/aswinmohanme/.local/lib/python3.5/site-packages/traitlets/__init__.py", line 1, in <module>
from .traitlets import *
File "/home/aswinmohanme/.local/lib/python3.5/site-packages/traitlets/traitlets.py", line 60, in <module>
from .utils.importstring import import_item
File "/home/aswinmohanme/.local/lib/python3.5/site-packages/traitlets/utils/importstring.py", line 8, in <module>
from ipython_genutils.py3compat import cast_bytes_py2
ImportError: No module named 'ipython_genutils'
This is the output of pip list installed
...
iniparse (0.4)
ipykernel (4.5.2)
ipython (5.3.0)
ipython-genutils (0.2.0)
ipywidgets (6.0.0)
isort (4.2.5)
...
How do I fix this.
Could anyone tell me what files I should download and which statements I must execute in the command line to install Matplotlib?
I have Python 2.7.13 on Windows 10 64 bit.
These are the files I unzipped:
All downloaded from: http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
Commands I executed:
python -m pip install -U pip setuptools
python -m pip install matplotlib
python -m pip install -U pip
I am getting these two errors when checking if Numpy and Matplotlib are installed.
>>> import numpy
**Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
import numpy
File "numpy\__init__.py", line 142, in <module>
from . import add_newdocs
File "numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "numpy\core\__init__.py", line 26, in <module>
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.
Original error was: DLL load failed: %1 no es una aplicación Win32 válida.**
>>> import matplotlib
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
import matplotlib
File "matplotlib\__init__.py", line 122, in <module>
from matplotlib.cbook import is_string_like, mplDeprecation, dedent, get_label
File "matplotlib\cbook.py", line 33, in <module>
import numpy as np
File "numpy\__init__.py", line 142, in <module>
from . import add_newdocs
File "numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "numpy\core\__init__.py", line 26, in <module>
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control). Otherwise reinstall numpy.
Original error was: DLL load failed: %1 no es una aplicación Win32 válida.
This is a common issue for windows users. And you will probably need precompiled packages for some other libraries as well, e.g. scipy.
You will find on SourceForge the numpy superpack whose name structure is numpy-X.X.X-win32-superpack-python2.7.exe, e.g. numpy-1.9.2-win32-superpack-python2.7.
On Pypi (Python Package Index), you will find the matplotlib library, whose name structure is matplotlib-X.X.X.win32-py2.7.exe, e.g matplotlib-1.4.3.win32-py2.7.exe.
Installing matplotlib through pip by automatically downloading the files from the python index as you're trying to do here will most probably fail for windows.
There are two main options:
Install a complete distribution like Anaconda, Canopy, WinPython, etc. which already has all the respective libraries included.
Use precompiled wheels. A source for those is indeed this site by Christoph Gohlke. You would then need to make sure to install all dependencies first and matplotlib last. Starting with numpy is the best, then other dependencies, matplotlib last. To install those use
pip install <filename of wheel>
e.g.
pip install numpy‑1.13.0rc1+mkl‑cp27‑cp27m‑win_amd64.whl
I just installed Anaconda. I already had Spyder 3.0.0 installed on my Windows 8.1 (64 bit). I also already had Python 3.4 installed. But, after installing Anaconda, I went into Preferences and pointed the Python executable to the Anaconda3 folder to utilize the 3.5 version. But when I started up Spyder again, got the following error:
An error ocurred while starting the kernel
C:\WinPythonbit.4.4.2\python.4.4.amd64\lib\site‑packages\PIL\Image.py:81: RuntimeWarning: The _imaging extension was built for another version of Python.
RuntimeWarning
C:\WinPythonbit.4.4.2\python.4.4.amd64\lib\site‑packages\PIL\Image.py:81: RuntimeWarning: The _imaging extension was built for another version of Python.
RuntimeWarning
Traceback (most recent call last):
File "C:\WinPythonbit.4.4.2\python.4.4.amd64\lib\site‑packages\spyderlib\widgets\externalshell\start_ipython_kernel.py", line 187, in
from ipykernel.kernelapp import IPKernelApp
File "C:\WinPythonbit.4.4.2\python.4.4.amd64\lib\site‑packages\ipykernel\__init__.py", line 2, in
from .connect import *
File "C:\WinPythonbit.4.4.2\python.4.4.amd64\lib\site‑packages\ipykernel\connect.py", line 18, in
import jupyter_client
File "C:\WinPythonbit.4.4.2\python.4.4.amd64\lib\site‑packages\jupyter_client\__init__.py", line 4, in
from .connect import *
File "C:\WinPythonbit.4.4.2\python.4.4.amd64\lib\site‑packages\jupyter_client\connect.py", line 21, in
import zmq
File "C:\WinPythonbit.4.4.2\python.4.4.amd64\lib\site‑packages\zmq\__init__.py", line 66, in
from zmq import backend
File "C:\WinPythonbit.4.4.2\python.4.4.amd64\lib\site‑packages\zmq\backend\__init__.py", line 40, in
reraise(*exc_info)
File "C:\WinPythonbit.4.4.2\python.4.4.amd64\lib\site‑packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\WinPythonbit.4.4.2\python.4.4.amd64\lib\site‑packages\zmq\backend\__init__.py", line 27, in
_ns = select_backend(first)
File "C:\WinPythonbit.4.4.2\python.4.4.amd64\lib\site‑packages\zmq\backend\select.py", line 27, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\WinPythonbit.4.4.2\python.4.4.amd64\lib\site‑packages\zmq\backend\cython\__init__.py", line 6, in
from . import (constants, error, message, context,
ImportError: Module use of python34.dll conflicts with this version of Python.
Any ideas?
Suggestion:
rename your directory "C:\WinPython-64bit-3.4.4.2" in "C:\WinPython-64bit-3.4.4.2bis"
relaunch your Anaconda Spyder
if it doesn't help, rename it back to "C:\WinPython-64bit-3.4.4.2"