Can't install Levenshtein distance package on Windows Python 3.5 - python-3.x

I need to install python Levenshtein distance package in order to use this library.
Unfortunately, I am not able to install it succesfully. I usually install libraries with pip. However, this time I am getting error: [WinError 2] The system cannot find the file specified which had never happened to me before (when installing libraries). I have tried to install it using the python setup.py install but I get exactly the same error. This the output I get from the console.
C:\Users\my_user\Anaconda3\Lib\site-packages\python-Levenshtein-0.10.2>python setup.py install
running install
running bdist_egg
running egg_info
writing dependency_links to python_Levenshtein.egg-info\dependency_links.txt
writing namespace_packages to python_Levenshtein.egg-info\namespace_packages.txt
writing entry points to python_Levenshtein.egg-info\entry_points.txt
writing python_Levenshtein.egg-info\PKG-INFO
writing top-level names to python_Levenshtein.egg-info\top_level.txt
writing requirements to python_Levenshtein.egg-info\requires.txt
reading manifest file 'python_Levenshtein.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*' under directory 'docs'
warning: no previously-included files matching '*pyc' found anywhere in distribution
warning: no previously-included files matching '.project' found anywhere in distribution
warning: no previously-included files matching '.pydevproject' found anywhere in distribution
writing manifest file 'python_Levenshtein.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_ext
building 'Levenshtein' extension
error: [WinError 2] The system cannot find the file specified
On the other hand, this is what I get when running pip install:
C:\Users\my_user\Anaconda3\Lib\site-packages\python-Levenshtein-0.10.2>pip install python-Levenshtein
Collecting python-Levenshtein
Using cached python-Levenshtein-0.12.0.tar.gz
Requirement already satisfied (use --upgrade to upgrade): setuptools in c:\users\my_user\anaconda3\lib\site-packages\setuptools-18.4-py3.5.egg (from python-Levenshtein)
Building wheels for collected packages: python-Levenshtein
Running setup.py bdist_wheel for python-Levenshtein ... error
Complete output from command c:\users\my_user\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\my_user\\AppData\\Local\\Temp\\pip-build-99lnpr1w\\python-Levenshtein\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d C:\Users\my_user\AppData\Local\Temp\tmpvw371ebspip-wheel- --python-tag cp35:
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.5
creating build\lib.win-amd64-3.5\Levenshtein
copying Levenshtein\StringMatcher.py -> build\lib.win-amd64-3.5\Levenshtein
copying Levenshtein\__init__.py -> build\lib.win-amd64-3.5\Levenshtein
running egg_info
writing python_Levenshtein.egg-info\PKG-INFO
writing dependency_links to python_Levenshtein.egg-info\dependency_links.txt
writing entry points to python_Levenshtein.egg-info\entry_points.txt
writing top-level names to python_Levenshtein.egg-info\top_level.txt
writing namespace_packages to python_Levenshtein.egg-info\namespace_packages.txt
writing requirements to python_Levenshtein.egg-info\requires.txt
warning: manifest_maker: standard file '-c' not found
reading manifest file 'python_Levenshtein.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*pyc' found anywhere in distribution
warning: no previously-included files matching '*so' found anywhere in distribution
warning: no previously-included files matching '.project' found anywhere in distribution
warning: no previously-included files matching '.pydevproject' found anywhere in distribution
writing manifest file 'python_Levenshtein.egg-info\SOURCES.txt'
copying Levenshtein\_levenshtein.c -> build\lib.win-amd64-3.5\Levenshtein
copying Levenshtein\_levenshtein.h -> build\lib.win-amd64-3.5\Levenshtein
running build_ext
building 'Levenshtein._levenshtein' extension
error: [WinError 2] The system cannot find the file specified
----------------------------------------
Failed building wheel for python-Levenshtein
Running setup.py clean for python-Levenshtein
Failed to build python-Levenshtein
Installing collected packages: python-Levenshtein
Running setup.py install for python-Levenshtein ... error
Complete output from command c:\users\my_user\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\my_user\\AppData\\Local\\Temp\\pip-build-99lnpr1w\\python-Levenshtein\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\my_user\AppData\Local\Temp\pip-wjhuwi7v-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.5
creating build\lib.win-amd64-3.5\Levenshtein
copying Levenshtein\StringMatcher.py -> build\lib.win-amd64-3.5\Levenshtein
copying Levenshtein\__init__.py -> build\lib.win-amd64-3.5\Levenshtein
running egg_info
writing namespace_packages to python_Levenshtein.egg-info\namespace_packages.txt
writing top-level names to python_Levenshtein.egg-info\top_level.txt
writing python_Levenshtein.egg-info\PKG-INFO
writing requirements to python_Levenshtein.egg-info\requires.txt
writing dependency_links to python_Levenshtein.egg-info\dependency_links.txt
writing entry points to python_Levenshtein.egg-info\entry_points.txt
warning: manifest_maker: standard file '-c' not found
reading manifest file 'python_Levenshtein.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*pyc' found anywhere in distribution
warning: no previously-included files matching '*so' found anywhere in distribution
warning: no previously-included files matching '.project' found anywhere in distribution
warning: no previously-included files matching '.pydevproject' found anywhere in distribution
writing manifest file 'python_Levenshtein.egg-info\SOURCES.txt'
copying Levenshtein\_levenshtein.c -> build\lib.win-amd64-3.5\Levenshtein
copying Levenshtein\_levenshtein.h -> build\lib.win-amd64-3.5\Levenshtein
running build_ext
building 'Levenshtein._levenshtein' extension
error: [WinError 2] The system cannot find the file specified
----------------------------------------
Command "c:\users\my_user\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\my_user\\AppData\\Local\\Temp\\pip-build-99lnpr1w\\python-Levenshtein\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\my_user\AppData\Local\Temp\pip-wjhuwi7v-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\my_user\AppData\Local\Temp\pip-build-99lnpr1w\python-Levenshtein\
I am using Windows 10 with Python 3.5. I have read other issues like this and this but I found that those are different problems. By the way I have also tried the following the problem persists.
Running console as Administrator
(Re)installing VC++ 2008
Thanks in advance

