I installed the pypy of the following form:
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
Activated the environment
source ~/.virtualenv/my-pypy-env/bin/activate
I installed some packages:
pip install mongo
pip install numpy
But when 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 installing with sudo:
sudo pip install psycopg2
But it generated another error:
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.
Ok, 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
It looks like it worked, but by 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 do not know what I'm doing wrong or if psycopg2 does not run with pypy. Could someone give me a tip?