I'm confused. I have installed pyodbc on my computer and I was able to import it using other IDE
but i'm new to ipython.
I use Ananconda , and was able to install other library using something like
pip install BeautifulSoup
But when I do that with pyodbc using
pip install pyodbc
I got error :
error: command 'gcc' failed with exist status 1
C:\Users\jeannie.chirayu>pip install pyodbc
Downloading/unpacking pyodbc
You are installing a potentially insecure and unverifiable file. Future versio
ns of pip will default to disallowing insecure files.
Downloading pyodbc-3.0.7.zip (85kB): 85kB downloaded
Running setup.py egg_info for package pyodbc
warning: no files found matching 'tests\*'
Installing collected packages: pyodbc
Running setup.py install for pyodbc
building 'pyodbc' extension
C:\Anaconda\Scripts\gcc.bat -DMS_WIN64 -mdll -O -Wall -DPYODBC_VERSION=3.0.7
-IC:\Anaconda\include -IC:\Anaconda\PC -c c:\users\jeanni~1.chi\appdata\local\t
emp\pip_build_jeannie.chirayu\pyodbc\src\buffer.cpp -o c:\users\jeanni~1.chi\app
data\local\temp\pip_build_jeannie.chirayu\pyodbc\src\buffer.o /Wall /wd4668 /wd4
820 /wd4711 /wd4100 /wd4127 /wd4191
gcc.exe: error: /Wall: No such file or directory
gcc.exe: error: /wd4668: No such file or directory
gcc.exe: error: /wd4820: No such file or directory
gcc.exe: error: /wd4711: No such file or directory
gcc.exe: error: /wd4100: No such file or directory
gcc.exe: error: /wd4127: No such file or directory
gcc.exe: error: /wd4191: No such file or directory
error: command 'gcc' failed with exit status 1
Complete output from command C:\Anaconda\python.exe -c "import setuptools;__
file__='c:\users\jeanni~1.chi\appdata\local\temp\pip_build_jeannie.chirayu
\pyodbc\setup.py';exec(compile(open(file).read().replace('\r\n', '\n'), __
file__, 'exec'))" install --record c:\users\jeanni~1.chi\appdata\local\temp\pip-
lqnyba-record\install-record.txt --single-version-externally-managed:
running install
running build
running build_ext
building 'pyodbc' extension
C:\Anaconda\Scripts\gcc.bat -DMS_WIN64 -mdll -O -Wall -DPYODBC_VERSION=3.0.7 -IC
:\Anaconda\include -IC:\Anaconda\PC -c c:\users\jeanni~1.chi\appdata\local\temp\
pip_build_jeannie.chirayu\pyodbc\src\buffer.cpp -o c:\users\jeanni~1.chi\appdata
\local\temp\pip_build_jeannie.chirayu\pyodbc\src\buffer.o /Wall /wd4668 /wd4820
/wd4711 /wd4100 /wd4127 /wd4191
gcc.exe: error: /Wall: No such file or directory
gcc.exe: error: /wd4668: No such file or directory
gcc.exe: error: /wd4820: No such file or directory
gcc.exe: error: /wd4711: No such file or directory
gcc.exe: error: /wd4100: No such file or directory
gcc.exe: error: /wd4127: No such file or directory
gcc.exe: error: /wd4191: No such file or directory
error: command 'gcc' failed with exit status 1
Cleaning up...
Command C:\Anaconda\python.exe -c "import setuptools;file='c:\users\jeanni
~1.chi\appdata\local\temp\pip_build_jeannie.chirayu\pyodbc\setup.py';exec(
compile(open(file).read().replace('\r\n', '\n'), file, 'exec'))" install
--record c:\users\jeanni~1.chi\appdata\local\temp\pip-lqnyba-record\install-rec
ord.txt --single-version-externally-managed failed with error code 1 in c:\users
\jeanni~1.chi\appdata\local\temp\pip_build_jeannie.chirayu\pyodbc
Storing complete log in C:\Users\j\pip\pip.log
Any recommendation would help. Thanks.
this was annoying. but i got it working. basically, pyodbc source code is missing a lot of crap.
1) in the pyodbc directory, open setup.py and search for "wd4668".
change that list to look like this:
settings['extra_compile_args'] = []
2) in the src directory, create a file called "abc_minmax.h". in it, put:
#ifndef min
#define min(a, b) ((a < b) ? a : b)
#define max(a, b) ((a > b) ? a : b)
#endif
3) in the following files in the src directory:
cursor.h
params.h
sqlwchar.h
add the following line near the other includes at the top:
#include "abc_minmax.h"
4) finally, in the file wrapper.h, add the following 2 lines near the other includes:
#include <Windows.h>
#include <Winreg.h>
ok, that should do it! let me know if something doesn't work.
It won't help with the pip install issues but you could download the .exes from https://code.google.com/p/pyodbc/
or
http://www.lfd.uci.edu/~gohlke/pythonlibs/
Related
I have been trying to install python-MySQLdb on mac and I keep getting error. I have tried so many alternatives to pass that error.
sudo PATH=/usr/local/Cellar/mysql/bin/:$PATH pip install mysql-python
Password:
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
The directory '/Users/zuhairhallak/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/zuhairhallak/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting mysql-python
Downloading https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip (108kB)
100% |████████████████████████████████| 112kB 2.6MB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/tmp/pip-install-RtF2js/mysql-python/setup.py", line 17, in <module>
metadata, options = get_config()
File "setup_posix.py", line 53, in get_config
libraries = [ dequote(i[2:]) for i in libs if i.startswith(compiler_flag("l")) ]
File "setup_posix.py", line 8, in dequote
if s[0] in "\"'" and s[0] == s[-1]:
IndexError: string index out of range
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-install-RtF2js/mysql-python/
I have also ran sudo -H pip install mysql-python and I got different error
13 warnings generated.
cc -bundle -undefined dynamic_lookup -Wl,-F. build/temp.macosx-10.14-intel-2.7/_mysql.o -L/usr/local/Cellar/mysql/8.0.15/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.14-intel-2.7/_mysql.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'cc' failed with exit status 1
Failed building wheel for mysql-python
Running setup.py clean for mysql-python
Failed to build mysql-python
Installing collected packages: mysql-python
Running setup.py install for mysql-python ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/private/tmp/pip-install-3A8kOd/mysql-python/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /private/tmp/pip-record-TUb4up/install-record.txt --single-version-externally-managed --compile
Please try
brew install mysql
sudo -H pip install mysql-python
I went to the mysql_config file and opened it up
vi mysql_config
This was correct.
Create options:
Libs = "- L $ pkglibdir"
Libs = "$ libs -lmysqlclient -lssl -lcrypto"
ran this command in terminal
1. export LDFLAGS="-L/usr/local/opt/openssl/lib"
2. export CPPFLAGS="-I/usr/local/opt/openssl/include"
3. pip install mysql-python
First I downloaded the .whl file for Cython from the pythonlibs website, then I open up my bash terminal and execute the following command:
python install Cython
here is the output:
unable to execute 'x86_64-linux-gnu-gcc': No such file or directory
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools,
If it helps, my operating system is windows 10, thanks
Trying to install lxml on mac osx yosemite for python 2.7.10
Using command pip install lxml, I receive: /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:33:10: fatal error: 'stdio.h' file not found
#include
^
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
Complete error: Command "/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c "import setuptools, tokenize;file='/private/var/folders/h2/hwn1y9sd54b6tl2wyb6vc_kh0000gp/T/pip-build-St5xbb/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /var/folders/h2/hwn1y9sd54b6tl2wyb6vc_kh0000gp/T/pip-8QC6OG-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/h2/hwn1y9sd54b6tl2wyb6vc_kh0000gp/T/pip-build-St5xbb/lxml
I have searched and cannot find a solution. Can someone please point me in the right direction?
if you have xcode installed try the following
$xcode-select --install
You could also try installing python via homebrew
$brew install python
See these links that are related to you problem.
Fatal error: #include <stdio.h> generated after "pip install mysql-python" command
GCC fatal error: stdio.h: No such file or directory
Similar to this question, I'm having trouble installing bcrypt under Cygwin, and receiving this error:
Downloading/unpacking bcrypt
Downloading bcrypt-1.0.2.tar.gz (40kB): 40kB downloaded
Running setup.py (path:/tmp/pip_build_Chris/bcrypt/setup.py) egg_info for package bcrypt
c/_cffi_backend.c:13:17: fatal error: ffi.h: No such file or directory
#include <ffi.h>
^
compilation terminated.
...
distutils.errors.DistutilsError: Setup script exited with error: command 'gcc' failed with exit status 1
Complete output from command python setup.py egg_info:
c/_cffi_backend.c:13:17: fatal error: ffi.h: No such file or directory
#include <ffi.h>
^
compilation terminated.
The libffi-devel package is installed, and I've also tried using the --global-option='-I/lib/libffi-3.0.13/include' argument to tell pip exactly where the ffi.h file is on my system.
I was able to build/install this implementation from source under Cygwin: https://bitbucket.org/alexandrul/py-bcrypt/overview
I met the same problem.
Fixed the problem by:
cp /usr/lib/libffi-3.0.13/include/*.h /usr/include
I am trying to install M2Crypto on CentOS by compiling from the source.
i am doing a python setup.py build
But I get the following error,
/usr/local/lib/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'test_suite'
warnings.warn(msg)
running build
running build_py
running build_ext
building 'M2Crypto.__m2crypto' extension
swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c
swig -python -I/usr/local/include/python2.6 -I/usr/include -includeall -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
SWIG/_m2crypto.i:28: Error: Unable to find 'openssl/opensslv.h'
SWIG/_evp.i:9: Error: Unable to find 'openssl/opensslconf.h'
SWIG/_ec.i:7: Error: Unable to find 'openssl/opensslconf.h'
error: command 'swig' failed with exit status 1
Please advise ...
Prasanna
The following should work:
env SWIG_FEATURES="-cpperraswarn -includeall -D__`uname -m`__ -I/usr/include/openssl" python setup.py build
Edit: and openssl-devel package is of course also required.
I just had this problem. In M2Crypto's INSTALL file:
Note about Fedora Core -based Distributions
----------------------------------------------------
Fedora Core (and RedHat, CentOS etc.) have made changes to OpenSSL
configuration compared to many other Linux distributions. If you can not
build M2Crypto normally, try the fedora_setup.sh script included with
M2Crypto sources.
My solution was to get the sources from PyPI or from the source. Then in the M2Crypto directory:
$ chmod +x fedora_setup.py
$ ./fedora_setup.py install
If you're using a virtualenv, change the path of the python interpreter in that file, or activate your environment before building.
The only dependency that I had that wasn't satisfied on my system was openssl-devel.
Install openssl-devel.
Follow Brian's instruction, and make sure you have install openssl-devel. if you experience error like this:
./fedora_setup.sh build
running build
running build_py
running build_ext
building 'M2Crypto.__m2crypto' extension
swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c
swig -python -I/usr/include/python2.6 -I/usr/include -includeall -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
SWIG/_evp.i:12: Error: Unable to find 'openssl/opensslconf-i686.h'
SWIG/_ec.i:7: Error: Unable to find 'openssl/opensslconf-i686.h'
error: command 'swig' failed with exit status 1
You are running i386 operating system on 64 bit hardware. arch =´uname -m´ will yields i686. The easiest way is to work around this is to create a symbolic link.
sudo ln -s /usr/include/openssl/opensslconf-i386.h /usr/include/openssl/opensslconf-i686.h
Or if you experience errors like:
./fedora_setup.sh build
running build
running build_py
running build_ext
SWIG/_m2crypto_wrap.c:27555: error: ‘Swig_var__evp_err_set’ undeclared (first use in this function)
SWIG/_m2crypto_wrap.c:27564: error: ‘Swig_var__dh_err_get’ undeclared (first use in this function)
SWIG/_m2crypto_wrap.c:27564: error: ‘Swig_var__dh_err_set’ undeclared (first use in this function)
SWIG/_m2crypto_wrap.c:27576: error: ‘Swig_var__rsa_err_get’ undeclared (first use in this function)
...
Some headers are missing, just issue the following command and try again:
sudo yum install python-devel
I had this problem now (in 2018), I solved it by installing openssl-devel, gcc and make
yum install gcc gcc-c++ make openssl-devel