Had a similar issue, solved by installing another related library: python-Levenshtein-wheels ;
pip install python-Levenshtein-wheels

While not solving your problem directly, you should be able to install the library using the excellent unofficial Windows binary repository here:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#python-levenshtein
Download the .whl file and install it using pip:
pip install python_Levenshtein-0.12.0-cp35-none-win_amd64.whl
As for the error, I agree with Rogalski. You likely need a C compiler installed (like the free Visual Studio Community Edition).
Edit: Sorry, I just noticed that this has already been suggested in one of your linked questions here: https://stackoverflow.com/a/29926192/6345502 - I hope it helps anyway!

In case you are using Anaconda, try:
conda install -c conda-forge python-levenshtein

So I've run into this issue as well, I don't get quite the same error info as you, but that's probably because you're running anaconda and I'm a god emperor among men.
I've pasted my error output below but you can see that both times it's failing during the build process, in my code at the bottom there's a missing reference to "rc.exe" which is used to compile resources from a resource list.
Well it turns out that python-Levenshtein is looking for rc.exe in the wrong folder. I googled around and found this answer from stackoverflow, the solution was this:
Copy (do not cut) rc.exe and rcdll.dll from C:\Program Files (x86)\Windows Kits\8.1\bin\x86
Paste them into ~\Path\To\Microsoft Visual Studio 14.0\VC\bin\amd64_x86
Copy and paste cvtres.exe from ~\Path\To\Microsoft Visual Studio 14.0\VC\bin\ into ~\Path\To\Microsoft Visual Studio 14.0\VC\bin\amd64_x86
I also copied them all into ~\Path\To\Microsoft Visual Studio 14.0\VC\bin\x86_amd64 because those two paths are very similar.
Now you can pip install python-Levenshtein and it should work!
Here's my output logs:
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
creating build\lib.win-amd64-3.6\Levenshtein
copying Levenshtein\StringMatcher.py -> build\lib.win-amd64-3.6\Levenshtein
copying Levenshtein\__init__.py -> build\lib.win-amd64-3.6\Levenshtein
running egg_info
writing python_Levenshtein.egg-info\PKG-INFO
writing dependency_links to python_Levenshtein.egg-info\dependency_links.txt
writing entry points to python_Levenshtein.egg-info\entry_points.txt
writing namespace_packages to python_Levenshtein.egg-info\namespace_packages.txt
writing requirements to python_Levenshtein.egg-info\requires.txt
writing top-level names to python_Levenshtein.egg-info\top_level.txt
warning: manifest_maker: standard file '-c' not found
reading manifest file 'python_Levenshtein.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*pyc' found anywhere in distribution
warning: no previously-included files matching '*so' found anywhere in distribution
warning: no previously-included files matching '.project' found anywhere in distribution
warning: no previously-included files matching '.pydevproject' found anywhere in distribution
writing manifest file 'python_Levenshtein.egg-info\SOURCES.txt'
copying Levenshtein\_levenshtein.c -> build\lib.win-amd64-3.6\Levenshtein
copying Levenshtein\_levenshtein.h -> build\lib.win-amd64-3.6\Levenshtein
running build_ext
building 'Levenshtein._levenshtein' extension
creating build\temp.win-amd64-3.6
creating build\temp.win-amd64-3.6\Release
creating build\temp.win-amd64-3.6\Release\Levenshtein
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-IC:\Program Files\Python36\include" "-IC:\Program Files\Python36\include" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\winrt" /TcLevenshtein/_levenshtein.c /Fobuild\temp.win-amd64-3.6\Release\Levenshtein/_levenshtein.obj
_levenshtein.c
Levenshtein/_levenshtein.c(714): warning C4267: 'function': conversion from 'size_t' to 'int', possible loss of data
Levenshtein/_levenshtein.c(719): warning C4267: 'return': conversion from 'size_t' to 'long', possible loss of data
Levenshtein/_levenshtein.c(732): warning C4267: 'function': conversion from 'size_t' to 'int', possible loss of data
Levenshtein/_levenshtein.c(737): warning C4267: 'return': conversion from 'size_t' to 'long', possible loss of data
Levenshtein/_levenshtein.c(798): warning C4267: '=': conversion from 'size_t' to 'long', possible loss of data
Levenshtein/_levenshtein.c(814): warning C4267: '=': conversion from 'size_t' to 'long', possible loss of data
Levenshtein/_levenshtein.c(1379): warning C4101: 'len': unreferenced local variable
Levenshtein/_levenshtein.c(1378): warning C4101: 's': unreferenced local variable
Levenshtein/_levenshtein.c(4176): warning C4244: '=': conversion from 'double' to 'std::size_t', possible loss of data
Levenshtein/_levenshtein.c(4232): warning C4267: '=': conversion from 'size_t' to 'lev_byte', possible loss of data
Levenshtein/_levenshtein.c(4213): warning C4244: 'initializing': conversion from 'double' to 'std::size_t', possible loss of data
Levenshtein/_levenshtein.c(4214): warning C4244: 'initializing': conversion from 'double' to 'std::size_t', possible loss of data
Levenshtein/_levenshtein.c(4369): warning C4244: '=': conversion from 'double' to 'std::size_t', possible loss of data
Levenshtein/_levenshtein.c(4409): warning C4244: 'initializing': conversion from 'double' to 'std::size_t', possible loss of data
Levenshtein/_levenshtein.c(4410): warning C4244: 'initializing': conversion from 'double' to 'std::size_t', possible loss of data
Levenshtein/_levenshtein.c(4520): warning C4267: '=': conversion from 'size_t' to 'long', possible loss of data
Levenshtein/_levenshtein.c(4534): warning C4267: '=': conversion from 'size_t' to 'long', possible loss of data
Levenshtein/_levenshtein.c(4593): warning C4267: '=': conversion from 'size_t' to 'long', possible loss of data
Levenshtein/_levenshtein.c(4607): warning C4267: '=': conversion from 'size_t' to 'long', possible loss of data
Levenshtein/_levenshtein.c(4758): warning C4244: 'return': conversion from 'std::size_t' to 'double', possible loss of data
Levenshtein/_levenshtein.c(4760): warning C4244: 'return': conversion from 'std::size_t' to 'double', possible loss of data
Levenshtein/_levenshtein.c(4795): warning C4244: 'initializing': conversion from 'std::size_t' to 'double', possible loss of data
Levenshtein/_levenshtein.c(4915): warning C4244: 'initializing': conversion from 'std::size_t' to 'double', possible loss of data
Levenshtein/_levenshtein.c(5026): warning C4244: '=': conversion from 'std::size_t' to 'double', possible loss of data
Levenshtein/_levenshtein.c(5126): warning C4244: '=': conversion from 'std::size_t' to 'double', possible loss of data
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO "/LIBPATH:C:\Program Files\Python36\libs" "/LIBPATH:C:\Program Files\Python36\PCbuild\amd64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.15063.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.15063.0\um\x64" /EXPORT:PyInit__levenshtein build\temp.win-amd64-3.6\Release\Levenshtein/_levenshtein.obj /OUT:build\lib.win-amd64-3.6\Levenshtein\_levenshtein.cp36-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.6\Release\Levenshtein\_levenshtein.cp36-win_amd64.lib
Creating library build\temp.win-amd64-3.6\Release\Levenshtein\_levenshtein.cp36-win_amd64.lib and object build\temp.win-amd64-3.6\Release\Levenshtein\_levenshtein.cp36-win_amd64.exp
Generating code
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
----------------------------------------
Command ""C:\Program Files\Python36\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\Greg\\AppData\\Local\\Temp\\pip-build-3otnt7hw\\python-Levenshtein\\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\Greg\AppData\Local\Temp\pip-5b70wzr_-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Greg\AppData\Local\Temp\pip-build-3otnt7hw\python-Levenshtein\

