Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install pip on pypy

I want to speed up my program so i'm trying to setup pypy + psycopg2cffi. This program opens a xml, parses it and then insert some data in a database. I'm using currently python3, postgresql and psycopg2 but this approaches is really slow. So i want to try run my program with pypy + psycopg2cffi. I have python 3 and pypy, and i want to install psycopg2cffi so i ran this command:

pip install psycopg2cffi psycopg2cffi-compat  

But psycopg2cffi was only installed on python because when i try to import psycopg2cffi on pypy this is the error i get:

ImportError: No module named psycopg2cffi 

So i think i need to install pip first but i can figure out how to do this.

How can i install it on pypy? Thank you.

like image 464
1pa Avatar asked Feb 20 '17 10:02

1pa


People also ask

Is PyPy compatible with Python?

Compatibility: PyPy is highly compatible with existing python code. It supports cffi, cppyy, and can run popular python libraries like twisted, and django. It can also run NumPy, Scikit-learn and more via a c-extension compatibility layer.

How do I use PyPy instead of Python?

For Python 2.7, it's just called pypy . For CPython, if you would like to run Python 3 from the terminal, you simply enter the command python3 . To run PyPy, simply issue the command pypy3 . Entering the pypy3 command in the terminal might return the Command 'pypy3' not found message, as shown in the next figure.

Can you use Numpy in PyPy?

TL;DR version: you should use numpy. You can install it by doing pypy -m pip install numpy . You might also be interested in using the experimental PyPy binary wheels to save compilation time. The upstream numpy is written in C, and runs under the cpyext compatibility layer.


2 Answers

You can also try this (if it's not disabled in your Linux distribution):

pypy -m ensurepip 
like image 177
SebMa Avatar answered Oct 21 '22 09:10

SebMa


Download the pip-installer and execute it with pypy:

wget https://bootstrap.pypa.io/get-pip.py ./pypy get-pip.py 

For usage try,

pypy -m pip install validators 
like image 30
Mohamed Gamal Avatar answered Oct 21 '22 10:10

Mohamed Gamal