2
I installed the shape sequinte pypy:
wget https://bitbucket.org/pypy/pypy/downloads/pypy3-v5.10.1-linux64.tar.bz2
tar xf pypy3-v5.10.1-linux64.tar.bz2
virtualenv -p ~/pypy3-v5.10.1-linux64/bin/pypy my-pypy-env
I activated the environment
source ~/.virtualenv/my-pypy-env/bin/activate
I installed some packages:
pip install mongo
pip install numpy
But when will I install psycopg2:
pip install psycopg2
Collecting psycopg2
Using cached psycopg2-2.7.4.tar.gz
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/psycopg2.egg-info
writing pip-egg-info/psycopg2.egg-info/PKG-INFO
writing dependency_links to pip-egg-info/psycopg2.egg-
info/dependency_links.txt
writing top-level names to pip-egg-info/psycopg2.egg-
info/top_level.txt
writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
Error: pg_config executable not found.
pg_config is required to build psycopg2 from source. Please add the directory
containing pg_config to the $PATH or specify the full executable path with the
option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
If you prefer to avoid building psycopg2 from source, please install the PyPI
'psycopg2-binary' package instead.
For further information please check the 'doc/src/install.rst' file (also at
<http://initd.org/psycopg/docs/install.html>).
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-7lSMte/psycopg2/
I tried to install with sudo:
sudo pip install psycopg2
But it made another mistake:
The directory '/home/prisvo/.cache/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 '/home/prisvo/.cache/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.
Okay, so I should just install using -H in front of sudo.
sudo -H pip install psycopg2
:
Requirement already satisfied: psycopg2 in /usr/local/lib/python2.7/dist-packages
Looks like it worked, but when testing:
python prisvo-recommender.py
File "prisvo-recomender.py", line 1, in <module>
import banco
File "/home/prisvo/prisvo-recommendation/corepypy/banco.py", line 1, in <module>
import psycopg2
ImportError: No module named psycopg2
I don’t know what I’m doing wrong or if psycopg2 doesn’t run with pypy. Could someone give me a hint?
Maybe I need the package
postgresql-server-dev
– Camilo Santos
should only be postgresql-dev , in case - will need also, in addition to my answer.
– jsbueno