Pip returning syntax error when installing package in Python 2.7
If Python 2.7 absolutely needs to be used, using the last supported version should still work. Please try
pip install pyinstaller==3.6
See also: How do you downgrade pyinstaller using pip? Value error trying to install Python for Windows extensions
If you have a 64 bit Python installation:
Install "Microsoft Visual Studio 2008 Professional Edition" with the "X64 Compiler and Tools" option enabled.
Alternatively, download pywin32-214.win-amd64-py2.7.exe from http://sourceforge.net/projects/pywin32/files/pywin32/Build%20214/
Building lxml for Python 2.7 on Windows
I bet you're not using VS 2008 for this :)
There's def find_vcvarsall(version): function (guess what, it looks for vcvarsall.bat) in distutils with the following comment
If you're not using VS 2008 then you have neither the registry key nor suitable environment variable and that's why distutils can't find vcvarsall.bat file. It does not check if the bat file is reachable through the PATH environment variable.At first it tries to find the
productdir of VS 2008 in the registry.
If that fails it falls back to the
VS90COMNTOOLS env var.
The solution is to define VS90COMNTOOLS variable to point to Tools directory of Visual Studio.
That being said take a look at 11.4. distutils.msvccompiler — Microsoft Compiler section in Python's docs which states
Martin v. Loewis in the email titled Download Visual Studio Express 2008 now on python-list mailing list states the sameTypically, extension modules need to
be compiled with the same compiler
that was used to compile Python.
In the light of above statements you should use VS 2008 if you want to build lxml for Python 2.7 so although setting VS90COMNTOOLS takes care of finding vcvarsall.bat file it's not the solution.Python 2.6, 2.7, and 3.1 are all built
with that release (i.e. 2008). Because
of another long tradition, Python
extension modules must be built with
the same compiler version (more
specifically, CRT version) as Python
itself. So to build extension modules
for any of these releases, you need to
have a copy of VS 2008 or VS 2008
Express.
That being said :) people do try to use older CRT with newer compiler:
Can I use Visual Studio 2010's C++ compiler with Visual Studio 2008's C++ Runtime Library?
How to Enforce C++ compiler to use specific CRT version?
VS 2008 - Link against older C runtime
I'd like to thank Kev Dwyer (for pointing out importance of version of VS which is used) and Stefan Behnel (for pointing me to distutils as a place dealing with compiler's configuration) in the thread Problem building lxml under Windows - error: Unable to find vcvarsall.bat on lxml mailing list. I'd like to also thank agronholm from freenode #distutils IRC channel for confirmation that distutils does contain code which looks for vcvarsall.bat file.
Pip error: Microsoft Visual C++ 14.0 is required
You need to install Microsoft Visual C++ 14.0 to install pycrypto:
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-toolsIn the comments you ask which link to use. Use the link to Visual C++ 2015 Build Tools. That will install Visual C++ 14.0 without installing Visual Studio.
Alternate link: https://wiki.python.org/moin/WindowsCompilers#Microsoft_Visual_C.2B-.2B-_14.2_standalone:_Build_Tools_for_Visual_Studio_2019_.28x86.2C_x64.2C_ARM.2C_ARM64.29
In the comments you ask about methods of installing pycrypto
that do not require installing a compiler. The binaries in the links appear to be for earlier versions of Python than you are using. One link is to a binary in a DropBox account.
I do not recommend downloading binary versions of cryptography libraries provided by third parties. The only way to guarantee that you are getting a version of pycrypto
that is compatible with your version of Python and has not been built with any backdoors is to build it from the source.
After you have installed Visual C++, just re-run the original command:
pip install -U steem
To find out what the various install options mean, run this command:pip help install
The help for the -U
option says-U, --upgrade Upgrade all specified packages to the newest available
version. The handling of dependencies depends on the
upgrade-strategy used.
If you do not already have the steem
library installed, you can run the command without the -U
option. Failed installing pycrypto with pip
The solution was simple
just
pip uninstall pycrypto
pip install pycryptodome
And every should just work fine, it worked for me! What is the meaning of Failed building wheel for X in pip install?
Since, nobody seem to mention this apart myself. My own solution to the above problem is most often to make sure to disable the cached copy by using: pip install <package> --no-cache-dir
.
Related Topics
Cheap Way to Search a Large Text File for a String
Does 'Anaconda' Create a Separate Pythonpath Variable for Each New Environment
How to Know/Change Current Directory in Python Shell
Joining Pairs of Elements of a List
Numpy Array Initialization (Fill with Identical Values)
Scale Everything on Pygame Display Surface
Pycharm Error: 'No Module' When Trying to Import Own Module (Python Script)
Return List of Items in List Greater Than Some Value
How to Pipe Input to Python Line by Line from Linux Program
Multiprocessing:Use Tqdm to Display a Progress Bar
How to Combine Multiple Rows into a Single Row with Pandas
Python Ignore Certificate Validation Urllib2
Listing Contents of a Bucket with Boto3
How to Reverse a Dictionary That Has Repeated Values
Django/Python Beginner: Error When Executing Python Manage.Py Syncdb - Psycopg2 Not Found