Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import Numpypy when using pypy2.2

I used to have pypy verion 1.9. I could do the following to import numpypy:

>pypy
Python 2.7.2 (341e1e3821ff, Jun 07 2012, 15:42:54)
[PyPy 1.9.0 with GCC 4.2.1] on darwin
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``translating pypy with cpython is
soooooo slow''
>>>> import numpypy

Recently I updated my os and installed pypy Version 2.2 now I am not able to import numpypy

>>>> import numpypy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named numpypy

What could be the issue? I know numpy is not fully supported, but I have many scripts that use the limited functionality of numpypy in pypy.

like image 620
A.D Avatar asked Feb 04 '14 16:02

A.D


People also ask

How do I import NumPy in Python?

Before you can import numpy, you first need to install it. There are two ways to install numpy: The simplest way to install numpy is to use the pip package manager to download the binary version from the Python Package Index (PyPI.org) and install it on your system using the following command:

How to set NumPy alias after importing in Python?

The equal alias can be used to set np as the numpy alias after importing is like below. As the created alias np refers to the numpy when we try to print the version of the np the numpy library is printed. The __version__ attribute can be used to print version information of the numpy.

How to call NumPy library in Python?

But there is a more practical way to use numpy with the “import numpy as np” where the np can be used to call the numpy library and related functions and data types. The numpy is an external or 3rd party library which do not provided with python by default.

How do I install NumPy in Linux?

There are two ways to install numpy: 1 Install the binary (pre-compiled) version using pip 2 Compile it from source code, and then install it More ...


1 Answers

See the third bullet here: http://doc.pypy.org/en/latest/release-2.2.0.html#highlights

~$ pypy
Python 2.7.3 (87aa9de10f9c, Nov 24 2013, 20:57:21)
[PyPy 2.2.1 with GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``pypy is a race between people
shaving yaks and the universe producing more bearded yaks. So far, the universe
is winning''
>>>> import _numpypy
>>>> _numpypy.multiarray.array([5,3,2])
array([5, 3, 2])
like image 193
perimosocordiae Avatar answered Oct 17 '22 19:10

perimosocordiae