Python Forum
Cannot use pypy on Python3 code - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: Cannot use pypy on Python3 code (/thread-10155.html)

Pages: 1 2


Cannot use pypy on Python3 code - ErnestTBass - May-15-2018

I am trying pypy on some code that I believe is Python3 code.

When I tried it on some code that worked under Python3 i got an error.
The same error over and over. It is about NumpPY not being installed.

It i for python3. What must I to install numpy for pypy compiling Python3 code?

Any help appreciated. Thanks in advance.

Respectfully,

ErnestTBass

here is the error:

Traceback (most recent call last):
File "ann.py", line 1, in <module>
import numpy as np


RE: Cannot use pypy on Python3 code - Larz60+ - May-15-2018

what is the Name of installed package (one that uses Numpy)?


RE: Cannot use pypy on Python3 code - snippsat - May-15-2018

(May-15-2018, 02:23 PM)ErnestTBass Wrote: It i for python3. What must I to install numpy for pypy compiling Python3 code?
Get pip for PyPy
Should I install numpy or numpypy?
pypy3 -m pip install numpy
Binary wheels for PyPy with numpy


RE: Cannot use pypy on Python3 code - ErnestTBass - May-15-2018

I installed numpy for Ptyhon2 and Python3.

Here is the system response.

james@james-VirtualBox:~/Desktop$ pypy basic-multilayer-ann.py
Traceback (most recent call last):
File "basic-multilayer-ann.py", line 1, in <module>
import numpy as np
ImportError: No module named numpy
james@james-VirtualBox:~/Desktop$ pip install numpy
Requirement already satisfied: numpy in /home/james/.local/lib/python2.7/site-packages (1.14.3)
james@james-VirtualBox:~/Desktop$ pip3 install numpy
Requirement already satisfied: numpy in /home/james/.local/lib/python3.5/site-packages (1.14.3)
james@james-VirtualBox:~/Desktop$ pypy ann.py

What is causing this? Everything tTat is installed should be.


Respectfully,

ErnestTBass


RE: Cannot use pypy on Python3 code - snippsat - May-15-2018

(May-15-2018, 04:24 PM)ErnestTBass Wrote: I installed numpy for Ptyhon2 and Python3.
That make no difference,you most install to PyPy.
PyPy is an alternative implementation,so it has nothing to with OS installation of Python.

Read the my post one more time,you most get pip for PyPy then install to with:
pypy -m pip install numpy
Example with an older version on PyPy that i have.
C:\pypy5.4
λ pypy -m ensurepip
Ignoring indexes: https://pypi.python.org/simple
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-6.1.1 setuptools-15.2

# See that pip point PyPy.
C:\pypy5.4
λ pypy -m pip -V
pip 6.1.1 from C:\pypy5.4\site-packages (python 2.7)

# Install Requests
C:\pypy5.4
λ pypy -m pip install requests
You are using pip version 6.1.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting requests
  Downloading https://files.pythonhosted.org/packages/49/df/50aa1999ab9bde74656c2919d9c0c085fd2b3775fd3eca826012bef76d8c/requests-2.18.4-py2.py3-none-any.whl (88kB)
    100% |################################| 90kB 1.8MB/s
.........
Successfully installed certifi-2018.4.16 chardet-3.0.4 idna-2.6 requests-2.18.4 urllib3-1.22

# Test that Requests work in PyPy
C:\pypy5.4
λ pypy
Python 2.7.10 (c95650101a99, Sep 06 2016, 15:44:55)
[PyPy 5.4.1 with MSC v.1500 32 bit] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>> import requests
>>>> requests.__version__
'2.18.4'
>>>> exit()
All i have done over has nothing to do with my main OS version which is Python 3.6.


RE: Cannot use pypy on Python3 code - ErnestTBass - May-15-2018

Here is what I got when I installed :

pypy -m install numpy
/usr/bin/pypy: No module named install

So I still must be doing something wrong.

respectfully,


ErnestTBasss


RE: Cannot use pypy on Python3 code - snippsat - May-15-2018

You are missing pip in command.
pypy -m pip install numpy


RE: Cannot use pypy on Python3 code - ErnestTBass - May-17-2018

Here is the result when I issue the command.

james@james-VirtualBox:~/Desktop$ pypy -m pip install numpy
/usr/bin/pypy: No module named pip
james@james-VirtualBox:~/Desktop$ pypy -m pip install numpy

It says no module named pip. What do i do t fix this?


Respectfully,

ErnstTBass


RE: Cannot use pypy on Python3 code - Larz60+ - May-17-2018

Quote:It says no module named pip. What do i do t fix this?
Read snippsat's post. You need to install pip for PiPy not any other pip!


RE: Cannot use pypy on Python3 code - ErnestTBass - May-17-2018

Okay, is it install PIP for pypy pr PIP for pypi. What is the syntax? I cannot find it on the web?

R.

ErnestTBass