How to install numpy and scipy for Ironpython27?
Solution 1
[COMMENT BY ENTHOUGHT SUPPORT: The link in this answer is not valid. See answer below by Jonathan March on August 17, 2018]
For those struggling to get numpy/scipy install for ironpythopn, enthought have moved the download link to https://store.enthought.com/repo/.iron/ . The link would only allow you in if you are registered.
Therefore first up you'd have to register yourself for free, then open the above link, then follow the steps below
Download the IronPython-2.7.msi and install it.
Download ironpkg-1.0.0.py from the above link.
- Using command line navigate to the directory where you placed ironpkg-1.0.0.py and run
ipy ironpkg-1.0.0.py --install
Check whether the install worked usingironpkg -h
-
The last step is lightly different to the one suggested by enthoughts. Running
ironpkg scipy
won't work as it looks at the old web address for download. Instead download all the eggs andindex-depend.txt
from the above link. For installation to work, you would have to modify the download location in the config file to point to the local drive instead of website. The config file can be found at user directory eg.C:\Users\Nilster\.ironpkg
. Open it in the textpad and change the location to directory where you downloaded the eggs Eg, mine looks likeIndexedRepos = ['file://C:\Work\Python\Enthought_Eggs',]
Then run the following to install numpy/scipy
ironpkg scipy
Check whether the install worked using
ipy -X:Frames -c "import scipy"
Solution 2
Enthought support here.
The Iron Python numpy and scipy packages can be downloaded here: http://code.enthought.com/.iron/README.txt http://code.enthought.com/.iron/eggs/index.html
FYI, Microsoft stopped work on the IronPython project in 2012 in favor of supporting standard CPython. Those archived versions of numpy and scipy were built in 2011 (so contain no newer features or fixes), and are 32-bit-only. We do not plan to update them in any way.
FYI, we typically recommend that those who wish to use Python in a .net context consider using the actively developed pythonnet package to interface with the living CPython ecosystem.
Solution 3
Just to confirm @Nilster's second sentence: I just received an email from Enthought support saying the following: [Note: this link is obsolete.]
The IronPython repos are still available, but are no longer maintained. To access them, you must be logged in on Enthought.com. The link to these repos is: http://www.enthought.com/repo/.iron/
After signing up I followed Nilster's instructions and everything worked without a hitch. The only that I'd add is that the .ironpkg config file mentioned in step 4 is a system file according to Windows, so you show system files in Windows folder view options; just showing hidden files won't reveal it
Solution 4
So instructions at the Enthough link got me all the way to the step 4 (ironpkg scipy) but then I had issue with urllib2 (I don't know what went wrong, it just says "Can't open URL ...")
And while this one is more current post: http://www.grasshopper3d.com/forum/topics/scipy-and-numpy I'm still stuck at: 'NumpyDotNet.NpyCoreApi' threw an exception
so I'm giving up, this has been a rabbit hole. Issue is clearly that IronPython is super old and should be avoided in my opinion.
Solution 5
Updated Instructions July 2019:
I was able to get scipy up and running in IronPython but wasn't able to follow @Nilser's instructions completely. Here are some updated instructions to get it working.
Like others have said, the repo is now at http://code.enthought.com/.iron/eggs/index.html. Don't bother signing up for an Enthoughts account to access the old link, like some of the above comments suggest.
The ironpkg-1.0.0.py file is no longer hosted in Enthought's repo for some reason. I was able to track it down and am hosting it on github so it's easier to find.
- Download IronPython-2.7.5.msi from the IronLanguages GitHub page and install it. I wasn't able to get scipy to work on newer versions of IronPython. I believe the dlls are bound to the 2.7.5 release of IronPython.
- Add the
IronPython 2.7
andIronPython 2.7\Scripts
folders to your PATH environment variable. - Download
ironpkg-1.0.0.1.egg
from the Enthought repo. - Copy the contents of the ironpkg-1.0.0.py file from GitHub and create a new file with the contents named
ironpkg-1.0.0.py
in the same folder that you downloaded the ironpkg egg. - Open the cmd prompt as an administrator and navigate to where the ironpkg-1.0.0.py file is. Run
ipy ironpkg-1.0.0.py --install
. Check whether the install worked usingironpkg -h
. - Since Enthoughts changed the location of their repository, it is necessary to change the ironpkg config file to point to the address of the new location. This config file will be created in the user directory when you first try to install scipy, but the default file contents can be changed before the file is created by updating the
config.py
file for the enstaller package. This will be in the IronPython stdlib, wherever IronPython got installed to. For me it wasc:\program files (x86)\ironpython 2.7\lib\site-packages\enstaller\config.py
. Open it in a textpad. The default file contents are in theRC_TMPL
variable. Update the address in the string to be:
IndexedRepos = [
'http://code.enthought.com/.iron/eggs',
]
- Now you can run
ironpkg scipy
to install scipy and its dependencies. - Check whether the install worked by running
ipy -X:Frames -c "import scipy"
![MacSanhe](https://i.stack.imgur.com/Pm2uK.jpg?s=256&g=1)
MacSanhe
Updated on July 09, 2022Comments
-
MacSanhe almost 2 years
I think this is the most popular way to do it before:
https://pytools.codeplex.com/wikipage?title=NumPy%20and%20SciPy%20for%20.Net
But this link is no longer exist:
https://store.enthought.com/repo/.iron/
I recently found a clone for the instruction, and also found a clone of ironpkg-1.0.0.py on github. But http://www.enthought.com/repo/.iron/eggs/index-depend.txt is no longer exists in the internet(I googled it, but failed to find it)
Getting started with SciPy for .NET
1.) IronPython Download and install IronPython 2.7, this will require .NET v4.0.
2.) Modify PATH
Add the install location on the path, this is usually: C:\Program File\IronPython 2.7
But on 64-bit Windows systems it is: C:\Program File (x86)\IronPython 2.7
As a check, open a Windows command prompt and go to a directory (which is not the above) and type:
ipy -V PythonContext 2.7.0.40 on .NET 4.0.30319.225
3.) ironpkg
Bootstrap ironpkg, which is a package install manager for binary (egg based) Python packages. Download ironpkg-1.0.0.py and type:
ipy ironpkg-1.0.0.py --install
Now the ironpkg command should be available:ironpkg -h (some useful help text is displayed here)
4.) scipy
Installing scipy is now easy:
ironpkg scipy numpy-2.0.0b2-1.egg
Question
I think I have done as much as I can do. Any body succeed to install numpy and scipy for Ironpython27?
-
Nilster over 8 yearsHi, just checked and the link above still works. As I said, you would have to register as a user to see the content of the webpage otherwise "Page not Found" would appear. If you see this message, click on the very top right to create a new account and once you are a registered user try the link again to download the files.
-
T3am5hark over 8 yearsOops, you're correct. Was confused by site behavior of "page not found" rather than the more conventional "must log in", but it's exactly as you said.
-
T3am5hark over 8 yearsDoes this work on 64-bit systems as well? I was able to get through the installation but am now stuck with "Failed while initializing NpyCoreApi: BadImageFormatException: An attempt was made to load a program with an incorrect format" when attempting to load the NumpyDotNet.dll assembly.
-
Aaron almost 8 yearsI cannot get ipy to load the NumpyDotNet DLL. I've added the "...\IronPython 2.7\DLLs" directory to both my IRONPYTHONPATH and my system Path environment variables, and I always get a "No module named NumpyDotNet" error. Any thoughts?
-
Liam McInroy almost 6 yearsLook to code.enthought.com/.iron/eggs/index.html for the new link
-
stijn over 3 yearsStill works, but note that when embedding this in a .Net application make sure sys.path is setup correctly (add full path to Lib;Lib/site-packages;DLLs directories from the IronPython stdlib), the
frames
option is set, and first doclr.AddReference('mtrand.dll')
before importnig scipy otherwise it it cannotimport mtrand
.