Error installing psycopg on OSX (yosemite) using PIP - python

I'm getting a strange linker error that I don't completely understand while attempting to install postgresql on OSX.
I've installed Postgres via Brew and now I'm trying to get my Django app up and running. I've added the postgres directory to my path. I'm running OSX Yosemite.
When I run the following command:
pip install psycopg2
I get this error:
ld: illegal text reloc in '_init_psycopg' to '_lobjectType' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'cc' failed with exit status 1
I'm at a loss where to go from here and my searches for this type of error has lead me no where. Any help would be amazing.
Thanks.

Turns out I had a couple versions of Postgres installed. I had to remove the old one and make sure the pg_config that was found in the PATH was the most recent one. As soon as I made sure the pg_config was the proper one, this error went away.

Related

difficulty with psycopg2 on macOS Catalina 10.15.5 [duplicate]

This question already has an answer here:
Error code when installing psycopg2 in requirements.txt in django
(1 answer)
Closed 2 years ago.
I have a finished simple django blog application that I am in the process of deploying to heroku.
I have a live application now, but my static css files weren't included. I think that I've identified (part of) the problem in my settings.py file where django_heroku is unable to be imported.
When i try to pip install django-heroku, I error out at the psycopg2:
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'gcc' failed with exit status 1
It seems that I have homebrew installed and have up-to-date versions of gcc, openssl, and xcode.
Does anyone have any suggestions on what I could try next?
I have run into issues with psycopg2 and MacOS in the past. Have you tried to install the precompiled version?
pip install psycopg2-binary
That usually clears things up for me!

Pip install fuzzy fails because gcc fails to compile

I want to install fuzzy python package. I have windows 7 operating system with mingw32 and python 2.7. When I try to pip install the fuzzy package, I get the following error.
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: build\temp.win-amd64-2.7\Release\src\fuzzy.o: bad reloc address 0x0 in section `.data'
collect2.exe: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
Here's the complete log.
Please please help!
I had the same error when trying to install the (not part of anaconda) mmh3 module on an anaconda installation on windows.
It seems that your path includes an independent mingw installation (c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe)
I had to remove my mingw from my path so that it used the MiniGW that corresponds to your Python, so try to check e.g. if
ld.exe -version
and
...\anaconda\MinGW\bin\ld.exe -version
give you the same, if not, make sure your path is correct as discussed above...

pyodbc installation issues on Mac

I'm trying to install pyodbc on my mac because I want to connect to a sql server and I have been going through a lot of forum to get it to work. Everything has been install except the pyodbc (I've tried pip,homebrew, easy_istall and even tried to install using the source code but nothing worked) and it's giving me the following error:
(hhl)OSFOLA-034901:bin henry.humadi$ easy_install pyodbc
Searching for pyodbc
Reading https://pypi.python.org/simple/pyodbc/
Reading http://code.google.com/p/pyodbc
Reading http://code.google.com/p/pyodbc/downloads/list
Best match: pyodbc 3.0.7
Downloading http://pyodbc.googlecode.com/files/pyodbc-3.0.7.zip
Processing pyodbc-3.0.7.zip
Writing /var/folders/w4/h0nc35117x1c0psqpsm4vvlnhk02nh/T/easy_install-AFM6yU/pyodbc-3.0.7/setup.cfg
Running pyodbc-3.0.7/setup.py -q bdist_egg --dist-dir /var/folders/w4/h0nc35117x1c0psqpsm4vvlnhk02nh/T/easy_install-AFM6yU/pyodbc-3.0.7/egg-dist-tmp-G6Yp3F
warning: no files found matching 'tests/*'
clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
error: Setup script exited with error: command 'cc' failed with exit status 1
Can anyone please decipher this error message for me. I read somewhere it has to do with Xcode 5.1 but I still don't understand it.
Thank you in advance.
Xcode 5 caused clang to throw a fatal error when it encountered a command line flag, which broke a lot of things.
Run the command like this and it should work:
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future easy_install pyodbc

error installing fiona in OSX 10.9

I am having difficulty with installing fiona.
I have followed fiona's official documentation ( https://github.com/sgillies/fiona) as well as the related thread below.
trouble installing Fiona in python cpl_error.h: No such file or directory
I had no trouble with pip install shapely and I used brew install gdal. When I use the command pip install fiona I get a number of errors
clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
error: command 'cc' failed with exit status 1
as well as warnings with regards to gdal-config such as "Failed to get options via gdal-config"
I am worried there is an issue with gdal-config's location thats causing the issue. I think I might have had GDAL previously installed with kyngchaos for QGIS use a while ago before I used the brew install
Any insights would be much appreciated. I can't imagine I am the only one who has had issues installing fiona, but I haven't been able to find a resolution through google searching alone yet.
If you're using XCode 5.1, the problem is likely unrecognised options in Clang. See here for details on how to fix this: http://bruteforce.gr/bypassing-clang-error-unknown-argument.html

problems installing M2Crypto on Mint

I am trying to install M2Crypto for python on Mint 12. I have executed `python setup.py build, but the build fails, stating
error: command 'gcc' failed with exit status 1
the preceding 2 lines show that there may be a problem with Python.h:
SWIG/_m2crypto_wrap.c:126:20: fatal error: Python.h: No such file or directory
compilation terminated
If anyone knows what needs to be done to fix this, please let me know.
EDIT
I have attempted to install python-dev, but I get the following error:
The following packages have unmet dependencies:
python-dev: Depends: python (= 2.6.6-2ubuntu1) but 2.7.2-7ubuntu2 is to be installed
E: Unable to correct problems, you have held broken packages
It looks that you miss the python-dev package which contains python.h
try following command
$sudo apt-get install python-m2crypto
Compiling on recent Debian, Ubuntu or derivatives like Mint gives an error:
ImportError: /usr/local/lib/python2.7/dist-packages/M2Crypto/__m2crypto.so: undefined symbol: SSLv2_method
Corresponding question and answer here.

Categories