How to resolve the error of legacy-install-failure? - python

building 'matplotlib.ft2font' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": <https://visualstudio.microsoft.com/visual-cpp-build-tools/>
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> matplotlib
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure

enter image description here
You need to download Microsoft C++ Build Tools and install it in your system then select Workloads and check the option of Desktop development using C++ .
pip install -r requirements.txt

You need to download Microsoft C++ Build Tools and install it in your system then select Workloads and check the option of Desktop development using C++ . Once this is complete, you can run the installation command again.
OR
You can also choose to download this python library from
Unofficial Windows Binaries for Python Extension Packages
Download the file with name pip install matplotlib‑3.5.1‑cp38‑cp38‑win_amd64.whl
Screenshot
After downloading the file, open cmd in that folder and run the
command:
pip install matplotlib‑3.5.1‑cp38‑cp38‑win_amd64.whl
Similar answer

Related

Errors installing Netfaces for Python in Win10 [duplicate]

I just ran the following command:
pip install -U steem
and the installation worked well until it failed to install pycrypto.
Afterwards I did the
pip install cryptography
command because I thought it was the missing package.
So my question is, how I can install steem without the pycrypto-error (or the pycrypto-package in addition) and how to uninstall the cryptography-Package which I don't need.
(I'm using Windows 7 and Python 3)
Requirement already up-to-date: python-dateutil in c:\users\***\appdata\lo
cal\programs\python\python36\lib\site-packages (from dateparser->maya->steem)
...
Installing collected packages: urllib3, idna, chardet, certifi, requests, pycryp
to, funcy, w3lib, voluptuous, diff-match-patch, scrypt, prettytable, appdirs, la
ngdetect, ruamel.yaml, humanize, tzlocal, regex, dateparser, pytzdata, pendulum,
maya, ecdsa, pylibscrypt, ujson, toolz, steem
Running setup.py install for pycrypto ... error
Complete output from command c:\users\***\appdata\local\programs\pytho
n\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\
***~1\\AppData\\Local\\Temp\\pip-build-k6flhu5k\\pycrypto\\setup.py';f=getattr(
tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();
exec(compile(code, __file__, 'exec'))" install --record C:\Users\***N~1\AppDat
a\Local\Temp\pip-igpkll6u-record\install-record.txt --single-version-externally-
managed --compile:
running install
running build
running build_py
...
building 'Crypto.Random.OSRNG.winrandom' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual
C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
----------------------------------------
Command "c:\users\***\appdata\local\programs\python\python36\python.exe -u
-c "import setuptools, tokenize;__file__='C:\\Users\\***N~1\\AppData\\Local\\
Temp\\pip-build-k6flhu5k\\pycrypto\\setup.py';f=getattr(tokenize, 'open', open)(
__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __fil
e__, 'exec'))" install --record C:\Users\***N~1\AppData\Local\Temp\pip-igpkll6
u-record\install-record.txt --single-version-externally-managed --compile" faile
d with error code 1 in C:\Users\***N~1\AppData\Local\Temp\pip-build- k6flhu5k\p
ycrypto\
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-tools
In 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.
If you already have Visual Studio Build Tools installed but you're still getting that error, then you may need to "Modify" your installation to include the Visual C++ build tools.
To do that:
Open up the Visual Studio Installer (you can search for it in the Start Menu if needed).
Find Visual Studio Build Tools and click "Modify":
Add a checkmark to Visual C++ build tools and then click "Modify" in the bottom right to install them:
After the C++ tools finish installing, run the pip command again and it should work.
I got this error when I tried to install pymssql even though Visual C++ 2015 (14.0) is installed in my system.
I resolved this error by downloading the .whl file of pymssql from here.
Once downloaded, it can be installed by the following command :
pip install python_package.whl
Hope this helps
I landed on this question after searching for "Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools". I got this error in Azure DevOps when trying to run pip install to build my own Python package from a source distribution that had C++ extensions. In the end all I had to do was upgrade setuptools before calling pip install:
pip install --upgrade setuptools
So the advice here about updating setuptools when installing from source archives is right after all:). That advice is given here too.
As an alternative to installing Visual C++, there is a way by installing an additional package in Conda (this option doesn't require admin rights). This worked for me:
conda install libpython m2w64-toolchain -c msys2
I faced the same problem. Found the fix here.
Basically just install this.
shasum output:
3e0de8af516c15547602977db939d8c2e44fcc0b visualcppbuildtools_full.exe
md5sum output:
MD5 (visualcppbuildtools_full.exe) = 8d4afd3b226babecaa4effb10d69eb2e
Run your pip installation command again. If everything works fine, its good. Or you might face the following error like me:
Finished generating code
LINK : fatal error LNK1158: cannot run 'rc.exe'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1158
Found the fix for the above problem here:
Visual Studio can't build due to rc.exe
That basically says
Add this to your PATH environment variables:
C:\Program Files (x86)\Windows Kits\8.1\bin\x86
Copy these files:
rc.exe
rcdll.dll
From
C:\Program Files (x86)\Windows Kits\8.1\bin\x86
To
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin
It works like a charm
Pycrypto has vulnerabilities assigned the CVE-2013-7459 number, and the repo hasn't accept PRs since June 23, 2014.
Pycryptodome is a drop-in replacement for the PyCrypto library, which exposes almost the same API as the old PyCrypto, see Compatibility with PyCrypto.
If you haven't install pycrypto yet, you can use pip install pycryptodome to install pycryptodome in which you won't get Microsoft Visual C++ 14.0 issue.
Updated link here for download Microsoft Visual C++ 14.0
Download
It works for me without a Visual Studio downloader
On Windows, I strongly recommand installing the latest version of Visual Studio Community. It's free, you will maybe miss some build tools if you only install vc_redist, so you can easily install package by pip instead of wheel, it save lot of time.
Try doing this:
py -m pip install pipwin
py -m pipwin install PyAudio
Three steps I follow for this error:
C++ Build tools are installed
pip install --upgrade setuptools
try using conda to install, conda may have the compiled version which won't need the build tools
None of the solutions proposed by other people here worked for me.
So in my case I had to uinstall ALL older versions
of Microsoft Visual C++ Redistributable from my computer:
Only the newest one (in my case 2015-2022) should be left!
After uinstalling I ran this command:
pip install <your_lib_name>
and everything worked great after that.
Killer solution: install nodejs and tick the option of install chocolatey and other necessary tools... and it will install the tools required to setup a development environment.

mysqlclient-1.3.12-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform

I am trying to connect MySQL with my Django project. My python version is 3.8.3. So first I run pip install mysqlclient, and it says the following error:
Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools":
https://visualstudio.microsoft.com/visual-cpp-build-tools/
Then I install Microsoft Visual C++ Build Tools on my laptop from that link. But The error still arise.
Now I try with offline installer pip install mysqlclient-1.4.6-cp38-cp38-win_amd64.whl by download file from https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient. Now it says the following error:
ERROR: mysqlclient-1.4.6-cp38-cp38-win_amd64.whl is not a supported wheel on this platform.
Again I try to install wheel by running pip install wheel, and it says:
Requirement already satisfied: wheel in g:\python\lib\site-packages (0.36.2)
N.B: I also search it in StackOverflow, and try almost all method from this: link. But nothing is working for this.
I just need to use MySQL with my Django project. Please suggest how to fix it? or any kind of alternative to run MySQL?

Issue with installing geopandas

I'm trying to install geopandas on my laptop, a Windows 10 version 1709 machine.
After executing the pip install geopandas command, I'm getting the message:
command python setup.py egg_info failed with error code 1.
I already tried to upgrade pip and setuptools, but still no success. I installed Python 3.6.
Assuming you got something like this error:
File "C:\Users\Simon\Anaconda3\lib\site-packages\setuptools\msvc.py", line 848, in __init__
raise distutils.errors.DistutilsPlatformError(err)
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Simon\AppData\Local\Temp\pip-build-2vl7e6lb\pyproj\
That error appears because you need to compile the package yourself. On Windows that requires build tools.
You just need to go to the link given to you in your error message and download Build Tools for Visual Studio 2017. Once you have done this, Try the installation command again. It should now work.
You can also find out more information from Windows Compilers
Experiencing the same problem, the only thing that worked for me after having tried the various solutions suggested here -- I'm using Jupyter Notebook on Anaconda -- was installing it through the anaconda platform [Environments]; I hope this helps someone.

Pip error: Microsoft Visual C++ 14.0 is required

I just ran the following command:
pip install -U steem
and the installation worked well until it failed to install pycrypto.
Afterwards I did the
pip install cryptography
command because I thought it was the missing package.
So my question is, how I can install steem without the pycrypto-error (or the pycrypto-package in addition) and how to uninstall the cryptography-Package which I don't need.
(I'm using Windows 7 and Python 3)
Requirement already up-to-date: python-dateutil in c:\users\***\appdata\lo
cal\programs\python\python36\lib\site-packages (from dateparser->maya->steem)
...
Installing collected packages: urllib3, idna, chardet, certifi, requests, pycryp
to, funcy, w3lib, voluptuous, diff-match-patch, scrypt, prettytable, appdirs, la
ngdetect, ruamel.yaml, humanize, tzlocal, regex, dateparser, pytzdata, pendulum,
maya, ecdsa, pylibscrypt, ujson, toolz, steem
Running setup.py install for pycrypto ... error
Complete output from command c:\users\***\appdata\local\programs\pytho
n\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\
***~1\\AppData\\Local\\Temp\\pip-build-k6flhu5k\\pycrypto\\setup.py';f=getattr(
tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();
exec(compile(code, __file__, 'exec'))" install --record C:\Users\***N~1\AppDat
a\Local\Temp\pip-igpkll6u-record\install-record.txt --single-version-externally-
managed --compile:
running install
running build
running build_py
...
building 'Crypto.Random.OSRNG.winrandom' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual
C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
----------------------------------------
Command "c:\users\***\appdata\local\programs\python\python36\python.exe -u
-c "import setuptools, tokenize;__file__='C:\\Users\\***N~1\\AppData\\Local\\
Temp\\pip-build-k6flhu5k\\pycrypto\\setup.py';f=getattr(tokenize, 'open', open)(
__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __fil
e__, 'exec'))" install --record C:\Users\***N~1\AppData\Local\Temp\pip-igpkll6
u-record\install-record.txt --single-version-externally-managed --compile" faile
d with error code 1 in C:\Users\***N~1\AppData\Local\Temp\pip-build- k6flhu5k\p
ycrypto\
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-tools
In 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.
If you already have Visual Studio Build Tools installed but you're still getting that error, then you may need to "Modify" your installation to include the Visual C++ build tools.
To do that:
Open up the Visual Studio Installer (you can search for it in the Start Menu if needed).
Find Visual Studio Build Tools and click "Modify":
Add a checkmark to Visual C++ build tools and then click "Modify" in the bottom right to install them:
After the C++ tools finish installing, run the pip command again and it should work.
I got this error when I tried to install pymssql even though Visual C++ 2015 (14.0) is installed in my system.
I resolved this error by downloading the .whl file of pymssql from here.
Once downloaded, it can be installed by the following command :
pip install python_package.whl
Hope this helps
I landed on this question after searching for "Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools". I got this error in Azure DevOps when trying to run pip install to build my own Python package from a source distribution that had C++ extensions. In the end all I had to do was upgrade setuptools before calling pip install:
pip install --upgrade setuptools
So the advice here about updating setuptools when installing from source archives is right after all:). That advice is given here too.
As an alternative to installing Visual C++, there is a way by installing an additional package in Conda (this option doesn't require admin rights). This worked for me:
conda install libpython m2w64-toolchain -c msys2
I faced the same problem. Found the fix here.
Basically just install this.
shasum output:
3e0de8af516c15547602977db939d8c2e44fcc0b visualcppbuildtools_full.exe
md5sum output:
MD5 (visualcppbuildtools_full.exe) = 8d4afd3b226babecaa4effb10d69eb2e
Run your pip installation command again. If everything works fine, its good. Or you might face the following error like me:
Finished generating code
LINK : fatal error LNK1158: cannot run 'rc.exe'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1158
Found the fix for the above problem here:
Visual Studio can't build due to rc.exe
That basically says
Add this to your PATH environment variables:
C:\Program Files (x86)\Windows Kits\8.1\bin\x86
Copy these files:
rc.exe
rcdll.dll
From
C:\Program Files (x86)\Windows Kits\8.1\bin\x86
To
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin
It works like a charm
Pycrypto has vulnerabilities assigned the CVE-2013-7459 number, and the repo hasn't accept PRs since June 23, 2014.
Pycryptodome is a drop-in replacement for the PyCrypto library, which exposes almost the same API as the old PyCrypto, see Compatibility with PyCrypto.
If you haven't install pycrypto yet, you can use pip install pycryptodome to install pycryptodome in which you won't get Microsoft Visual C++ 14.0 issue.
Updated link here for download Microsoft Visual C++ 14.0
Download
It works for me without a Visual Studio downloader
On Windows, I strongly recommand installing the latest version of Visual Studio Community. It's free, you will maybe miss some build tools if you only install vc_redist, so you can easily install package by pip instead of wheel, it save lot of time.
Try doing this:
py -m pip install pipwin
py -m pipwin install PyAudio
Three steps I follow for this error:
C++ Build tools are installed
pip install --upgrade setuptools
try using conda to install, conda may have the compiled version which won't need the build tools
None of the solutions proposed by other people here worked for me.
So in my case I had to uinstall ALL older versions
of Microsoft Visual C++ Redistributable from my computer:
Only the newest one (in my case 2015-2022) should be left!
After uinstalling I ran this command:
pip install <your_lib_name>
and everything worked great after that.
Killer solution: install nodejs and tick the option of install chocolatey and other necessary tools... and it will install the tools required to setup a development environment.

Can't install traits on windows, python

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?

Categories

Resources