Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install Numeric (old numpy) and old version of Python (e.g. Py 2.4)

I have some very old Python code (written around the time of Python 2.2/2.3 and using Numeric libraries which I understand were the precursor to Numpy). I'm hoping to re-invigorate this with a re-write in Python 3 and Scipy, although I'd like to get the old code working again for testing purposes.

I feel like this should be possible, since Open Source software often keeps the old releases hosted, although I'm having trouble achieving this.

Firstly, I tried using conda to create a Py2.3 installation:

conda create -n py23 python=2.3

and it can't find Python 2.3. Thus I create a Py2.7 environment.

Pressing on with a Py 2.7 active environment in my terminal, I can see Numeric 24.2 listed using pip (pip search Numeric), but it refuses to install it using the command

pip install Numeric

Finally, I tried downloading the source code and in an active Py2.6 environment, running

python setup.py install

and I get the following error:

running install
running build
running build_py
running build_ext
building 'umath' extension
C:\Users\USERNAME\AppData\Local\Programs\Common\Microsoft\Visual C++ for 
Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -        
DHAVE_INVERSE_HYPERBOLIC=0 -IInclude -IPackages\FFT\Include -
IPackages\RNG\Include "-IC:\Program Files\Anaconda3\envs\py27r\include" "-
IC:\Program Files\Anaconda3\envs\py27r\PC" /TcSrc\umathmodule.c 
/Fobuild\temp.win-amd64-2.7\Release\Src\umathmodule.obj
umathmodule.c
Src\umathmodule.c(1005) : warning C4244: '=' : conversion from 'double' to 
'float', possible loss of data
Src\umathmodule.c(1297) : warning C4146: unary minus operator applied to 
unsigned type, result still unsigned
Src\umathmodule.c(2405) : error C2099: initializer is not a constant
Src\umathmodule.c(2405) : error C2099: initializer is not a constant
Src\umathmodule.c(2407) : error C2099: initializer is not a constant
Src\umathmodule.c(2407) : error C2099: initializer is not a constant
WARNING: '' not a valid package name; please use only .-separated package 
names in setup.py
error: command 
'C:\\Users\\USERNAME\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual 
C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2

Could someone please advise where I'm going wrong? Is it even possible to setup a Python + Numeric development environment from circa early 2000s?

My machine is a 64-bit Windows 10 machine.

like image 519
PhysLQ Avatar asked Oct 30 '22 08:10

PhysLQ


1 Answers

The Numeric package was maybe depracated too long ago, try instead to install numpy 1.8 in your installation and write at the start of your code:

from numpy import oldnumeric as Numeric

For the old numpy do in the installation:

pip install numpy==1.8

like image 128
bugMiner Avatar answered Nov 17 '22 06:11

bugMiner