Cython Installation Problems - 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

Related

Failed to install psycopg2 on mac os

I am using python3.7.2 and pip 19.2.2 for a python application. The problem is that I can't install the dependency psycopg2 2.8.3 on MacOS.
Below is the error I got on running pip install psycopg2:
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for psycopg2
It seems that ssl is not installed so I tried to install pip install sssl but got this error:
ERROR: Command errored out with exit status 1:
command: /Users/joey/.pyenv/versions/3.7.2/bin/python3.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/9c/fcm6pxnj39b1t777zpcfpbdh0000gn/T/pip-install-2ldzdiz0/ssl/setup.py'"'"'; __file__='"'"'/private/var/folders/9c/fcm6pxnj39b1t777zpcfpbdh0000gn/T/pip-install-2ldzdiz0/ssl/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
cwd: /private/var/folders/9c/fcm6pxnj39b1t777zpcfpbdh0000gn/T/pip-install-2ldzdiz0/ssl/
Complete output (6 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/9c/fcm6pxnj39b1t777zpcfpbdh0000gn/T/pip-install-2ldzdiz0/ssl/setup.py", line 33
print 'looking for', f
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print('looking for', f)?
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I don't understand why it failed. Is this because of a wrong version or relates to MacOS?
I have tried the method mentioned in this post: How to install psycopg2 with "pip" on Python?. I installed postgressql on the Mac and added /usr/local/Cellar/postgresql/11.5/bin/ on PATH env. But it doesn't help.
I think this thread may be of help error installing psycopg2, library not found for -lssl
clang is the default c compiler on osx, and is required for some python libraries to be built correctly. The ssl error is actually the clang linker complaining that there is no ssl library available to be used. The above thread should resolve your issue.
I had the same issue, and looked at the thread posted by Nate, but found my solution here: How to update Xcode from command line, posted by Roy Huang, who referenced https://forums.developer.apple.com/thread/104296
It turns out Mojave and/or Xcode 10 does not create a /usr/include directory, which psycopg2 needs to be able to install.

How can I fix this error very time I try type pip install mysql-python

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

GCC issue while using cython

I am trying to execute a file as shown on this website,
http://cython.readthedocs.io/en/latest/src/tutorial/cython_tutorial.html
I have saved my file with .pyx extension, made the setup.py file and ran python setup.py build_ext --inplace command. So earlier I was getting error: command 'gcc' failed: No such file or directory and then I installed the package as suggested here Error: command 'gcc' failed: No such file or directory I added the C:\users\name\mingw\bin in my environment variable as suggested MinGW: "gcc is not recognized as an internal or external command".
Still, when I am typing gcc on cmd it is showing 'gcc' is not recognized as an internal or external command,operable program or batch file.
So, I am confused. I also went into mingw\bin and then I run python setup.py build_ext --inplace but then I get command 'gcc.exe' failed with exit status 1.
I am stuck on this. Please help as this is my first time to use Cython.

Cannot compile Python package on Windows

Trying to install a compiled Python package on a 64-bit Windows machine using MinGW compiler. The same install succeeded on my 32-bit machine but failed on two different 64-bit machines:
C:\Python\Scripts> pip install python-Levenshtein
C:\Python\libs/python33.lib: error adding symbols: File in wrong format
collect2.exe: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
Trying from a cloned copy:
$ python setup.py build
C:\Python\libs/python33.lib: error adding symbols: File in wrong format
collect2.exe: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
Running the build command by itself:
$ gcc.exe -shared -s 'build\temp.win-amd64-3.3\Release\levenshtein\_levenshtein.o' 'build\temp.win-amd64-3.3\Release\levenshtein\_levenshtein.def' -LC:'\Python\libs' -LC:'\Python\PCbuild\amd64' -lpython33 -lmsvcr100 -o 'build\lib.win-amd64-3.3\Levenshtein\_levenshtein.pyd'
C:\Python\libs/python33.lib: error adding symbols: File in wrong format
collect2.exe: error: ld returned 1 exit status
$ file 'C:\Python\libs/python33.lib'
C:\Python\libs/python33.lib: current ar archive
Thank you
- Muposat

How to install pyodbc to be used in ipython

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/

Categories