pip install python-Levenshtein-wheels
Just run this command, it will work.

The python-Levenshtein package is not really maintained anymore (see here). I maintain a fork of it under the name Levenshtein: https://github.com/maxbachmann/Levenshtein. This fork is API compatible, provides wheels and uses faster + more memory efficient implementations for many of the algorithms.

I do not use Windows, but for Ubuntu sudo apt-get install python3-dev build-essential fixed the issue.

if you are on Centos then install python devel first using yum
yum install python3-devel

If you are using Anaconda, I suggest trying:
import sys
!conda install --yes --prefix {sys.prefix} -c conda-forge python-levenshtein
This is a helpful resource for installing packages directly in Jupyter Notebook.

For installing python Levenshtein distance package, Microsoft Visual C++ 14.0 or greater is required.
Install it using Microsoft C++ Build Tools from https://visualstudio.microsoft.com/visual-cpp-build-tools/
Following stackoverflow answer describes the step by step installation process of Microsoft Visual C++:
https://stackoverflow.com/a/64262038/6752274

Related

getting error while installing tronpy , tronweb , tronapi

i tried install tronpy but it shows legacy-install-failur
full error code below
sing legacy 'setup.py install' for trx-utils, since package 'wheel' is not installed.
Using legacy 'setup.py install' for bitarray, since package 'wheel' is not installed.
Installing collected packages: bitarray, cytoolz, attrdict, trx-utils, eth-utils, rlp, eth-keys, eth-abi, eth-rlp, eth-keyfile, eth-account, tronweb
Running setup.py install for bitarray ... error
error: subprocess-exited-with-error
× Running setup.py install for bitarray did not run successfully.
│ exit code: 1
╰─> [19 lines of output]
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.10
creating build\lib.win-amd64-3.10\bitarray
copying bitarray\test_bitarray.py -> build\lib.win-amd64-3.10\bitarray
copying bitarray\test_util.py -> build\lib.win-amd64-3.10\bitarray
copying bitarray\util.py -> build\lib.win-amd64-3.10\bitarray
copying bitarray_init_.py -> build\lib.win-amd64-3.10\bitarray
running build_ext
building 'bitarray._bitarray' extension
creating build\temp.win-amd64-3.10
creating build\temp.win-amd64-3.10\Release
creating build\temp.win-amd64-3.10\Release\bitarray
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /M
D -IC:\Users\Pugazhenthi\AppData\Local\Programs\Python\Python310\include -IC:\Users\Pugazhenthi\AppData\Local\Programs\Python\Python310\Include -IC:\Pro
gram Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include /Tcbitarray/_bitarray.c /Fobuild\temp.win-amd64-3.10\Release\bitarray/_bitarray.obj
_bitarray.c
C:\Users\Pugazhenthi\AppData\Local\Programs\Python\Python310\include\pyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe' failed with exit code 2
[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.
╰─> bitarray
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Until now, tronapi still does not support python 3.10 and above, so you should use python 3.9

Trying to install python-mbedtls on Windows using VSCode

I am trying to install the python-mbedtls package using pip installer in my venv on Windows, but I am getting the below error:
build\3.10.2\temp.win-amd64-3.10\Release\pyrex\mbedtls\exceptions.c(685): fatal error C1083: Cannot open include file: 'mbedtls/error.h': No such file or directory
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.31.31103\bin\HostX86\x64\cl.exe' failed with exit code 2
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for python-mbedtls
Failed to build python-mbedtls
ERROR: Could not build wheels for python-mbedtls, which is required to install pyproject.toml-based projects
I know that this library uses the C lib mbedtls and I have no experience using C, or C libraries in my python code directly.
I have made sure to install the C/C++ build tools on my VSCode, and I'm using Python 3.10. I am completely lost on how to proceed

How to fix this problem when installing mysqlclient using pip

I am trying to use django and use mysql as the database. i originally had it working just fine but i recently changed the name of the user account and that is where everything has gone wrong. I have used pip install mysqlclient but the error below is what i get. Is there a way to install mysqlclient another way?
I am using django's newest version and i am using visual code. Thank you
ERROR: Command errored out with exit status 1:
command: 'c:\users\jacob\appdata\local\programs\python\python37-32\python.e
xe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\JACOB
\\AppData\\Local\\Temp\\pip-install-ehb3yr50\\mysqlclient\\setup.py'"'"'; __file
__='"'"'C:\\Users\\JACOB\\AppData\\Local\\Temp\\pip-install-ehb3yr50\\mysqlclien
t\\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\JACOB\AppData\Local\Temp\pip-record
-hbel0tdu\install-record.txt' --single-version-externally-managed --compile
cwd: C:\Users\JACOB\AppData\Local\Temp\pip-install-ehb3yr50\mysqlclient
\
Complete output (30 lines):
running install
running build
running build_py
creating build
creating build\lib.win32-3.7
creating build\lib.win32-3.7\MySQLdb
copying MySQLdb\__init__.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\_exceptions.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\compat.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\connections.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\converters.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\cursors.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\release.py -> build\lib.win32-3.7\MySQLdb
copying MySQLdb\times.py -> build\lib.win32-3.7\MySQLdb
creating build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\__init__.py -> build\lib.win32-3.7\MySQLdb\constan
ts
copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\CR.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\ER.py -> build\lib.win32-3.7\MySQLdb\constants
copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.7\MySQLdb\const
ants
copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.7\MySQLdb\constants
running build_ext
building 'MySQLdb._mysql' extension
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
creating build\temp.win32-3.7\Release\MySQLdb
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\
14.22.27905\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Dversion
_info=(1,4,4,'final',0) -D__version__=1.4.4 "-IC:\Program Files (x86)\MySQL\MySQ
L Connector C 6.1\include\mariadb" -Ic:\users\jacob\appdata\local\programs\pytho
n\python37-32\include -Ic:\users\jacob\appdata\local\programs\python\python37-32
\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Too
ls\MSVC\14.22.27905\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual S
tudio\2019\Community\VC\Tools\MSVC\14.22.27905\include" "-IC:\Program Files (x86
)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits
\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include
\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.183
62.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "
-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /TcMySQL
db/_mysql.c /Fobuild\temp.win32-3.7\Release\MySQLdb/_mysql.obj /Zl /D_CRT_SECURE
_NO_WARNINGS
_mysql.c
MySQLdb/_mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h'
: No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Comm
unity\\VC\\Tools\\MSVC\\14.22.27905\\bin\\HostX86\\x86\\cl.exe' failed with exit
status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\jacob\appdata\local\pro
grams\python\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sy
s.argv[0] = '"'"'C:\\Users\\JACOB\\AppData\\Local\\Temp\\pip-install-ehb3yr50\\m
ysqlclient\\setup.py'"'"'; __file__='"'"'C:\\Users\\JACOB\\AppData\\Local\\Temp\
\pip-install-ehb3yr50\\mysqlclient\\setup.py'"'"';f=getattr(tokenize, '"'"'open'
"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.clos
e();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\JA
COB\AppData\Local\Temp\pip-record-hbel0tdu\install-record.txt' --single-version-
externally-managed --compile Check the logs for full command output.
go to this site to download the package according to the python version. and use pip install filename
like i have python 3.7.1 and download the file in red circle and open terminal where file downloaded and install that file e.g pip install mysqlclient-1.4.4-cp37-cp37m-win32.whl
and in setting file
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'shoping_cart',
'HOST': 'localhost',
'USER': 'root',
'PASSWORD':'',
'PORT': '3306',
}
}
For Linux users
First, install the following dependencies:
sudo apt-get install python3.9-dev libmysqlclient-dev
# don't forget to change python version as per your virtual environment
# since I created my virtual environment with python3.9 that is why I
# have mentioned the same version above
and then install the mysqlclient:
pip install mysqlclient
it might be helpful to send us a 'pip freeze'. Also what's your version of python?
Have you tried 'brew' instead of 'pip' installer?
Check this answer out: How to install Python MySQLdb module using pip?
Yea I just double checked and you should be able to use the 'brew' installer. Basically you're missing the 'openssl' dependency. so you can alternatively just install that and then get mysql.

