difficulty with psycopg2 on macOS Catalina 10.15.5 [duplicate] - python

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!

Related

Error installing pygame on MacOS: 'longintrepr.h' file not found [duplicate]

This question already has answers here:
Unable to install Pygame using pip
(27 answers)
Closed 29 days ago.
I am trying to install the pygame library on my Mac running macOS 11.0 Big Sur, but I keep getting errors related to missing files, such as 'longintrepr.h' and 'pkg-config'. I have tried installing the library using pip3 and a virtual environment, but I am still encountering the same issues. I am looking for a solution to successfully install the pygame library on my Mac.
#include "longintrepr.h"
^~~~~~~~~~~~~~~
1 error generated.
---
For help with compilation see:
https://www.pygame.org/wiki/MacCompile
To contribute to pygame development see:
https://www.pygame.org/contribute.html
---
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> pygame
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
I have the newest version of python3 installed.
I tried to install pygame using pip on my MacOS machine but I encountered an error "src_c/_sdl2/sdl2.c:211:12: fatal error: 'longintrepr.h' file not found" during the installation process. I also tried creating a virtual environment and installing pygame there but still encountered the same error. I was expecting the installation process to complete successfully without any errors.
On the official pygame repo, there's a huge thread regarding installation of pygame in python 3.11 (latest version) not working properly yet.
Try installing pip install pygame --pre for now, which is going to install a developmental release of the newest, prereleased pygame version, or if you want stability using an older version of python also works.

"error: command 'cl.exe' failed: No such file or directory" - Python Dedupe Installtion

I am trying to install dedupe module and I am getting an error below,
error: command 'cl.exe' failed: No such file or directory
Failed building wheel for dedupe
Failed building wheel for dedupe-hcluster
Failed building wheel for affinegap
Failed building wheel for pylbfgs
Failed building wheel for pyhacrf-datamade
I found this link, that did not help me to resolve.
I am using Windows 10 , 64-bit, Python 3.5.4 :: Anaconda custom (64-bit).
I found the .whl file here, (dedupe-1.9.2-cp35-cp35m-manylinux1_x86_64.whl) downloaded it and tried to use pip install <>.whl and I got an error,
dedupe-1.9.2-cp35-cp35m-manylinux1_x86_64.whl is not a supported wheel
on this platform.
Any ideas on how to resolve this issue?
So, finally, after more research I successfully installed dedupe library. Just thought of posting my own answer if anyone might come across this issue.
In the beginning I only had Visual Studio Build Tools 2017 installed with Visual Studio 2015.
After posting the question I installed Visual Studio Community 2017 (2). And then tried use pip install dedupe still gave me errors like in this post.
Then according to the post, I upgraded the numpy =1.14 and tried pip install dedupe, it worked.
(I am not an expert python setup person, not sure how to explain other than this plain explanation)
I downgraded my python version and it worked first try

Error installing psycopg on OSX (yosemite) using PIP

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.

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

Why am I getting the error: command 'llvm-gcc-4.2' failed with exit status 1

I am setting up os X 10.7.
I am using the default install of Python:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
I use a Python based package manager called easy_install.
Easy_install seems to not be able to find the compiler.
EDIT: When I tried to install MySQL-python I got this error:
$ sudo easy_install MySQL-python
Password:
Searching for MySQL-python
Reading http://pypi.python.org/simple/MySQL-python/
Reading http://sourceforge.net/projects/mysql-python/
Reading http://sourceforge.net/projects/mysql-python
Best match: MySQL-python 1.2.3
Downloading http://download.sourceforge.net/sourceforge/mysql-python/MySQL-python-1.2.3.tar.gz
Processing MySQL-python-1.2.3.tar.gz
Running MySQL-python-1.2.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-P9H9WX/MySQL-python-1.2.3/egg-dist-tmp-rRTfZL
warning: no files found matching 'MANIFEST'
warning: no files found matching 'ChangeLog'
warning: no files found matching 'GPL'
unable to execute llvm-gcc-4.2: No such file or directory
error: Setup script exited with error: command 'llvm-gcc-4.2' failed with exit status 1
error: Setup script exited with error: command 'llvm-gcc-4.2' failed with exit status 1
Xcode 4.1 used GCC, but with Xcode 4.2 that seems to have changed.
What compiler does Apple want us to use?
How do I setup the configuration so I can compile OSS?
I had the exact same problem when I upgraded from OSX 10.6 to 10.7. If you upgrade to 10.7 from 10.6, your version of Python may go from 2.6 to 2.7 and a result you may need to re-install most of your python packages.
Here's what worked for me:
Install the latest version of XCode from the App Store
Inside XCode, go to Preferences -> Downloads -> Components
download the Command Line Tools
That's all you need to do. Try to install again in a new shell. The command line tool installation will put llvm-gcc-4.2 into /usr/bin which should be in your default path. The installation also takes care of library paths and stuff that you don't really want to know about unless something breaks.
10.9 edit
If you're running 10.9 or higher, I think you might be able to run this from the command line instead to install the command line tools:
xcode-select --install
I haven't verified that this is an actual fix to the problem.
Alternative to installing Xcode, install GCC and related tools via:
https://github.com/kennethreitz/osx-gcc-installer
Sounds to me you ran into this issue. The thread shows a variety of solutions.
Hope that helps.
The fix is quite simple. Check out the following blogpost.
http://waqasshabbir.tumblr.com/post/19073648382/llvm-gcc-4-2-exe-error-on-mac-osx-lion-when-building
Using OS X 10.7.5 (Lion)
I tried the XCode solution, but my gevent pip installation still wasn't successful. Then, I tried building libevent from source but still no success with gevent installation. However, after I did
brew install libevent
I was able to successfully install gevent with
sudo pip install gevent
(Note: greenlet is also a dependency for gevent, so you may try installing it with pip as well. It was already installed on my machine.)
All of the suggestions here (Xcode command line options, and Kenneth Reitz' stuff) didn't work for me (I am on Mac OS X 10.7.5, Xcode 4.6.3).
What helped in the end was altering the cflags options in the mysql_config file (There were errors about 'unreconized command line options' while trying to 'sudo pip install MySQL-python').
See this post: cc1: error: unrecognized command line option "-Wno-null-conversion" within installing python-mysql on mac 10.7.5

Categories