{"id":1154,"hash":"0fdae9f00541fc3d2b3885885ba936beb8d8480925aadf97b520c0134971a10f","pattern":"&quot;Failed building wheel for psycopg2&quot; - MacOSX using virtualenv and pip","full_message":"I'm attempting to make a website with a few others for the first time, and have run into a weird error when trying to use Django/Python/VirtualEnv. I've found solutions to this problem for other operating systems, such as Ubuntu, but can't find any good solutions for Mac. \n\nThis is the relevant code being run:\n\nvirtualenv -p python3 venv\nsource venv/bin/activate\npip install -r requirements.txt\n\nAfter running that block, I get the following errors:\n\n  AssertionError\n\n  \n  \n  \n  Failed building wheel for django-toolbelt\n   Running setup.py bdist_wheel for psycopg2\n\n...\n\n  AssertionError\n\n  \n  \n  \n  Failed building wheel for psycopg2\n   Failed to build django-toolbelt psycopg2\n\nI believe I've installed the \"django-toolbelt\" and \"psycopg2\", so I'm not sure why it would be failing. \n\nThe only difference I can think of is that I did not use the command\n\nsudo apt-get install libpq-dev\n\nas was instructed for Ubuntu usage as I believe that installing postgresql with brew took care of the header. \n\nThanks for any help or insight!","ecosystem":"pypi","package_name":"django","package_version":null,"solution":"For MacOS users\n\nAfter trying all the above methods (which did not work for me on MacOS 10.14), that one worked :\n\nInstall openssl with brew install openssl if you don't have it already.\nadd openssl path to LIBRARY_PATH : \n\nexport LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/\n\ninstall psycopg2 with pip pip3 install psycopg2","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/34304833/failed-building-wheel-for-psycopg2-macosx-using-virtualenv-and-pip","votes":108,"created_at":"2026-04-19T04:52:25.795045+00:00","updated_at":"2026-04-19T04:52:25.795045+00:00"}