LNK1104 error with python setup.py build

I have built Quantlib on Windows using Visual Studio 2017 and want to build Quantlib-SWIG for Python.
However, I have LNK1104: error. Namely, after launching Command Prompt from C:\QuantLib-SWIG-1.12\Python directory I receive this error:
fatal error LNK1104: cannot open file 'QuantLib-vc90-x64-mt.lib'
I saw a similar question with advise from Luigi Ballabio and KingJohnno to verify if QuantLib-vc90-x64-mt.lib file is in place & add to the path variable C:\QuantLib-SWIG-1.12.
I did the last suggestion, but I have the problem with that I have in C:\QuantLib\QuantLib-1.12\lib a QuantLib-vc141-x64-mt.lib library, i.e. not the file QuantLib-vc90-x64-mt.lib. I have created separate directory with vc141 file renamed to vc90. This did not help.
I have also read online that the problem might be with the Python specifically builded using different VS version. I have downloaded Python 2.7 builded using VS 2010 (not VS2008) and did not succeed as well.
Please see the whole terminal message here:
C:\QuantLib-SWIG-1.12\Python>cd C:\QuantLib-SWIG-1.12\Python
C:\QuantLib-SWIG-1.12\Python>set QL_DIR=C:\QuantLib\QuantLib-1.12
C:\QuantLib-SWIG-1.12\Python>set INCLUDE=C:\Boost\boost_1_66_0
C:\QuantLib-SWIG-1.12\Python>
C:\QuantLib-SWIG-1.12\Python>python setup.py build
running build
running build_py
running build_ext
building 'QuantLib._QuantLib' extension
C:\Users\user1\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -D__WIN32__ -DWIN32 -DNDEBUG -D_WINDOWS -DNOMINMAX -IC:\Python27vc08\include -IC:\Python27vc08\PC -IC:\QuantLib\QuantLib-1.12 -IC:\Boost\boost_1_66_0 /TpQuantLib/quantlib_wrap.cpp /Fobuild\temp.win-amd64-2.7\Release\QuantLib/quantlib_wrap.obj /GR /FD /Zm250 /EHsc /bigobj /MD
quantlib_wrap.cpp
C:\Users\user1\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Include\xutility(2472) : warning C4267: '=' : conversion from 'size_t' to 'unsigned int', possible loss of data
C:\Users\user1\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Include\xutility(2485) : see reference to function template instantiation '_OutIt std::_Copy_opt<_InIt,unsigned int*,std::forward_iterator_tag>(_InIt,_InIt,_OutIt,_InOutItCat,std::_Nonscalar_ptr_iterator_tag,std::_Range_checked_iterator_tag)' being compiled
with
[
_OutIt=unsigned int *,
_InIt=const unsigned __int64 *,
_InOutItCat=std::forward_iterator_tag
]
C:\Users\user1\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Include\xutility(2563) : see reference to function template instantiation '_OutIt std::_Copy_opt<const unsigned __int64*,_OutIt>(_InIt,_InIt,_OutIt,std::random_access_iterator_tag,std::_Nonscalar_ptr_iterator_tag,std::_Range_checked_iterator_tag)' being compiled
with
[
_OutIt=std::_Vector_iterator<std::_Vbase,std::allocator<std::_Vbase>>,
_InIt=const unsigned __int64 *
]
QuantLib/quantlib_wrap.cpp(16340) : see reference to function template instantiation 'std::_Vector_iterator<_Ty,_Alloc> std::copy<std::_Vector_const_iterator<unsigned __int64,std::allocator<unsigned __int64>>,std::_Vector_iterator<_Ty,_Alloc>>(_InIt,_InIt,_OutIt)' being compiled
with
[
_Ty=std::_Vbase,
_Alloc=std::allocator<std::_Vbase>,
_InIt=std::_Vector_const_iterator<size_t,std::allocator<size_t>>,
_OutIt=std::_Vector_iterator<std::_Vbase,std::allocator<std::_Vbase>>
]
C:\Users\user1\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Python27vc08\libs /LIBPATH:C:\Python27vc08\PCbuild\amd64 /LIBPATH:C:\Python27vc08\PC\VS9.0\amd64 /LIBPATH:C:\QuantLib\QuantLib-1.12\lib /EXPORT:init_QuantLib build\temp.win-amd64-2.7\Release\QuantLib/quantlib_wrap.obj /OUT:build\lib.win-amd64-2.7\QuantLib\_QuantLib.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\QuantLib\_QuantLib.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\QuantLib\_QuantLib.pyd.manifest /subsystem:windows /machine:x64
LINK : fatal error LNK1104: cannot open file 'QuantLib-vc90-x64-mt.lib'
error: command 'C:\\Users\\user1\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\link.exe' failed with exit status 1104
C:\QuantLib-SWIG-1.12\Python>
python setup.py build worked under Python 3.6.5.

