Unable To Build Lupa - python

I'm trying to compile Lupa on Windows 7 64bit, and I've installed all of the dependencies (including LuaJIT2 and Lua 5.2). But when I try to install by running
python setup.py install
I get errors regarding dependancies, usually .m files.
For example:
lupa/_lupa.c(265) : fatal error C1083: Cannot open include file:
'lua.h': No such file or directory
I've tried adding the files manually but it just leads to more issues, like this:
c:\mingw\include\stdint.h:118:0: note: this is the location of the previous definition
#define INT_LEAST64_MIN INT64_MIN
^
In file included from _lupa.c:271:0:
stdint.h:154:0: warning: "INT_LEAST64_MAX" redefined [enabled by default]
#define INT_LEAST64_MAX 0x7fffffffffffffff
^
In file included from c:\mingw\lib\gcc\mingw32\4.8.1\include\stdint.h:9:0,
from c:\mingw\include\wchar.h:876,
from unicodeobject.h:120,
from Python.h:85,
from _lupa.c:30:
c:\mingw\include\stdint.h:123:0: note: this is the location of the previous definition
#define INT_LEAST64_MAX INT64_MAX
^
In file included from _lupa.c:271:0:
stdint.h:155:0: warning: "UINT_LEAST64_MAX" redefined [enabled by default]
#define UINT_LEAST64_MAX 0xffffffffffffffffU
^
Please note this is a small excerpt from the spam I was getting in the console. I've tried more things than I can keep track of. I've tried using gcc to no avail and had friends try and help me. I'm completely stumped. Please help me!
Oh, and here's a full log of me trying to run the installer without changing files around:
No local build of LuaJIT2 found in lupa directory
Checking for installed luajit library using pkg-config
pkg-config found luajit version 2.0.3
building without Cython
running install
running bdist_egg
running egg_info
writing lupa.egg-info\PKG-INFO
writing top-level names to lupa.egg-info\top_level.txt
writing dependency_links to lupa.egg-info\dependency_links.txt
writing lupa.egg-info\PKG-INFO
writing top-level names to lupa.egg-info\top_level.txt
writing dependency_links to lupa.egg-info\dependency_links.txt
reading manifest file 'lupa.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'lupa.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
copying lupa\version.py -> build\lib.win-amd64-2.7\lupa
running build_ext
building 'lupa._lupa' extension
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe /c /nolog
o /Ox /MD /W3 /GS- /DNDEBUG -DLUA_COMPAT_ALL -I/usr/local/include/luajit-2.0 -IC
:\Python27\include -IC:\Python27\PC /Tclupa/_lupa.c /Fobuild\temp.win-amd64-2.7\
Release\lupa/_lupa.obj
_lupa.c
lupa/_lupa.c(265) : fatal error C1083: Cannot open include file: 'lua.h': No such file or directory
error: command '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64
\cl.exe"' failed with exit status 2

I don't know if you still need the answer for this but I had the same problem and looked into lupa folder and saw lupa.pyx which implies you need Cython. Run pip install cython beforehand worked for me.

Related

file module in python install failing

