Python-docx==0.8.7 package compatibility with 64-bit windows - python

I installed this python package using pip that was compatible with Python 2.7. I tried newer versions of the python-docx but those ones did not download properly. Only version 0.8.7 worked as so I installed it using:
pip install python-docx==0.8.7
But I think it installed a 32 bit version of this package and I am using a 64 bit machine. I know this because while I tried to run my python program using this package I got the error:
from lxml import etree
ImportError: DLL load failed: %1 is not a valid Win32 application.
This is where the package got downloaded to: C:\Python27\Lib\site-packages\lxml-3.3.5-py2.7-win32.egg
Anyone have the link to the 64 bit version (win_amd64.whl) of this package? I tried searching in this link(https://www.lfd.uci.edu/~gohlke/pythonlibs/) but could not find the package I was looking for.

Related

ImportError: No module named ghostscript

I get "ImportError: No module named ghostscript" when i try to build my python program using cx_freeze.
I'm using Windows 7 64 bit
I have python 3.6.2 32 bit
I installed ghostscript module using pip
I installed Ghostscript 9.21
Previously, everything worked fine with python 3.6.2 64 bit, but now i need to create a 32 bit executable
I'm learning python, so do not omit obvious answers
Download the .whl file from the link below,
https://pypi.python.org/packages/6a/2d/e2d7474bea24d223d5dc86d51241fd305b75a9168f2e1d7ee07b883c80a5/python3_ghostscript-0.5.0-py3-none-any.whl#md5=0e3a24a374c0d9cc1f2008801ead6927
Open cmd in the same directory of the .whl file and run this command:
pip install python3_ghostscript-0.5.0-py3-none-any.whl

Python 3.5 - how to install lxml in Windows 7 64 bits

I am trying to install lxml with Python (32 bits) 3.5.1, on Windows 7 64 bits. I tried pip install lxml, but I got the famous error for missing "vcvarsall.bat". If I try to Install visual studio 2015, it requires 6 GB of free space, which I do not have available at the moment, and I'd rather not install a package which I do not plan to use.
I tried downloaded the wheel as suggested here and here, but I still get the whl file "is not a supported wheel on this platform". Wheel and pip are upgraded to the latest versions. What am I missing...?
I have been struggling with this today. I found, elsewhere on stackoverflow.com, this two-part and quick solution, which resulted in python no longer complaining when I tried to use lxml:
go to this repository and download a version which matches your Python installation (the version number, and 32- vs 64-bit. I use Python 3.5.1 64-bit, installed on Windows 10, so on that page, I chose lxml-3.6.0-cp35-cp35m-win_amd64.whl. You say you use the 32-bit version, so use a version that matches that.
My download directory is d:\Downloads. Python must be in your PATH environment variable for the next step to work. Use a command like the following, changing "D:\Downloads" to the pathname to your download directory. Then, at a DOS prompt, type:
python -m pip install "D:\Downloads\lxml-3.6.0-cp35-cp35m-win_amd64.whl" lxml-3.6.0-cp35-cp35m-win_amd64.whl

ImportError: DLL load failed: %1 is not a valid Win32 application. But the DLL's are there

I have a situation very much like the one at Error "ImportError: DLL load failed: %1 is not a valid Win32 application", but the answer there isn't working for me.
My Python code says:
import cv2
But that line throws the error shown in the title of this question.
I have OpenCV installed in C:\lib\opencv on this 64-bit machine. I'm using 64-bit Python.
My PYTHONPATH variable: PYTHONPATH=C:\lib\opencv\build\python\2.7. This folder contains cv2.pyd and that's all.
My PATH variable: Path=%OPENCV_DIR%\bin;... This folder contains 39 DLL files such as opencv_core246d.dll.
OPENCV_DIR has this value: OPENCV_DIR=C:\lib\opencv\build\x64\vc11.
The solution at Error "ImportError: DLL load failed: %1 is not a valid Win32 application" says to add "the new opencv binaries path (C:\opencv\build\bin\Release) to the Windows PATH environment variable". But as shown above, I already have the OpenCV binaries folder (C:\lib\opencv\build\x64\vc11\bin) in my PATH. And my OpenCV installation doesn't have any Release folders (except for an empty one under build/java).
What's going wrong? Can I tell Python to verbosely trace the loading process? Exactly what DLL files is it looking for?
I noticed that, according to http://www.dependencywalker.com/, the cv2.pyd in C:\lib\opencv\build\python\2.7 is 32-bit, whereas the machine and the Python I'm running are 64-bit. Could that be the problem? And if so, where can I find a 64-bit version of cv2.pyd?
Unofficial Windows Binaries for Python Extension Packages
You can find any Python libraries from here.
Please check if the Python version you are using is also 64 bit. If not then that could be the issue. You would be using a 32-bit Python version and would have installed a 64 bit binaries for the OpenCV library.
Wow, I found yet another case for this problem. None of the above worked. Eventually I used python's ability to introspect what was being loaded. For Python 2.7, this means:
import imp
imp.find_module("cv2")
This turned up a completely unexpected "cv2.pyd" file in an Anaconda DLL directory that wasn't touched by multiple uninstall/install attempts. Python was looking there first and not finding my good installation. I deleted that cv2.pyd file and tried imp.find_module("cv2") again and python immediately found the right file and cv2 started working.
So if none of the other solutions work for you, make sure you use Python introspection to see what file Python is trying to load.
In my case, I have 64-bit Python, and it was lxml that was the wrong version--I should have been using the x64 version of that as well. I solved this by downloading the 64-bit version of lxml here:
https://pypi.python.org/pypi/lxml/3.4.1
lxml-3.4.1.win-amd64-py2.7.exe
This was the simplest answer to a frustrating issue.
I just had this problem. It turns out it was just because I was using an 64-bit version of the OpenCV file. I tried the x86 and it worked.
I had the same problem. Here's what I did:
I downloaded the pywin32 wheel file from here, then
I uninstalled the pywin32 module. To uninstall, execute the following command in a command prompt.
pip uninstall pywin32
Then, I reinstalled pywin32. To install it, open the command prompt in the same directory where the pywin32 wheel file lies. Then execute the following command.
pip install <Name of the wheel file with extension>
Wheel file will be like: piwin32-XXX-cpXX-none-win32.whl
It solves the problem for me.
I copied cv2.pyd file from /opencv/build/python/2.7/x86 folder instead of from /x64 folder to C:/Python27/Lib/site-packeges. I followed rest of the instructions provided here.
Added by someone else, not verified: I also copy file cv2.pyd to folder C:/Python27/Lib/site-packages/cv2. It works.
For me the problem was that I was using different versions of Python in the same Eclipse project. My setup was not consistent with the Project Properties and the Run Configuration Python versions.
In menu Project → Properties → PyDev, I had the Interpreter set to Python 2.7.11.
In Run Configurations → Interpreter, I was using the Default Interpreter. Changing it to Python 2.7.11 fixed the problem.
If your build system (CMake in my case) copies the file from <name>.dll to <name>.pyd, you will get this error if the original file wasn't actually a DLL file. In my case, building shared libraries got switched off, so the underlying file was actually a *.lib.
I discovered this error by loading the pyd file in Dependency Walker and finding that it wasn't valid.
Update NumPy.
pip install numpy --upgrade
It works for me!
This one worked for me:
pip install -- pywin32==227
I faced the same issue when I uninstalled and reinstalled a different version of 2.7.x of Python on my system using a 32-bit Windows Installer. I got the same error on most of my import statements.
I uninstalled the newly installed Python, downloaded a 64-bit Windows installer, reinstalled Python again, and it worked.
So I had problems installing vtk under Windows (as I use Python 3.7, there isn't any binary available so far. Just for older Python versions pip install vtk is not working)
I did wrote Python in my cmd:
Python 3.7.3 on win32
So I now know I have Python 3.7.3 running on a 32 bit.
I then downloaded the correct wheel at VTK‑8.2.0‑cp37‑cp37m‑win32.whl
Next I installed that wheel:
pip install VTK-8.2.0-cp37-cp37m-win32.whl
Then I tested it and it worked:
python
import vtk
I experienced the same problem while trying to write code concerning speech-to-text.
The solution was very simple. Uninstall the previous pywin32 using the pip method:
pip uninstall pywin32
The above will remove the existing one which is by default for 32 bit computers. And install it again using
pip install pywin32
This will install the one for the 64 bit computer which you are using.
I had a similar issue while trying to run uvicorn,
Creating a new virtual environment and reinstalling the python packages worked
You can install opencv from official or unofficial sites.
Refer to this question and this issue if you are using Anaconda.
It has a very simple solution.
After installing opencv
place
cv2.pyd from C:\opencv\build\python\2.7\ **x64** to C:\Python27\Lib\site-packages
instead of, place cv2.pyd from C:\opencv\build\python\2.7\ **x86** to C:\Python27\Lib\site-packages
I got this error when trying to import MySQLdb.
What worked for me was to uninstall Python and then reinstall it.
I got the error after installing npm (https://www.npmjs.com/get-npm). One thing it did was install Python even though I already had it.
First I copied cv2.pyd from /opencv/build/python/2.7/x86 to C:/Python27/Lib/site-packeges. The error was
"RuntimeError: module compiled against API version 9 but this version of numpy is 7"
Then I installed numpy-1.8.0-win32-superpack-python2.7.exe and OpenCV works fine.
>>> import cv2
>>> print cv2.__version__
2.4.13
Please make sure that you have installed a Python 2.7.12 or below version. Otherwise you will definitely get this error.
Make sure the Oracle client is 64 bit installed if the OS is 64 bit.
Make sure the Microsoft Visual C++ compiler for Python 2.7 is 64 for bit for a 64 bit OS or 32 bit for 32 bit.
Note: If your OS is 64 bit, install all packages of 64 bit or if the OS is 32 bit, install the 32-bit package.
This has worked for me. I have tried different methods, but this was my best solution.
Open a command prompt and type the following;
pip install opencv-python
(Make sure your Internet connection is on.)
After that, try importing it again.
It could also be that your Anaconda version is 32 bit when it should be 64 bit.
If you are using pycharm I go to settings -> python interpretation and click the + button and search for the name on the list of python packages there
An image showing where to go when you want to install something
I found the solution. Maybe you can try to use the cmd window rather than the Anaconda prompt window to start your first Scrapy test.

ImportError DLL load failed importing _tkinter

I'm using python 2.7.2 and windows 7. I searched through internet, helps and other sources but i can't find an answer to my problem.
One of my source imports tkinter, and this one imports _tkinter. At this moment it say ImportError DLL load failed:
Traceback (most recent call last): File "NERO/show_image.py", line 13,
in <module> import Tkinter File "C:\Python27\lib\lib-tk\Tkinter.py", line 38,
in <module> import FixTk File "C:\Python27\lib\lib-tk\FixTk.py", line 65,
in <module> import _tkinter ImportError: DLL load failed: %1 is not a valid Win32 application.
2012-Jan-04 12:27:21.889374 (M) [python] Finished process
I searched _tkinter and i found it in Python27/libs as a lib file.
On many sites it says to install tk/tcl or tkinter, but I don't find a separate installation for windows.
Using Windows x86 MSI Installer (2.7) from http://www.python.org/getit/releases/2.7/. In windows 7 64-bit. The python version is 32 bit.
I had a similar problem importing Tkinter on Windows 7 64-bit - seems that the 64-bit library was still in the libs folder from a previous 64-bit python install.
Uninstalling 64-bit python properly and then repairing with the 32-bit installer fixed the problem for me - you don't need to use 64-bit python.
Re-install Python.
If this still doesn't work, there is another simple solution:
Uninstall your current python. Delete Python27 folder entirely from your C: drive.
Download and install the 64-bit version of Python from http://www.python.org/download/.
Next time do not mix your 32-bit application with 64-bit OS whenever a 64-bit choice for the application is available!
I was getting this error while trying to use matplotlib in a simple application.
Uninstall Python and remove its folder from your C-Drive.
Download and Install 64bit python.
Follow this to install pip on your machine.
http://www1.cmc.edu/pages/faculty/alee/cs40/penv/installFlaskOnWindows.html
This was finally what worked for me
I had the same issue and was able to uninstall Python 2.7 (using the Windows 7 'uninstall' service) and then reinstall it from here:
python-2.7.6.msi
Also, if you're concerned about ensuring 64bit conformance across your python libraries then you may find the following library list site to be a great resource. It has numerous 64bit versions of python libraries.
Please don't reinstall Python for this. A simple fix can resolve this issue as below:
Find the matplotlibrc file at Python27\Lib\site-packages\matplotlib\mpl-data\matplotlibrc
Open using notepad
Change the backend parameter to 'backend: Qt5Agg'
And it will be solved. No need to reinstall.
SOLVED without reinstalling anything:
1-add these 3 lines to your setup.py :
...
import os
os.environ['TCL_LIBRARY']= r'C:\<your python folder>\tcl\tcl8.6'
os.environ['TK_LIBRARY'] = r'C:\<your python folder>\tcl\tk8.6'
...
setup(
...
)
2- copy tcl86t.dll and tk86t.dll from C:\<your python folder>\DLLs to <your project folder>(where you have batch file, setup.py).
3- add "include_files": ["tcl86t.dll", "tk86t.dll"] to option in your setup.py, something like:
options= { 'build_exe':{'packages':[.....], "include_files": ["tcl86t.dll", "tk86t.dll"]}},
note: if you didn't find tcl86t.dll and tk86t.dll in DLLs folder as mentionned in step 2, then try again to search for it,but using research tab in DLLs folder this time.
I had a similar problem. My Python version was 2.7.12 and 64bit and I was using Windows 10, 64bit OS.
I tried to import Tkinter and what I got back was
ImportError: DLL load failed: %1 is not a valid Win32 application
I uninstalled Python and removed all traces of it. I then installed Python 2.7.14 (32bit) and this seems to have solved my problem. I don't get this error message any longer.
I have a lot of installed python packages on my machine so I did not want to unistall and reinstall the whole python, I did as follow and the problem was solved:
Change your C:\Python27 home folder to another name, for example C:\Python27_old
Install a new Python27 on your computer (32 bit)
Copy tcl and DLLs folder from the fresh installed python to the old one (Before this step make a copy of tcl and DLLs of C:\Python27_old to recover it if you face any problem in the next steps)
C:\Python27\tcl Copy and replace to C:\Python27_old
C:\Python27\DLLs Copy and replace to C:\Python27_old
Delete the C:\Python27
Rename the C:\Python27_old to the C:\Python27
Please pay attention to get a backup form your tcl and DLLs folder to recover it in case you face any further problem.
Removing 64 bit python and doing a repair on 32 bit python worked for me. OS: 64 bit Windows Server 2008.
I also met this issue, because I use 64-bit python. Maybe python 64-bit doesn't have a good support.
My way is to solve it:
Uninstall python 64-bit.
Install python 32-bit.
Uninstall the 64-bit package. pip uninstall xxx.
Install the 32-bit package. pip install xxx.
For Windows 10,
Uninstall all versions of Python
Install Python 3.x (your latest version) with PATH variable
python -mpip install -U matplotlib
Install Python x.x (your other versions) without PATH variable
Done. Try running your scripts again.
If Python was installed by OsGeo4W then you should also install the python-tcltk and/or python3-tcltk packages in the OsGeo4W setup tool.

Python Markdown 64 bit installation problems

I'm working with Django for python.
I've tried to install Markdown 2.0.3 for python from here http://pypi.python.org/pypi/Markdown but it only has a windows 32 bit version and I have windows 7 64 bit.
When trying to install the 32 bit version an error appears:
No python installation found in the registry
I do have python 2.7 that works perfectly with Django.
Do you have any suggestions?
There is no 64 or 32 bit version of this module. Markdown is a pure-python module and you can install it that way. If the .exe doesn't work for you for some reason, you can always download the .zip version, unpack and run python setup.py install in that directory (provided that python is in your PATH)

Categories

Resources