bcrypt - windows 10 x64 build error

I have issue with bcrypt installation on windows 10 x64.
My installs:
node = 6.31
node-gyp = 3.4.0
npm = 3.10.3
python = 2.7.0
VSCommunity 2015
windows build tools
I have readed how to, with bcrypt package, based on node-gyp. I am really tired of fighting with this issue. I got error: (PS I tried with v0.8.6)
> bcrypt#0.8.6 install C:\Users\pi15463\www\BaaS\node_modules\bcrypt
> node-gyp rebuild
C:\Users\pi15463\www\BaaS\node_modules\bcrypt>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_mo dules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
blowfish.cc
bcrypt.cc
bcrypt_node.cc
..\src\bcrypt.cc(232): warning C4267: '=': conversion from 'size_t' to 'unsigned char', possible loss of data [C:\Users\pi15463\www\BaaS\node_modules\bcrypt\bui ld\bcrypt_lib.vcxproj]
..\src\bcrypt_node.cc(76): warning C4244: 'argument': conversion from 'ssize_t' to 'unsigned char', possible loss of data [C:\Users\pi15463\www\BaaS\node_module s\bcrypt\build\bcrypt_lib.vcxproj]
..\src\bcrypt_node.cc(229): warning C4267: 'initializing': conversion from 'size _t' to 'int', possible loss of data [C:\Users\pi15463\www\BaaS\node_modules\bcry pt\build\bcrypt_lib.vcxproj]
..\src\bcrypt_node.cc(230): warning C4267: 'initializing': conversion from 'size _t' to 'int', possible loss of data [C:\Users\pi15463\www\BaaS\node_modules\bcry pt\build\bcrypt_lib.vcxproj]
win_delay_load_hook.c
C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src\win_delay_loa d_hook.c(34): error C2373: '__pfnDliNotifyHook2': redefinition; different type m odifiers [C:\Users\pi15463\www\BaaS\node_modules\bcrypt\build\bcrypt_lib.vcxproj ]
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\delayimp.h(134) : note: see declaration of '__pfnDliNotifyHook2'
Like you see a bounch of warns and no files at all. I saw some similar problems, but every1 has different configuration, so I decided to create a new thread.
Why on Ubuntu everything works ok, and on windows always are problems...
Hate my corporate pc.
Please for hints, and best regards!
Uland
I had the same problem: windows10 pc and no way to get bcrypt installed.
I solved this by using bcryptjs (do not confuse it with bcrypt).
Basically bcryptjs does the same job as bcrypt but the former is written in pure js and has no cumbersome dependencies. The only downside is that it is 30% slower than bcrypt.
For me it worked right away.
here is the link to the relevant page on the npmjs website:

Resources