LINK: fatal error lnk1181: cannot open input file 'id=2.obj' - python

I'm trying to compile cudamat in my Windows 10, by using VS2015 x64 native tools command prompt. I've already installed Cuda toolkit 8 as well as Visual Studio 2015 with MSVC compiler. After downloading cudamat, I gave the following command in that directory:
python setup.py install
When it tries to build cudamat.libcudamat extension, I get the following error by the linker:
fatal error lnk1181: cannot open input file 'id=2.obj'
error: command 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin\nvcc.exe' failed with exit status 2
Could someone help me?

If you have this problem, we can assume that earlier compilation of cudamat.obj and cudamat_kernels.obj were succesful.
To make it work, you'll have to do it manually as described here.
Long in short:
First you have to go to directory where you have Cudamat downloaded (git clone https://github.com/cudamat/cudamat.git).
Copy cudamat folder (the one where you can find cudamat.py, learn.py and init.py) to your python site-packages folder (you can check the path using python -c "import sys; print(sys.path)")
Now you will have to go to this folder and compile dll's manually. To do this you have to execute few commands:
nvcc -c -O -o cudamat.obj cudamat.cu
nvcc -c -O -o cudamat_kernels.obj cudamat_kernels.cu
nvcc --shared -o libcudamat.dll cudamat.obj cudamat_kernels.obj -lcublas
and then repeat the process changing cudamat to learn and libcudamat.dll to libcudalearn.dll
This should already work but if not, you have to tweak your python paths so it can see your new library
Alternatively, you can try also: pip install http://github.com/f0k/cudamat/archive/simplify-compile.zip

Related

Issues installing python package on windows

I'm trying to install python-rocksdb on a windows 10 machine and I'm coming across some issues with the install.
I have successfully installed rocksdb first using the vcpkg method.
When running pip install python-rocksdb I get the following error:
cl : Command line error D8021 : invalid numeric argument '/Wextra'
error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.34.31933\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
Looking around suggested attempting to install with GCC or G++, so I downloaded cygwin and then attempted to install the python package using
pip install --global-option build_ext --global-option --compiler=cygwin python-rocksdb which yielded the following error:
gcc: error: unrecognized command-line option ‘-mcygwin’
error: command 'C:\\cygwin64\\bin\\gcc.exe' failed with exit code 1
This post seems to suggest that you need to use g++ specifically, but it looks like the cygwin command is defaulting to gcc.
Just note that I'm not using the virtual env with python.
Any assistance is greatly appreciated.

Saxonc python extension issue with macOs

I am trying to install saxonC extension for python in mac OS for xml transformation using xsl and i am getting the below error when i run "python3 saxon-setup.py build_ext -if" as mentioned in the documentation here: https://www.saxonica.com/saxon-c/documentation11/index.html#!starting/installingpython
Error: clang: error: no such file or directory: '../DocumentBuilder.cpp'
clang: error: no input files
error: command '/usr/bin/clang' failed with exit code 1
Run the following command to escape the unsigned library issue:
xattr -d -r com.apple.quarantine libsaxon-HEC-11.3/libsaxonhec.dylib
The SaxonC libsaxonhec.dylib library is an x86_64 file. Therefore the executables for the samples, Python and PHP extension also need to be built as an x86_64 file.
The following command for building the SaxonC python extension should work:
arch -x86_64 python3 saxon-setup.py build_ext -if
Unfortunately python3 needs to be run as x86_64:
arch -x86_64 python3 saxon_example3.py
SaxonC 12.0 now supports M1 chip. Also SaxonC is available as a Pypi package which will make installation easier. See: https://pypi.org/user/saxonica/

fatal error: 'Python/Python.h' file not found while installing couchapp

I am trying to install couchapp from the terminal on macOs High Sierra.
I have python 2.7.10 installed (by default) and I run $ pip2 install couchapp according to the couchapp documentation.
This is the error I get:
src/watchdog_fsevents.c:22:10: fatal error: 'Python/Python.h' file not found
#include <Python/Python.h>
^~~~~~~~~~~~~~~~~
1 error generated.
error: command 'cc' failed with exit status 1
----------------------------------------
Failed building wheel for watchdog
Here is what I have when I do $ ls in /System/Library/Frameworks/Python.framework/
Examples
Modules
Python
Resources
Versions
module.map
What I have tried so far:
Check that Xcode CL Tools are already installed running $ xcode-select --install
Try to use pip3 instead of pip2 (I have installed python 3.6 with Homebrew), but I get the same error message.
Do you have any idea? I have read other posts but they did not solve my problem.
Thank you
Had a very similar problem on my High Sierra (10.13.5) setup with Xcode CLI tools installed; for me the Python.h was found in /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
(Some resources say the location can be found via find /usr/local/Cellar/ -name Python.h, however this seems not work if your python was not installed with brew.)
Add the location to your C include path, or at compile time as a flag by setting -I flag as such: -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7.
The part that tripped me up was the import statement should then look like: #include <Python.h> rather than #include <Python/Python.h> if your Python.h is directly in the python2.7 directory.
Hope that helps,

Gensim with MinGW

I seem to be one of the many people struggling to install gensim on windows. I have trawled through countless forums but the errors poster there never appear to match my errors. So hopefully someone can point me in the right direction!
I am running Windows Server 2012 R2 Standard 64-bit. I have installed MinGW & Anaconda 2.2.0 (64-bit), which comes with Python 2.7.9.
I have added a file distutils.cfg into C:\Users\Sam\Anaconda\Lib\distutils with the contents:
[build]
compiler=mingw32
I have added C:\MinGW\bin to my Environment variables.
If I install gensim using pip I do not get any errors, until I try to run Word2Vec when I get the error:
C:\Users\sam.passmore\AppData\Local\Continuum\Anaconda\lib\site-packages\gensim\models\word2vec.py:459: UserWarning: C extension com
pilation failed, training will be slow. Install a C compiler and reinstall gensim for fast training.
So I have uninstalled gensim and tried to re-install using the mingw32 compiler, but this gives me this error:
python setup.py build --compiler=mingw32
c:\users\sam.passmore\appdata\local\continuum\anaconda\lib\site-packages\setuptools-14.3-py2.7.egg\setuptools\dist.py:282: UserWarni
ng: Normalizing '0.11.1-1' to '0.11.1.post1'
running build
running build_ext
building 'gensim.models.word2vec_inner' extension
C:\MinGW\bin\gcc.exe -DMS_WIN64 -mdll -O -Wall -Igensim\models -IC:\Users\sam.passmore\AppData\Local\Continuum\Anaconda\include -IC:
\Users\sam.passmore\AppData\Local\Continuum\Anaconda\PC -IC:\Users\sam.passmore\AppData\Local\Continuum\Anaconda\lib\site-packages\n
umpy\core\include -c ./gensim/models/word2vec_inner.c -o build\temp.win-amd64-2.7\Release\.\gensim\models\word2vec_inner.o
gcc: error: ./gensim/models/word2vec_inner.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
command 'C:\\MinGW\\bin\\gcc.exe' failed with exit status 1
setup.py:82: UserWarning:
********************************************************************
WARNING: %s could not
be compiled. No C extensions are essential for gensim to run,
although they do result in significant speed improvements for some modules.
%s
Here are some hints for popular operating systems:
If you are seeing this message on Linux you probably need to
install GCC and/or the Python development package for your
version of Python.
Debian and Ubuntu users should issue the following command:
$ sudo apt-get install build-essential python-dev
RedHat, CentOS, and Fedora users should issue the following command:
$ sudo yum install gcc python-devel
If you are seeing this message on OSX please read the documentation
here:
http://api.mongodb.org/python/current/installation.html#osx
********************************************************************
The gensim.models.word2vec_inner extension moduleThe output above this warning shows how the compilation failed.
"The output above this warning shows how the compilation failed.")
building 'gensim.models.doc2vec_inner' extension
C:\MinGW\bin\gcc.exe -DMS_WIN64 -mdll -O -Wall -Igensim\models -IC:\Users\sam.passmore\AppData\Local\Continuum\Anaconda\include -IC:
\Users\sam.passmore\AppData\Local\Continuum\Anaconda\PC -IC:\Users\sam.passmore\AppData\Local\Continuum\Anaconda\lib\site-packages\n
umpy\core\include -c ./gensim/models/doc2vec_inner.c -o build\temp.win-amd64-2.7\Release\.\gensim\models\doc2vec_inner.o
gcc: error: ./gensim/models/doc2vec_inner.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
command 'C:\\MinGW\\bin\\gcc.exe' failed with exit status 1
setup.py:82: UserWarning:
********************************************************************
WARNING: %s could not
be compiled. No C extensions are essential for gensim to run,
although they do result in significant speed improvements for some modules.
%s
Here are some hints for popular operating systems:
If you are seeing this message on Linux you probably need to
install GCC and/or the Python development package for your
version of Python.
Debian and Ubuntu users should issue the following command:
$ sudo apt-get install build-essential python-dev
RedHat, CentOS, and Fedora users should issue the following command:
$ sudo yum install gcc python-devel
If you are seeing this message on OSX please read the documentation
here:
http://api.mongodb.org/python/current/installation.html#osx
********************************************************************
The gensim.models.doc2vec_inner extension moduleThe output above this warning shows how the compilation failed.
"The output above this warning shows how the compilation failed."
I have exhausted all options I can think of or find, so if anyone could give some advice it would be much appreciated.
I managed to solve this after using conda install for gensim, rather than pip.
conda install gensim
I am not sure what other steps I have included above have contributed to the answer, but this was the last thing I did before I no longer was getting the 'Install a C compiler and reinstall gensim for fast training.' message.
During my research in trying to solve this problem I saw that the most common methods were adding the lines
[build]
compiler=mingw32
to the distutils.cfg file as well as ensuring MinGW is in your path. Also ensuring that the MinGW bit version is the same as your python version.

