can't import python extension - python

I'm trying to learn python extensions, and I created the simple noddy example c file and setup.py.
python.exe setup.py build gives me:
running build
running build_ext
building 'noddy' extension
creating build
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
C:\Program Files\Microsoft Visual Studio 8\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\python27\include -IC:\python27\PC /Tcnoddy.c /Fobuild\temp.win32-2.7\Release\noddy.obj
noddy.c
creating build\lib.win32-2.7
C:\Program Files\Microsoft Visual Studio 8\VC\BIN\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\python27\libs /LIBPATH:C:\python27\PCbuild /EXPORT:initnoddy build\temp.win32-2.7\Release\noddy.obj /OUT:build\lib.win32-2.7\noddy.pyd /IMPLIB:build\temp.win32-2.7\Release\noddy.lib /MANIFESTFILE:build\temp.win32-2.7\Release\noddy.pyd.manifest
Creating library build\temp.win32-2.7\Release\noddy.lib and object build\temp.win32-2.7\Release\noddy.exp
C:\Program Files\Microsoft Visual Studio 8\VC\BIN\mt.exe -nologo -manifest build\temp.win32-2.7\Release\noddy.pyd.manifest -outputresource:build\lib.win32-2.7\noddy.pyd;2
I then run python.exe setup.py install, which gives me:
running install
running build
running build_ext
running install_lib
copying build\lib.win32-2.7\noddy.pyd -> C:\python27\Lib\site-packages
running install_egg_info
Writing C:\python27\Lib\site-packages\noddy-1.0-py2.7.egg-info
But then, in Idle,
>>> import noddy
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import noddy
ImportError: DLL load failed: The specified module could not be found.
So, what am I doing wrong? Admittedly, I am horribly confused.

Use the Visual Studio 2008 compiler to build the module.
VS8 is Visual Studio 2005 and the modules compiled with that version are incompatible with Python 2.7 (same applies to modules compiled with Visual Studio 2010 btw.).

Related

Cannot open include file: 'io.h': No such file or directory, Python 3.7.5, Windows 8.1, VS v 2019

