9

I've just installed PyPy on Windows and seen an approximately 10x speed improvement in some simulation code I'm running. I'd like to see similar on code using numpy, too. I'm not an experienced Python programmer however and I'm finding the instructions hard to follow. Does anyone know if installing numpy for PyPy on Windows is possible and if so what's the easiest way to do it?

The instructions provide two options.

Option no 1

If you have pip (the command-line assumes that it finds the pip belonging to PyPy, not the one from CPython):

pip install git+https://bitbucket.org/pypy/numpy.git

this seems like a great option but I can't find pip in the directory structure I unzipped into.

Option no 2

Alternatively, the direct way:

git clone https://bitbucket.org/pypy/numpy.git
cd numpy
pypy setup.py install

I haven't got git on Windows, but also I'm suspicious this option might involve compiling source code from https://bitbucket.org/pypy/numpy.git, and might not even be possible (or require a lot of hacking) on Windows.

Edit

Installing pip via https://sites.google.com/site/pydatalog/python/pip-for-windows as per the answer below, or the instructions in this answer to the question How do I install pip on Windows?, failed with ConnectionError: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /packages/py2.py3/p/pip/pip-1.5.4-py2.py3-none-any.whl (Caused by <class 'httplib.BadStatusLine'>: ''). See, e.g., this bug report. However I was able to install pip via Microsoft Visual Studio PTVS by right-clicking PyPy 2.7 under Python environments in Solution Explorer, selecting Install Python Package. This failed to install numpy (with another connection error) but did install pip.

Now that I have pip, I tried to install numpy on the command line using pip install git+https://bitbucket.org/pypy/numpy.git. First of all I needed to install git to do this... no problem. But then it failed with the following

building library "npymath" sources
No module named numpy.distutils.msvccompiler in numpy.distutils; trying from distutils
error: Unable to find vcvarsall.bat

I'm unfamiliar with installation of Python packages and I'm not sure what this means. I do have Visual Studio 2012 with the C++ compiler installed, but on the other hand this thread for Python 3.3 (I'm using 2.7 at the moment) seems to imply that a C++ compiler shouldn't be needed.

Edit

This seems to be nothing to do with pip installation. Following option 2

git clone https://bitbucket.org/pypy/numpy.git
cd numpy
pypy setup.py install

I still get Unable to find vcvarsall.bat. However, taking a hint from this answer, vcvarsall.bat can be found if you set the environment variable VS90COMNTOOLS to the appropriate directory. In my case I have VS2012, so the appropriate line is

set VS90COMNTOOLS=%VS110COMNTOOLS%

Now the compiler can be found but there is a compile error

_configtest.c
_configtest.c(4) : error C2061: syntax error : identifier 'npy_check_sizeof_type'
_configtest.c(4) : error C2059: syntax error : ';'
_configtest.c(7) : error C2065: 'npy_check_sizeof_type' : undeclared identifier error:

It seems like this is a file generated during the compile process that probably doesn't even need to be built. Nevertheless I think I might be really stuck now...

3
  • Why specifically pip. Pip hates windows. You can do binary downloads and install with an msi installer from here lfd.uci.edu/~gohlke/pythonlibs Commented Apr 3, 2014 at 17:02
  • That's for CPython isn't it? I already have everything I need for that. Can you help re pypy? Commented Apr 3, 2014 at 17:21
  • I have a regular version of python and it works. I've always had problems with pip, so I don't use it. Commented Apr 3, 2014 at 18:00

2 Answers 2

1

For the first option you should download pip from

https://sites.google.com/site/pydatalog/python/pip-for-windows

After that you should add in enviroment variable PATH the path of the pip.
Finally , you should use command prompt and use the

pip install git+https://bitbucket.org/pypy/numpy.git

Sign up to request clarification or add additional context in comments.

3 Comments

thanks. The instructions also says "If you have pip (the command-line assumes that it finds the pip belonging to PyPy, not the one from CPython)". Are there different pips for PyPy and CPython (which I already have installed) and/or do I need to take care that the pip I install from your link operates in the context of PyPy?
unfortunately the pip-for-windows link doesn't work for PyPy at least: I get ConnectionError: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /packages/py2.py3/p/pip/pip-1.5.4-py2.py3-none-any.whl (Caused by <class 'httplib.BadStatusLine'>: ''). The linked question also fails, for the same reason I think.
1

I don't think there would be any difference for numpy: Pypy is designed to speed up native python code, whereas numpy is written in C (as well as python) and is likely already compiled to maximise speed.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.