Grasshopper

algorithmic modeling for Rhino

Hi everybody!

I know that the question was already asked but I still struggle with the installation of numpy / scipy on ironpython. 

So if anybody have a tips to make it works it would be nice. :)

A tried a lot already but I cannot figure out the problem on step 4.  I did every steps describe there :https://stevebaer.wordpress.com/2011/06/27/numpy-and-scipy-in-rhino... and also there : https://store.enthought.com/repo/.iron/ (You should have an account to connect there.)

So I get an error of IO I think, in step 4. It is describe here : (>>> http://community.sharpdevelop.net/forums/t/16072.aspx )

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 


Any tips would be nice.  Thank's.

Tristan

Views: 25039

Replies to This Discussion

I had the same issue today. This is how I installed numpy and scipy.

The issue is that ironpkg cannot access the eggs because this also requires authentication. The reason you were able to install ironpkg (you'll see an egg file was created) is due to that fact that the egg data was in the install file ironpkg-1.0.0.py (see b64eggdata in the file).

1. The installation eggs are located here: https://store.enthought.com/repo/.iron/eggs/ 

2. Download the eggs and change to your local directory where you download them

3. Run this script in the same directory:

         https://gist.github.com/blondegeek/2dbc22360422d0c4b637

   as:

         ipy IronPython_numpy_scipy.py --install

4. Test with:

         ipy -X:Frames -c "import scipy"

Hope that works!

Tess

Thanks. It works!!!

I tried everything...still getting authentication error...

https://store.enthought.com/repo/.iron/eggs/ link doesn't work. Other posts claim you need an account there for the link to work, but there is no registration link whatsoever.

Link only works if you register. Register at Enthought's main page. If you can, let me know the size of your install. Usually it goes here or somewhere similar:

C:\Program File (x86)\IronPython 2.7

As I said, there is no registration at Enthought that I can find, either at http://enthought.com/ or http://store.enthought.com/ .

There are no register or login links at all, nor does the Free Download lead to anything but a newsletter offer, not an account:

This is the most convoluted installation of all time for Rhino. Basics like Numpy and Scipy should simply come with the normal Grasshopper/Rhino Python packages. After all, nobody who is a regular user will now be able to run my scripts except myself assuming it's even still possible to install Numpy. I am also looking at precompiled lNumpy but the 64 bit version seems to be wed to the AMD instead of Intel processor.

Oddly, in Firefox or Chrome browsers on Windows 7 that whole top line of links is missing, though it shows up on my iPhone Perfect browser just fine. The direct link I had indeed found in a Google search too:

https://store.enthought.com/accounts/login/

Sanity restored, or at least deeper down the rabbit hole I can now go.

NOTES:

IronPython installs as 32 bit and is merely a CMD window program, that also includes a 64 bit version in the Start menu:

Next the instructions says to modify PATH/"the path", but fails to tell what they really mean by that, as in what buttons to push, so I assume it's a Windows Path entry?

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 

Tutorial on setting a Windows environmental variable (path):

http://www.computerhope.com/issues/ch000549.htm

But this fails to point out that path contains many entries already separated by semicolons so if I merely add a new variable called "path" it's likely that I will destroy existing program function. There's no info on how to just tack on another entry, and the Windows 7 edit box doesn't even show the whole collection, but one item (!), so I copied the existing path into a text editor to see the whole collection successfully and added the C:\Program Files (x86)\IronPython 2.7 entry after an added semicolon, correcting for an Enthought page typo of no 's' on the end of "Program Files". I also checked the others and many pointed to old missing directories so I deleted those entries.

...and the test fails and "ipy" is not recognized as a command, even though the path now shows up using "path" in the Windows CMD window, that is if I copy all by right clicking and pasting the stuff into a text editor to really view it all. I can run it from the source directory just fine.

The rabbit hole was indeed deep. Using the Task Manager (control-alt-delete) to kill Explorer and then Run in the menu to restart "Explorer," along with restarting the Windows CMD window however, worked. I can now invoke Iron Python ("ipy") via command line from any directory. For the "path" I edited path in the System Variables and not the User Variables. No, you don't have to type that whole crazy line above just to test the path variable, just "ipy" (and control-Z to quite IronPython) in the CMD window invoked by typing "cmd" into the Start menu search box.

From the CMD line this step did work fine:

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)

But of course Step 4 fails, giving pages of what seem to be error messages;

C:\Users\Nik>ironpkg scipy

Traceback (most recent call last):

File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\enstaller\utils.

py", line 92, in write_data_from_url

File "C:\Program Files (x86)\IronPython 2.7\Lib\urllib2.py", line 126, in urlo

pen

File "C:\Program Files (x86)\IronPython 2.7\Lib\urllib2.py", line 397, in open

File "C:\Program Files (x86)\IronPython 2.7\Lib\urllib2.py", line 509, in http

_response

...

Why can't I just download Numpy as a normal file and thus also have it easy for other users to install it when they use my scripts? This is just crazy and lazy. The Enthought developer has turned this into a computer game, with a missing registration link and then the last step spits out errors with utterly no information on how to fix it manually.

This Step 4 error is covered here:

http://discourse.mcneel.com/t/trying-to-import-numpy-in-rhino-pytho...

The alternative IronPython_numpy_scipy.py install script did work from my last link:

Then I finished Step 4:

ipy -X:Frames -c "import scipy"

...and issuing "import numpy" gives no error after starting "ipy" form the CMD line.

Now what is Numpy good for I wonder? I hear it does big arrays quickly. And do I also have Scipy? Is that a bonafide package? Alas, "import scipy" gives an error:

C:\Users\Nik>ipy

IronPython 2.7 (2.7.0.40) on .NET 4.0.30319.34209

Type "help", "copyright", "credits" or "license" for more information.

>>> import numpy

>>> import scipy

Traceback (most recent call last):

File "<stdin>", line 1, in <module>

File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\scipy\__init__.p

y", line 124, in <module>

File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\numpy\_import_to

ols.py", line 15, in __init__

AttributeError: 'module' object has no attribute '_getframe'

>>>

...and again the rabbit hole is even deeper now. The directory and contents checks out fine except there is no "_import_to" like there is "__init__.py".

So where is Scipy? How do I activate/install it for real?

The above mentioned test gives no error, however:

 ipy -X:Frames -c "import scipy"

...yet the same import from within IronPython does give an error.

Attachments:

I also cannot import Numpy using the Rhino EditPythonScript editor, after adding a search path the the IronPython library folder:

Including more paths (based on http://www.grasshopper3d.com/forum/topics/numpy-for-iron-python-wit... ) also fails to allow numpy import:

Numpy and Scipy are in directories here:

C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\

This is all a sad joke, taking a full day so far. Rhino just sort of sucks for serious work. There's no way I can offer any Numpy/Scipy scripts to clients this way, just impossible. Rhino/Grasshopper Python should come with this stuff, dear developers, or have a simple installer that just works. It comes with math already doesn't it? So why not Numpy and Scipy for serious users?

Upon restarting Rhino, it totally changes behavior and spits out a crazy error upon importing Numpy:

Message: The type initializer for 'NumpyDotNet.NpyCoreApi' threw an exception.

Traceback:
  line 11, in <module>, "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\numpy\core\multiarray.py"
  line 6, in <module>, "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\numpy\core\__init__.py"
  line 155, in <module>, "C:\Program Files (x86)\IronPython 2.7\Lib\site-packages\numpy\__init__.py"
  line 1, in <module>, "C:\Users\Nik\AppData\Local\Temp\TempScript.py"

The Grasshopper Python node editor gives the same error. Perhaps I can only import parts of Numpy using "from Numpy import XXXX"?

I have turned on Frames in one of the option tabs of the EditPythonScript editor per this tutorial ( https://stevebaer.wordpress.com/2011/06/27/numpy-and-scipy-in-rhino... ) that also says you must manually add:

import clr
clr.AddReference("mtrand")

But that gives yet another error:

Nor can I import merely parts of Numpy:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service