I am trying to install the Isotree package from pip install, when I receive the error below. I am using Python 3.7, working on a Windows 8 with installed C++ build tools using Visual studio build tools 2019 (version 16.7.5). I have also included Windows 10 SDK (10.0.18362.0) along with other add-ons.
I have tried all possible solutions I found to similar problems on this website and via other google searches, but I can't seem to get it working. Since I am working on a work laptop, I cannot go around and download from another party.
Can somebody help me how to resolve this problem? I tried setting an environment variable INCLUDE, pointing to the folder [C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt]
this helped but another error occurred, "cannot open include: basetsd.h" and then trying to solve that, the original error (io.h) came back.
Building wheel for isotree (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\a481838\appdata\local\programs\python\python37\python.exe'
'c:\users\a481838\appdata\local\programs\python\python37\lib\site-packages\pip\
_vendor\pep517\_in_process.py' build_wheel 'C:\Users\A481838\AppData\Local\Temp\
tmpslnm97j9'
cwd: C:\Users\A481838\AppData\Local\Temp\pip-install-uxt3l0k4\isotree
Complete output (28 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\isotree
copying isotree\__init__.py -> build\lib.win-amd64-3.7\isotree
running build_ext
cythoning isotree/cpp_interface.pyx to isotree\cpp_interface.cpp
building 'isotree._cpp_interface' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\isotree
creating build\temp.win-amd64-3.7\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\1
4.27.29110\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -D_USE_MER
SENNE_TWISTER -D_ENABLE_CEREAL -IC:\Users\A481838\AppData\Local\Temp\pip-build-e
nv-7aj7e0rh\overlay\Lib\site-packages\numpy\core\include -I. -I./src -IC:\Users\
A481838\AppData\Local\Temp\pip-build-env-7aj7e0rh\overlay\include -Ic:\users\a48
1838\appdata\local\programs\python\python37\include -Ic:\users\a481838\appdata\l
ocal\programs\python\python37\include "-IC:\Program Files (x86)\Microsoft Visual
Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include" "-IC:\Program Files (
x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.27.29110\include"
"-IC:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt" /EHsc /Tpis
otree\cpp_interface.cpp /Fobuild\temp.win-amd64-3.7\Release\isotree\cpp_interfac
e.obj /openmp /O2 /std:c++14
cpp_interface.cpp
c:\users\a481838\appdata\local\programs\python\python37\include\pyconfig.h(59)
: fatal error C1083: Cannot open include file: 'io.h': No such file or directory
c:\users\a481838\appdata\local\programs\python\python37\lib\distutils\extensio
n.py:131: UserWarning: Unknown Extension options: 'install_requires'
warnings.warn(msg)
C:\Users\A481838\AppData\Local\Temp\pip-build-env-7aj7e0rh\overlay\Lib\site-pa
ckages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_le
vel' not set, using 2 for now (Py2). This will change in a later release! File:
C:\Users\A481838\AppData\Local\Temp\pip-install-uxt3l0k4\isotree\isotree\cpp_int
erface.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
warning: isotree\cpp_interface.pyx:384:44: Not all members given for struct 'I
soForest'
warning: isotree\cpp_interface.pyx:384:44: Not all members given for struct 'I
soForest'
warning: isotree\cpp_interface.pyx:387:47: Not all members given for struct 'E
xtIsoForest'
warning: isotree\cpp_interface.pyx:387:47: Not all members given for struct 'E
xtIsoForest'
warning: isotree\cpp_interface.pyx:391:34: Not all members given for struct 'I
mputer'
warning: isotree\cpp_interface.pyx:391:34: Not all members given for struct 'I
mputer'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildT
ools\\VC\\Tools\\MSVC\\14.27.29110\\bin\\HostX86\\x64\\cl.exe' failed with exit
status 2
----------------------------------------
ERROR: Failed building wheel for isotree
Failed to build isotree
ERROR: Could not build wheels for isotree which use PEP 517 and cannot be instal
led directly```
Type the following.
pip install pipwin
pipwin install pycuda

unknown error installing scrapy in pycharm on windows 10

I'm trying to install scrapy in my project virtual environnement in pycharm and i'm having the following error. ( this is the last few lines of the error log it is quite long )
I don't know what is wrong or what to look for.
I tried to install it using the package manager and the pip install scrapy command and the result is the same.
can you help me? thank you and have a nice day!
building 'twisted.test.raiser' extension
creating build\temp.win32-3.8
creating build\temp.win32-3.8\Release
creating build\temp.win32-3.8\Release\src
creating build\temp.win32-3.8\Release\src\twisted
creating build\temp.win32-3.8\Release\src\twisted\test
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DWIN32=1 -IC:\Users\XXXXX\PycharmProjects\scrapicerie\venv\include -IC:\Python\Python38-32\include -IC:\Python\Python38-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include" /Tcsrc/twisted/test/raiser.c /Fobuild\temp.win32-3.8\Release\src/twisted/test/raiser.obj
raiser.c
C:\Python\Python38-32\include\pyconfig.h(59): fatal error C1083: Impossible d'ouvrir le fichier includeÿ: 'io.h'ÿ: No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
----------------------------------------
Apparently it had something to do with visual studio.
I reinstalled visual studio with the python and c++ module and now scrapy installed correctly in pycharm.

installing pyGObject has an error in pycharm

while i'm trying to install pyGObject in my Pycharm. it does not work. and has an error :
error: command '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin\x86_amd64\cl.exe"' failed with exit status 2]
and the output command :
running build_ext
building 'cairo._cairo' extension
creating build\temp.win-amd64-3.4
creating build\temp.win-amd64-3.4\Release
creating build\temp.win-amd64-3.4\Release\cairo
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin\x86_amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DPYCAIRO_VERSION_MAJOR=1 -DPYCAIRO_VERSION_MINOR=18 -DPYCAIRO_VERSION_MICRO=0 -IC:\Users\asus\PycharmProjects\Testt\venv\include -IC:\Python34\include -IC:\Python34\include /Tccairo/device.c /Fobuild\temp.win-amd64-3.4\Release\cairo/device.obj
device.c
c:\users\asus\appdata\local\temp\pycharm-packaging\pycairo\cairo\pycairo.h(37) : fatal error C1083: Cannot open include file: 'cairo.h': No such file or directory
error: command '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin\x86_amd64\cl.exe"' failed with exit status 2
----------------------------------------
my python version is 3.4.8 and working in windows 8.1

error while building mysqlclient on windows

everyone ! I am facing the below issue when I ran the command : python setup.py build inside the mysqlclient directory. I have installed mysqlclient 1.3.7
Do you have any solution to fix this ? I am trying to setup MySQL with django.
C:\Users\Hp\Downloads\Compressed\mysqlclient-1.3.7\mysqlclient-1.3.7>python setu
p.py build
running build
running build_py
copying MySQLdb\release.py -> build\lib.win32-3.4\MySQLdb
running build_ext
building '_mysql' extension
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.exe /c /nologo /Ox
/MD /W3 /GS- /DNDEBUG -Dversion_info=(1,3,7,'final',1) -D__version__=1.3.7 "-IC
:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include" -IC:\Python34\include
-IC:\Python34\include /Tc_mysql.c /Fobuild\temp.win32-3.4\Release\_mysql.obj /Z
l
_mysql.c
_mysql.c(29) : fatal error C1083: Cannot open include file: 'my_config.h': No su
ch file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\BIN\\
cl.exe' failed with exit status 2
C:\Users\Hp\Downloads\Compressed\mysqlclient-1.3.7\mysqlclient-1.3.7>python setu
p.py install
running install
running bdist_egg
running egg_info
writing top-level names to mysqlclient.egg-info\top_level.txt
writing dependency_links to mysqlclient.egg-info\dependency_links.txt
writing mysqlclient.egg-info\PKG-INFO
reading manifest file 'mysqlclient.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'mysqlclient.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_py
copying MySQLdb\release.py -> build\lib.win32-3.4\MySQLdb
running build_ext
building '_mysql' extension
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.exe /c /nologo /Ox
/MD /W3 /GS- /DNDEBUG -Dversion_info=(1,3,7,'final',1) -D__version__=1.3.7 "-IC
:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include" -IC:\Python34\include
-IC:\Python34\include /Tc_mysql.c /Fobuild\temp.win32-3.4\Release\_mysql.obj /Z
l
_mysql.c
_mysql.c(29) : fatal error C1083: Cannot open include file: 'my_config.h': No su
ch file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\BIN\\
cl.exe' failed with exit status 2
Try to install it via pip
pip install mysqlclient
If you want to build it from source you need to get mysql source as well. Follow this link to find proper source to download.

Cant install PyTables at windows

I try to install the PyTables module. I use Windows 7 (x32), Python 2.7.3 (x32), Cython 0.16, Visual Studio 2008 (9.0). At cmd.exe 'run as administrator' write: 'python setup.py install --hdf5="C:\Program Files\HDF Group\HDF5\1.8.9"'.
But there are unresolved external symbols and build failed:
* Found numpy 1.6.2 package installed.
* Found numexpr 2.0.1 package installed.
* Found Cython 0.16 package installed.
* Found HDF5 headers at ``C:\Program Files\HDF Group\HDF5\1.8.9\include``, libra
ry at ``C:\Program Files\HDF Group\HDF5\1.8.9\lib``.
* Could not find LZO 2 headers and library; disabling support for it.
* Could not find LZO 1 headers and library; disabling support for it.
* Could not find bzip2 headers and library; disabling support for it.
cythoning tables\linkExtension.pyx to tables\linkExtension.c
running install
running build
running build_py
running build_ext
No module named msvccompiler in numpy.distutils; trying from distutils
building 'tables.utilsExtension' extension
C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W
3 /GS- /DNDEBUG -DNDEBUG=1 -DWIN32=1 -D_HDF5USEDLL_=1 -Iblosc -IC:\Python27\lib\
site-packages\numpy-1.6.2-py2.7-win32.egg\numpy\core\include -I"C:\Program Files
\HDF Group\HDF5\1.8.9\include" -IC:\Python27\include -IC:\Python27\PC /Tctables\
utilsExtension.c /Fobuild\temp.win32-2.7\Release\tables\utilsExtension.obj -Isrc
-DH5_USE_16_API
Found executable C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe
utilsExtension.c
c:\program files\hdf group\hdf5\1.8.9\include\H5public.h(47) : fatal error C1083
: Не удается открыть файл include: stdint.h: No such file or directory
error: Command "C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /n
ologo /Ox /MD /W3 /GS- /DNDEBUG -DNDEBUG=1 -DWIN32=1 -D_HDF5USEDLL_=1 -Iblosc -I
C:\Python27\lib\site-packages\numpy-1.6.2-py2.7-win32.egg\numpy\core\include -I"
C:\Program Files\HDF Group\HDF5\1.8.9\include" -IC:\Python27\include -IC:\Python
27\PC /Tctables\utilsExtension.c /Fobuild\temp.win32-2.7\Release\tables\utilsExt
ension.obj -Isrc -DH5_USE_16_API" failed with exit status 2
Installing Python packages with C extensions from source on Windows is difficult. Luckily, there are people who build these kits and make them available: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pytables
Install it from a binary kit, you'll be much happier.
Possible duplicate: pytables installation failed
Check out this answer:
https://stackoverflow.com/a/68740234/11236901
Or just install a stable version for your os from: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pytables
And install the file in your directory with:
pip install C:/some-dir/some-file.whl

Categories

Resources