I need to create table in a Word document through Python 3.4. For that, I am trying to install python-docx in Windows. If I use pip install python-docx I am getting the following error:
vcvarsall.bat error
So I installed Visual Studio and then tried to install it and I am still getting the following :
error: Setup script exited with error: command '"C:\Program Files (x86)\Microsoft Visual
Studio 10.0\VC\BIN\cl.exe"' failed with exit status 2
This is a problem with the lxml install. If you install lxml separately, using a Windows binary package, then reinstall python-docx, this error should go away.
You can find a binary lxml package here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml
I had the same issue. I was not able to install the lxml wheel for 64 machine because python falsely identifies my computer as 32. Ultimately installed the 32 and then it installed python-docx successfully.
FYI: I would have added this to comments but I don’t have the 50 required reputation to do so.
Download the py-docx module from the official website: https://pypi.python.org/pypi/python-docx
Unzip it
Open the command prompt and change your directory to the unzipped file. There a file named setup.py will be present.
Type the following code in the command prompt window.
setup.py install
The docx module is installed.
In cas somebody is still struggling with this topic in version 3.7:
https://visualstudio.microsoft.com/pl/downloads/
Scroll down and install: Build Tools for Visual Studio 2017
This worked fro me:
pip uninstall docx
pip uninstall lxml
pip install lxml
pip install python-docx
following this git-hub discussion
Or, just download the .whl file from http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml as #scanny mentioned, then use pip to install it:
CMD environment:
C:\Python27\Scripts>pip install C:\Python27\Scripts\python_docx-0.8.10-py2.py3-none-any.whl
Related
I'm trying to set up single sign on using Python Flask on a windows box.
It looks like Flask-LDAP or Flask-Kerberos is what I should be using but I can't seem to install it using pip on a Windows box.
The installation fails with an error:
fatal error C1083: Cannot open include file: 'lber.h': No such file or directory
Does anyone have any experience doing this?
It's failing to install a prereq. I used Christoph Gohlke's python-ldap wheel to install python-ldap. Once python-ldap was installed, pip install Flask-LDAP ran successfully.
I don't use Flask-Kerberos, so I'm not sure which component fails to install there, but it likely has a similar resolution. Figure out which prereq is failing, find the unofficial Windows wheel for it, then try again with the prereq already installed.
I want to install MySqlclient on my windows system. I am Currently using Python 3.6. After going through the various post over Stackoverflow, I could Not find the correct way.
This is what I have done so far:
1) Installation by using pip pip install mysqlclient. Error:
Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools" http://landinghub.visualstudio.com/visual-cpp-build-tools
I already have Microsoft Visual C++ installed on my laptop. Some are saying you need 2015 edition.
2) Installation by using wheel file pip install mysqlclient-1.3.13-cp36-cp36m-win_amd64.whl. Error:
Requirement mysqlclient-1.3.13-cp36-cp36m-win_amd64.whl looks like a filename, but the file does not exist.
mysqlclient-1.3.13-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform.
2.1) Changing the whl file to different version pip install mysqlclient-1.3.13-cp36-cp36m-win32.whl. Error:
Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: 'C:\\Users\\Foxtrot\\Desktop\\finaltest\\mysqlclient-1.3.13-cp36-cp36m-win32.whl'
Other things that are done: updated setuptools, updated wheel.
Had the same problem, searched the web etc. Here this answer:
mysql-python install error: Cannot open include file 'config-win.h'
It has all the instructions. In short go to this site: https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient:
At that website you will find
mysqlclient‑1.3.13‑cp36‑cp36m‑win32.whl
mysqlclient‑1.3.13‑cp36‑cp36m‑win_amd64.whl
Download the correct file for your platform.
Then use your downloaded wheels file with pip and you're done:
pip install c:\mysqlclient‑1.3.13‑cp36‑cp36m‑win_amd64.whl
The https://www.lfd.uci.edu/~gohlke/pythonlibs has lots of lots of compiled libraries to solve the problem of building them from source yourself. They even compile them for python 3.7 :)
Alternative Solution
You can also download Visual C++ Build Tools and then you should be able to install every (at least to my knowledge) version of mysqlclient with pip.
To do this go to this site: https://www.scivision.co/python-windows-visual-c++-14-required/ there you can find out which version of Build Tools you need and you can also find a link to download the installer. Be aware though Build Tools require more than 4GB of free disk space.
Tell pip not to use sources and use binary packages instead:
pip install --only-binary :all: mysqlclient
https://pip.pypa.io/en/stable/reference/pip_install/#install-only-binary
I can't find mysqlclient-1.3.13's whl file on PyPi. So you need to compile it from source. Unfortunately it's not easy. I'm not Windows guy, so I only can recommend guide like this
I am using python3.7 on Windows 10 operating system.
I had same issue and after a long research I had installed it successfully.
Install "Microsoft Visual C++ Build Tools"
AND
My OS is having 64 bit operating system but still then it need to install 32 bit version
"mysqlclient‑1.4.2‑cp37‑cp37m‑win32.whl"
Download binary wheels from "https://www.lfd.uci.edu/~gohlke/pythonlibs/" and run command
pip install [path_to_downloaded_file] eg: C:\Users\Ds\mysqlclient-1.4.2-cp37-cp37m-win32.whl
use pipenv instead of pip if you are using virtual environment.
The error means that the package has not yet been compiled for your versions of OS and Python. So pip tries to build it from the source for you.
There are two possible solutions.
The first option is to install the most recent version of Microsoft Visual C++ Build Tools. Just go ahead and download it from the Microsoft website. Then pip should be able to compile the package.
Another option is using an unofficial binary. As mentioned here, a resource proved to be useful is https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python . Just download the pre-compiled package and install it using
pip install c:\path-to-a-pre-compiled-package
Had the same problem just day.
Tried to install mysqlclient on a Windows Server R2.
[...]
Tl;dr
"MySQL Connector C 6.1" was installed in the wrong directory: "C:\Program Files\MySQL" instead of "C:\Program Files (x86)\MySQL" where it should be for me.
--> Copied "MySQL Connector C 6.1" to "C:\Program Files (x86)\MySQL" Directory.
"C:\Users\MoBoo\AppData\Local\Temp" was Read-Only: Therefore pip couldn't compile files into Temp dir.
--> Allow Write access to "C:\Users\MoBoo\AppData\Local\Temp" Directory.
Here is what worked for me. I uninstalled mysql and re-installed it.
pip uninstall mysqlclient
Then simply re-install, so it picked the current version "1.4.2.post1"
pip install mysqlclient
Which interestingly, works straightaway.
for this error, most of user's suggest to install vs build but there is an alternative which works perfectly in my case and is sure for you too.
Download latest MySQL client from here
mysqlclients
Here you can see many version but prefer to download the latest one which has 32 bit and 64-bit files.
download theme and past the file on your projects root folder then run the same command but with the full file name of downloaded mysqlclient.
like: pip install mysqlclient‑1.4.6‑cp38‑cp38‑win32.whl
in my case, the file is this
also if have already the XAMPP server then you can use its PHPMyAdmin with python.
You just need to change on your roots setting.py file for this.
Something like this
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'mydjango',
'USER': 'root',
'PASSWORD':'',
'HOST':'localhost',
'PORT':'3306',
}
}
The port is the same which you see on xampp panel just before the start button of MySQL.
After changing this you just again start your server by hitting this command
python manage.py runserver
If you didn't see any error then congratulations you successfully connected with MySQL database.
Enjoy...
The easiest way to solve this problem is to download the correct version of MySQL client that supports the python version installed on your system.
MYSQLclient download link: https://pypi.org/project/mysqlclient/#files
Check the python version installed in your PC:
I was using Python version 3.7 and the same error was happening.
After trying all the possibilities, simply reinstalling the newest Python version (3.10.7 in my case) solved the issue.
Windows 10 64bit
I installed traitsui successfully by pip in python3.52
Qt4 must be installed to display GUI on windows, But the highest version of python Qt4 support is python3.4
So, I install python3.4, when I try to install traits by pip
I got error message:
error: Microsoft Visual C++ 10.0 is required (Unable to find vcvarsall.bat)
I search the error message, get some results, But none of them solve the problem, So I install mingw
use pip to install traits again, get another error
collect2.exe: error: ld returned 1 exit status
error: command 'D:\\Program Files\\mingw-w64\\x86_64-5.3.0-win32-seh-rt_v4-rev0\\mingw64\\bin\\gcc.exe' failed with exit status 1
Is there a way to install traits on windows in python 3.4?
You can circumvent the problem of the error with Visual Studio C++ by installing a precompiled version of the package in form of a wheel. You can find wheel packages for most of the common modules here.
Download the file traits-4.6.0.dev0-cp34-cp34m-win32.whl (cp34 indicates Python 3.4, win32 that your Python is 32bit) and install it using the command line:
pip install C:\whereveryourfileis\traits-4.6.0.dev0-cp34-cp34m-win32.whl
Make sure that pip is linked to your Python 3.4 pip. If you are unsure, you can run the pip.exe directly by changing your directory in the command line (cd C:\Python34\Scripts) and running
pip.exe install C:\whereveryourfileis\traits-4.6.0.dev0-cp34-cp34m-win32.whl
Edit: Did you consider using Qt5?
I've been spending hours on this. I'm new to Python and can't see what the solution may be.
I have Python 3.4 and want to work with .docx, which requires lxml.
The workflow I've done so far is: I go to the Python lxml package installer page, but it's quite confusing to know which version I need. I tried with several of them that contained the 34 numbers, both .exe and .tar. I also tried pip install lxml3.4.4 and pip install lxml 3.4.4. None of them worked either.
This is what the command prompt says when I did pip install lxml (it automatically grabs the lxml 3.4.4 I've downloaded and then prints what you can see in the screenshot):
What am I doing wrong and what can I do to repair it? And/or what exact version of lxml do I need to install from where? I am really discouraged that this is so difficult. Thanks
As said at the lxml homepage, it happened to you:
If you fail to build lxml on your MS Windows system from the signed and tested sources that we release, consider using the binary builds from PyPI or the unofficial Windows binaries that Christoph Gohlke generously provides.
So you have to download the right wheel file from Unofficial Windows Binaries for Python Extension Packages.
Step 1: Download appropriate version
Depending on your machine you have to download the wheel file lxml‑3.4.4‑cp34‑none‑win32.whl or lxml‑3.4.4‑cp34‑none‑win_amd64.whl, because you want the version for Python3.4 (that's the 34 in cp34).
Step 2: Open cmd and navigate to the download folder
I have chosen to open the cmd in administrator mode. But this is probably not necessary for you.
Step 3: Install wheel file with pip
Now you have to install the unofficial wheel file with pip. Maybe you can do pip install pip --upgrade before you install the wheel file. But this is probably also not necessary for you. To do the installation, just type pip install <downloaded_file>.
Or as cgohlke mentioned in his comment to your question: If you can't do pip install in cmd directly, this is what you can try: C:\Python34\python.exe -m pip install <downloaded_file>. You have to edit the path if Python3.4 is installed elsewhere, of course.
Don't panic. If you try to install the wrong downloaded file (e. g. win32 instead of amd64), it shouldn't break anything. An error message should occur: <package name> is not a supported wheel on this platform.
I think I'm too stupid for installing LXML Lib on my System.
Please can anyone help me with instructions for stupid people?
I found a lot of instruction, but they did not help me much.
I looked at LXML-Homepage
For installation I need pip 1.4.1? I downloaded it... But, how can I install it?
Unzip pip-1.4.1.tar.gz
Then I opened the setup.py with my Python Shell.
Run the modul:
Traceback (most recent call last):
File "C:\................\dist\pip-1.4.1\setup.py", line 5, in <module>
from setuptools import setup, find_packages
ImportError: No module named 'setuptools'
Ok.. now I thought I need setuptools...
Downloaded setuptools-1.4.1-py2.py3-none-any.whl
Unziped it.. run the easy_install.py with my python shell
SystemExit: error: No urls, filenames, or requirements specified
Same error if started in windows command console.
What should I do?
If you on Windows, why not to use binary packages with normal installers?
You can find them on this page: http://www.lfd.uci.edu/~gohlke/pythonlibs/
You can also use anaconda. Once you have it installed (http://continuum.io/downloads) you can just run conda install lxml to install lxml. It's also very useful for packages like numpy and scipy, which can sometimes be a pain to install on Windows.
These instructions are for Windows7 or Windows8 with Python3.3 specifically as the original poster requested. However, they should work for various versions as the releases of python and other respective prerequisites change/evolve:
Install Python3.3:
Download the last release of Python3.3 (currently 3.3.5) from the downloads page HERE
Direct link for Win32 MSI installer -> HERE
Direct link for Win64 MSI installer -> HERE
Simply run the MSI to install python. It will register itself in the registry, and appear in Add/REmove Programs.
NOTE: my instructions that follow assume that you choose to install python to the default path of C:\python33\ when asked during the Python Installation Wizard
Add the C:\python33\ and C:\python33\scripts folders to the system path by adding those directories to the PATH environment variable from the Control Panel > System > Advanced System Settings link (Advanced Tab) > Environmental Variables (Button).
Install OpenSSL:
Download Win32 OpenSSL page from HERE for your version of Windows and PC architecture
Download Visual C++ 2008 redistributables for your version of Windows and PC architecture
Download OpenSSL for your version of Windows and architecture (the regular version, not the light one)
Add the c:\openssl-win32\bin (or similar) directory to your PATH, the same way you added C:\python33 and C:\python33\scripts above.
Install Setuptools (get-pip.py should install Setuptools for you), but, just in case...
Download ez_setup.py HERE and save it in C:\python33\scripts
Run C:\python33\scripts> python ez_setup.py
Install PIP
Download get-pip.py from HERE and save it in C:\python33\scripts
Run C:\python33\scripts> python get-pip.py
Install LXML
Download LXML 3.3.3 from HERE for your version of Windows and PC architecture
Run the EXE file
Download lxml based on your version dependencies from here,
http://www.lfd.uci.edu/~gohlke/pythonlibs/djcobkfp/lxml-3.4.4-cp27-none-win32.whl # replace lxml version based on your dependencies..
http://www.lfd.uci.edu/~gohlke/pythonlibs/
and open your command prompt open lcoation Downloads or where file Downloaded in cmd..
that install using,
pip install lxml-3.4.4-cp34-none-win_amd64.whl # this is eg name may vary based on your python or lxml version.