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 would like to just use one of these prepared binaries, actually:

http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy

http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy

...which use bizarre "wheel" format installers, needing Pip, which in catch-22 fashion is itself packaged as a .whl file:

http://www.lfd.uci.edu/~gohlke/pythonlibs/#pip

...but I have no idea how to point it towards IronPython or the Rhino Python plugin, nor initially even how to install Pip since the instructions ( https://pip.pypa.io/en/latest/installing/#install-pip ) fail using IronPython as "ipy python get-pip.py" which gives an error:

Traceback (most recent call last):

File "get-pip.py", line 17759, in <module>

File "get-pip.py", line 156, in main

File "get-pip.py", line 74, in b85decode

TypeError: sequence item 0: expected bytes or byte array, str found

The author of a book on IronPython eventually rejected the Enthought versions of Numpy/Scipy:

http://blog.johnmuellerbooks.com/2014/12/12/numpy-and-scipy-update/

The real issue is Rhino still using obsolete 2.7 IronPython instead of the latest Python 3.x. Can I use my own Python editor to control Rhino via Rhinocommon? I'd sure like to also swim around in Grasshopper Python with the advanced math libraries, but the installation is only becoming more broken over time, not less, it seems, and no clients will ever be able to follow these convoluted hacks to do an install.

Related caveats are here:
http://www.johndcook.com/blog/2012/05/21/using-scipy-with-ironpython/

Initial excitement about the Enthought package is here:
http://ironpython-urls.blogspot.com/2010/07/numpy-and-scipy-for-iro...

Learning that wheel archives are merely zip files, changing the extension to zip let me move the numpy folder into the Rhino IronPython plugin folder, in C:\Program Files\Rhinoceros 5.0 (64-bit)\Plug-ins\IronPython\Lib\site-packages, then include that search path in the EditPythonScript editor options, but upon importing numpy I get the same multiarray error mentioned by other users before, and even just importing some part of numpy gives the same error:

Granted, I used the numpy‑1.10.0+mkl‑cp35‑none‑win32.whl which is 32 bit, on my 64 bit Rhino installation. Trying numpy‑1.10.0+mkl‑cp35‑none‑win_amd64.whl despite my Intel instead of AMD processor gives the same error.

Google has many hits for: IronPython multiarray.

You're a lifesaver! Thanks!!

Many thanks to both of you. Have a good day. 

Hello everyone,

Has anyone gotten scipy to work on Rhino/Gh?

I also seem to be missing a bunch of modules from both numpy and scipy. My numpy directory in Anaconda is around 90MB, but my numpy directory in Ironpython is 4MB. Scipy in Anaconda is 300MB but in Ironpython it's < 3MB. 

I'm pretty sure that's the reason I can't get scipy to import. 

Thank you!

Hi Jesus,

I'm not sure what is causing your import error. However, regarding why the size of scipy in Anaconda is larger than scipy for IronPython -- my understanding is that scipy and numpy contain many packages that are actually wrappers for C and even FORTRAN code and these modules have not been ported over to C# for use in .NET.

Good luck with the import bug!

Tess

I'm pretty sure the import error is due to missing modules.

About your hypothesis, your basically saying that what is missing is because it cannot run in IronPython only in standard Python?

For those curious here is a comparison between scipy and numpy in Anaconda vs Ironpython.

Sorry for late reply.  

I had a same error... This post would be a solution.

Now I'm wondering how to access Rhinocommon and thus Rhino from outside of the IronPython editors in Rhino or Grasshopper, hinted at here:

http://wiki.mcneel.com/developer/pythonandrhinocommon

http://wiki.mcneel.com/developer/rhinocommon

That way I could use independent Python 3.5 after installing Numpy/Scipy in the normal way, yet still control Rhino and even access Grasshopper components.

Is this possible?

You can sort of use the commercial PyCharm editor but alas it seems you must still use IronPython as the interpreter so it doesn't solve the Numpy/Scipy library problems:

http://discourse.mcneel.com/t/using-pycharm-for-editing-rhinopython...

https://stevebaer.wordpress.com/2010/06/12/configuring-pydev-for-rh...

IronPython 3 was in development, but the whole blog hasn't been updated since 2013 either:

http://blog.jdhardy.ca/2013/06/ironpython-3-todo.html

So how do I install Rhinocommon etc. for use with a normal Python 3.x interpreter? This video shows a standard non-IronPython 2.7.3 interpreter evidently being used within the PyCharm editor:

https://www.youtube.com/watch?v=6ar_CWDZIt0

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service