I have a code that uses a module which in turn uses the python module "file". Right now when I run my code I get the error -
File "c:\users\sss\appdata\local\programs\python\python36-32\lib\site-packages\enmscripting\common\element.py", line 3, in <module>
from file import FileResult
ModuleNotFoundError: No module named 'file'
So then I went to console and ran "import file". Sure enough I don't have that module.
import file
Traceback (most recent call last):
File "<ipython-input-27-f5da65cb6f61>", line 1, in <module>
import file
ModuleNotFoundError: No module named 'file'
I then proceeded with installing file using pip. Getting the error below. Please advise. I have searched a lot and haven't been able to find a fix.
C:\Users\sss>pip install file
Collecting file
Using cached https://files.pythonhosted.org/packages/0a/49/317ac8ed10afb25c4c24972ea4de4c5507d6b0ab13bca4941c9a0bdc64ea/file-0.3.0.tar.gz
Requirement already satisfied: cffi>=1.0.0 in c:\users\sss\appdata\local\programs\python\python36-32\lib\site-packages (from file)
Requirement already satisfied: pycparser in c:\users\sss\appdata\local\programs\python\python36-32\lib\site-packages (from cffi>=1.0.0->file)
Installing collected packages: file
Running setup.py install for file ... error
Complete output from command c:\users\sss\appdata\local\programs\python\python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Public\\Documents\\Wonder
share\\CreatorTemp\\pip-build-fe5vpmot\\file\\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\Public\Documents\Wondershare\CreatorTemp\pip-jqpbad1d-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win32-3.6
creating build\lib.win32-3.6\file
copying src\file\_libmagic_build.py -> build\lib.win32-3.6\file
copying src\file\__init__.py -> build\lib.win32-3.6\file
running egg_info
writing src\file.egg-info\PKG-INFO
writing dependency_links to src\file.egg-info\dependency_links.txt
writing requirements to src\file.egg-info\requires.txt
writing top-level names to src\file.egg-info\top_level.txt
reading manifest file 'src\file.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*.py[cod]' found anywhere in distribution
warning: no previously-included files matching '__pycache__' found anywhere in distribution
warning: no previously-included files matching '*.so' found anywhere in distribution
warning: no previously-included files matching '*.dylib' found anywhere in distribution
writing manifest file 'src\file.egg-info\SOURCES.txt'
running build_ext
generating cffi module 'build\\temp.win32-3.6\\Release\\file._libmagic.c'
creating build\temp.win32-3.6
creating build\temp.win32-3.6\Release
building 'file._libmagic' extension
creating build\temp.win32-3.6\Release\build
creating build\temp.win32-3.6\Release\build\temp.win32-3.6
creating build\temp.win32-3.6\Release\build\temp.win32-3.6\Release
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\sss\appdata\local\
programs\python\python36-32\include -Ic:\users\sss\appdata\local\programs\python\python36-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\
14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files
(x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0
\cppwinrt" /Tcbuild\temp.win32-3.6\Release\file._libmagic.c /Fobuild\temp.win32-3.6\Release\build\temp.win32-3.6\Release\file._libmagic.obj
file._libmagic.c
build\temp.win32-3.6\Release\file._libmagic.c(492): fatal error C1083: Cannot open include file: 'magic.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
Installed Magic again. No change -
C:\Users\sss>pip install libmagic
Collecting libmagic
Downloading https://files.pythonhosted.org/packages/83/86/419ddfc3879b4565a60e0c75b6d19baec48428cbc2f15aca5320b3d136f6/libmagic-1.0.tar.gz
Installing collected packages: libmagic
Running setup.py install for libmagic ... done
Successfully installed libmagic-1.0
Error - Same as before
ile._libmagic.c
build\temp.win32-3.6\Release\file._libmagic.c(492): fatal error C1083: Cannot open include file: 'magic.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
Resolved -
I downgraded to Python 2.7 and everything works. It appears there are some compatibility issues with Python 3.6.
Resolved - I downgraded to Python 2.7 and everything works. It appears there are some compatibility issues with Python 3.6.

Unable to install mysqlclient Python package on Windows

I am trying to install the mysqlclient Python package (https://pypi.python.org/pypi/mysqlclient) into a virtual Python 2.7 environment on Windows 7 (on a local PC, and on the Appveyor CI) and cannot get it done.
I am describing the issues for the local PC with Win 7, but it happens basically the same way on Appveyor.
Packages in my virtualenv when I start:
pip (9.0.1)
setuptools (36.6.0)
wheel (0.30.0)
pip install mysqlclient initially says:
. . .
running build_ext
building '_mysql' extension
error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27
Apparently, Python 2.7 requires VC9. After installing it, pip install mysqlclient gets a little further, but misses include files:
. . .
building '_mysql' extension
creating build\temp.win-amd64-2.7
creating build\temp.win-amd64-2.7\Release
C:\Program Files (x86)\Common Files\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Dversion_info=(1,3,12,'final',0) -D__version__=1.3.12 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include" -IC:\Python27\include -IC:\Users\Andi\virtualenvs\mysqlclient\PC /Tc_mysql.c /Fobuild\temp.win-amd64-2.7\Release\_mysql.obj /Zl
_mysql.c
_mysql.c(29) : fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Common Files\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2
In order to get the header files, I installed the "MySQL Connector/C 6.1.10" from https://downloads.mysql.com/archives/get/file/mysql-connector-c-6.1.10-winx64.msi. This is admittedly only the second latest version, but I need to install it on Appveyor from the command line, and did not find out how to download the latest version in an unattended manner.
Also, using the MSI installer installs the package in C:\Program Files\MySQL\MySQL Connector C 6.1 but the build step in pip install expects it in C:\Program Files (x86)\MySQL\MySQL Connector C 6.1, so I softlinked it:
mklink /D "C:\Program Files (x86)\MySQL\MySQL Connector C 6.1" "C:\Program Files\MySQL\MySQL Connector C 6.1"
When looking at the files in that version of the MySQL Connector/C, it has only lib/vs12 and lib/vs14 directories:
lib/vs12/mysqlclient.lib
lib/vs14/mysqlclient.lib
As expected, pip install mysqlclient now gets beyond the compiles, but fails when linking:
. . .
running build_ext
building '_mysql' extension
creating build\temp.win-amd64-2.7
creating build\temp.win-amd64-2.7\Release
C:\Program Files (x86)\Common Files\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Dversion_info=(1,3,12,'final',0) -D__version__=1.3.12 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include" -IC:\Python27\include -IC:\Users\Andi\virtualenvs\mysqlclient\PC /Tc_mysql.c /Fobuild\temp.win-amd64-2.7\Release\_mysql.obj /Zl
_mysql.c
_mysql.c(242) : .... several warnings ...
C:\Program Files (x86)\Common Files\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe /DLL /nologo /INCREMENTAL:NO "/LIBPATH:C:\Program Files (x86)\MySQL\MySQL Connector C 6.1\lib\vs9" /LIBPATH:C:\Python27\Libs /LIBPATH:C:\Users\Andi\virtualenvs\mysqlclient\libs /LIBPATH:C:\Users\Andi\virtualenvs\mysqlclient\PCbuild\amd64 /LIBPATH:C:\Users\Andi\virtualenvs\mysqlclient\PC\VS9.0\amd64 kernel32.lib advapi32.lib wsock32.lib mysqlclient.lib /EXPORT:init_mysql build\temp.win-amd64-2.7\Release\_mysql.obj /OUT:build\lib.win-amd64-2.7\_mysql.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\_mysql.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\_mysql.pyd.manifest /MANIFEST
LINK : fatal error LNK1181: cannot open input file 'mysqlclient.lib'
error: command 'C:\\Program Files (x86)\\Common Files\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\link.exe' failed with exit status 1181
I did not find a version of the "MySQL Connector/C" package that can still be downloaded and that works with VC9. Using the mysqlclient.lib files in the vs12 or vs14 directories in this vc9 build results in unresolved symbols.
My questions are:
What package(s) do I need to use in order to get the right header files (e.g. mysql.h) and libraries (e.g. mysqlclient.lib) for a successful pip install mysqlclient on Windows 7?
More generally, what are the prerequisites for a successful pip install mysqlclient on Windows 7?
download mysqlclient from http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python
choose the version matching your python version, example mysqlclient‑1.4.2‑cp37‑cp37m‑win_amd64.whl, and then:
pip install wheel
pip install mysqlclient‑1.4.2‑cp37‑cp37m‑win_amd64.whl
Incidentally I ran into the same issue in July last year and only now finished an entry on my blog about it.
Basically, you're not going to like it, but you need to re-compile mysqlclient from scratch, because -- as you pointed out -- it's not available for Visual Studio 9 since a long time.
However, doing it right is somewhat tricky, because you need to fix some compilation issues that apparently aren't documented anywhere in Oracle's official documentation. There are also issues with the Python setup.py file, as it doesn't care about the platform architecture and always looks in the x86 directory. That's why you soft-linked the directory. There is an open issue on Github mentioning this.
So basically, using the VC++ for Python 2.7 you already installed:
Download the Oracle MySQL C Connector source code.
Download and install Microsoft Visual C++ Compiler for Python 2.7.
Use CMake to generate NMake Makefiles for the MySQL C Connector source code. Pay attention to environment variables, see this Github issue comment.
Compile the MySQL C Connector mysqlclient library using nmake mysqlclient.
Install the MySQL C Connector binary and add the compiled mysqlclient.
Run pip install mysqlclient again.
Step 4 is tricky, because Microsoft don't supply C99 stdint.h, inttypes.h and stdlib.h is missing lldiv_t. You can use this StackOverflow post to get stdint.h and inttypes.h and then manually define lldiv_t in decimal.h as:
typedef struct {
long long quot;
long long rem;
} lldiv_t;
You can also copy these headers from a newer Visual Studio, like 2013 and 2015. After that, as you had already figured out, you need to put the compiled mysqlclient.lib into C:\Program Files (x86)\MySQL\MySQL Connector C 6.1\lib\vs9.
Then issue another pip install mysqlclient and you're all done.

I am trying to import mysqldb for django. 'my_config.h ' no such file or directory is the error that i am getting

Initially i got that error called vcvarsall.bat not found.To resolve that i installed Microsoft visual studio 14 .After that the error i got is
C:\Users\...\Desktop\mysqlclient-1.3.7>python setup.py install
running install
running bdist_egg
running egg_info
writing top-level names to mysqlclient.egg-info\top_level.txt
writing mysqlclient.egg-info\PKG-INFO
writing dependency_links to mysqlclient.egg-info\dependency_links.txt
reading manifest file 'mysqlclient.egg-info\SOURCES.txt'
. ..
...
_mysql.c
_mysql.c(29): fatal error C1083: Cannot open include file: 'my_config.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\
cl.exe' failed with exit status 2
I have no clue how to proceed. I am using Windows 8 and Python 3.5 .
mysqlclient uses a library from MySQL.
For Windows, install a libmysqlclient here: https://dev.mysql.com/downloads/connector/c/
Then try reopening your cmd.

Visual C++ error while installing Python SASL

I need to query into hive using python.
Currently I am using this source code.
https://cwiki.apache.org/confluence/display/Hive/Setting+Up+HiveServer2#SettingUpHiveServer2-PythonClientDriver
Issue is dependences for running this query is SASL and Thrift wrappers.
While installing the SASL package I am getting this error.
setup.py install
running install
running bdist_egg
running egg_info
writing sasl.egg-info\PKG-INFO
writing top-level names to sasl.egg-info\top_level.txt
writing dependency_links to sasl.egg-info\dependency_links.txt
reading manifest file 'sasl.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'sasl.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
building '_saslwrapper' extension
C:\Users\admin\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Isasl -IC:\Python27\include -IC:\Python27\PC /Tpsasl/saslwrapper.cpp /Fobuild\temp.win-amd64-2.7\Release\sasl/saslwrapper.objsaslwrapper.cpp
c:\users\admin\desktop\dddd\sasl-0.1.3.tar\dist\sasl-0.1.3\sasl-0.1.3\sasl\saslwrapper.h(20) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
error: command 'C:\\Users\\admin\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2
Please provide a solution.
My environment: Win 7 64bit

Exception while installing packages in Python

I am Getting this Exception while installing packages in Python.
uninstalled python and installed it again but there is no
C:\Users\ramasastri.g\Desktop\pycrypto-2.6>python setup.py install
running install
running build
running build_py
running build_ext
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Random.OSRNG.winrandom' extension
C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Isrc/ -Isrc/inc-msvc/ -IC:\Python27\include -IC:\Python27\PC /Tcsrc/winrand.c /Fobuild\temp.win32-2.7\Release\src/winrand.obj
winrand.c
c:\python27\include\pyconfig.h(68) : fatal error C1083: Cannot open include file: 'io.h': No such file or directory
error: command '"C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\cl.exe"' failed with exit status 2
Probably you are missing the c++ compiler.
I installed it using a pre-packaged version from here
My problem was inside a virtualenv. I could not install some packages and got the same fatal error c1083. I was trying Visual Studio and PTVS. Just installing Microsoft Visual C++ Compiler for Python 2.7 https://www.microsoft.com/en-us/download/details.aspx?id=44266 was not enough to fix the error, despite it is needed.
I have found the solution here http://blog.ionelmc.ro/2014/12/21/compiling-python-extensions-on-windows/
The setuptools installed by virtualenv is too old (3.6). You need to remove it and reinstalling but, in the "Install python package" window in Visual Studio solution explorer, instead of using "setuptools" as the module name to install use "setuptools>=6.0".
Got the same error message and found the cause was that while I had set up the PATH variable correctly with the paths to Visual Studio and Python, I forgot to add the C:\Windows\System32 path.

Categories