Installing Ephem package in Python 3

I would like to install the ephem package in my Python 3.3.0 version under Windows XP.
I tried first the pip install ephem route from the system command prompt. The process aborted with the error message of Unable to find vcvarsall.bat.
I read prior advice on the net for such a difficulty. Following it I installed mingw32 in my computer, added C:\MinGW\bin to the PATH variable and provided Lib / distutils with a new file called distutils.cfg and the content:
[build]
compiler=mingw32
On running now any of the install commands (pip, *easy_install* and setup.py all work the same) the following error results:
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Ilibastro-3.7.5 -IC:\Python33\
include -IC:\Python33\include -c extensions/_libastro.c -o build\temp.win32-3.3\
Release\extensions\_libastro.o
cc1.exe: error: unrecognised command line option '-mno-cygwin'
error: command 'gcc' failed with exit status 1
I have tried to understand and solve the problem, but have been unsuccesful. I have not been able even to find the place in the code where such values are established.
¿Could somebody provide any help? ¿Would ephem be one of the cases alluded by Installing Python modules in the 3.3.0 Documentation with "Not all extensions can be built with MinGW or Cygwin, but many can."?
Thanks in advance
Paco
Here is an extremely useful page of Windows binaries of python packages: http://www.lfd.uci.edu/~gohlke/pythonlibs/.
It includes binaries for pyephem.

Categories

Resources