Forum Archive

Error when running pip install psycopg2

stef728384

Hi, I am trying to install psycopg2 but get the following error.
Any ideas?
Thanks
Stef
[~/Documents]$ pip install psycopg2
Querying PyPI ...
Downloading package ...
Opening: https://pypi.python.org/packages/7b/a8/dc2d50a6f37c157459cd18bab381c8e6134b9381b50fbe969997b2ae7dbc/psycopg2-2.6.2.tar.gz
Save as: /private/var/mobile/Containers/Data/Application/96C663CC-44E0-4415-B60D-C6C5E8888A33/tmp/psycopg2-2.6.2.tar.gz (376348 bytes)
376348 [100.00%]
Extracting archive file ...
Archive extracted.
Running setup file ...
ImportError('No module named lib2to3.refactor',)
Failed to run setup.py
Fall back to directory guessing ...
Error: Cannot locate packages. Manual installation required.

dgelessus

The psycopg2 library includes a lot of C code. It is not possible to install C-based modules in Pythonista - there is no real C compiler for iOS, and Apple does not allow apps to execute native code (C, C++, Fortran, Assembly, etc.) that isn't included with the app. This means that you can't use psycopg2 in Pythonista, sorry.

stef728384

Ah thank you for your reply.
Do you know if there is another way to connect to a postgres server?

ihf

Does pg8000 work?

dgelessus

https://pypi.python.org/pypi/pg8000 says that it's pure Python, and it has no dependencies other than six (which is included with Pythonista). That sounds like it could work on Pythonista.

stef728384

Module pg8000 works indeed! Thanks guys!