Trying to import Numpy in Rhino Python but I'm getting this error : "cannot import multiarray from numpy.core"


#1

Hi all,

I want to import Numpy in Rhino Python in the hope of doing some beautiful viz like those one : http://bokeh.pydata.org/docs/gallery.html

so I followed steve guide here :

but when I type Import Numpy and exectue it, I get this error : “cannot import multiarray from numpy.core”

I tried to install Numpy using other package and other mean I found in the internet but it’s always the same error, and I googled to see if someone had the same problem to no avail…anyway if someone has and idea on what is the problem it will really help me.


Pandas in Ironpython
Image processing library integration to Rhino (scikit-image, OpenCV, Emgu CV, etc)?
(Giulio Piacentino) #2

This worked on my system a few months ago – the main issue was that this was only for Rhino 5 32-bit.
…where are you receiving the

message?

Giulio

Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com


#3

Hi Giulio,

Sorry I just saw your answer, thanks for the headings, I’m pretty sure I tried on a 32-bit machine before and it didn’t work, I guess I should re-try again. anyway here is the error screen message:


(Giulio Piacentino) #4

Sorry maybe this was not very clear: I am really meaning Rhino 5 32-bit, not a 32-bit machine (which in fact can only have Rhino 32 bit).

I know I had tried importing NumPy with an older version that was hosted on this page: http://www.enthought.com/repo/.iron/ but this page is no longer available…

Maybe someone else knows where it is now, or if it only a temporary issue of that webpage.

Giulio

Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com


#5

Yeah Giulio I tried with Rhino 32bit on both a 32-bit machine and 64-bit machine and it’s still displaying the same error, even on other people computer.

for thie website you linked : https://store.enthought.com/repo/.iron/ it’s the one I used, the page is still working but you have to have an account and be logged in to see the content.


(Giulio Piacentino) #6

I see. Well, given that the IronPython implementation has not changed in Rhino 5, it is likely that they upgraded their support to a newer version or use another initialization system.

Could you ask them what version of IronPython they support? You can see Rhino’s version like this:

import sys
print(sys.version)

On my system, this prints 2.7.4 (IronPython 2.7.4 (2.7.0.40) on .NET 4.0.30319.34014 (32-bit))


#7

It used to be that the following lines of code should be added before importing numpy

import clr
clr.AddReference("mtrand")
import numpy

hope this helps

t
.


#8

hello tmsmendez, I tried executing

import clr
clr.AddReference(“mtrand”)

but it give me this error :

thanks anyway


#9

Okay since you brought back this topic tmsmendez I have been trying since yesterday to resolve this old problem and finnally today I made it work!! :smile: :smile: :smile:

basically I think since Enthought changed their index access a litte bit it screwed the installation of the module, to make it work I had to manually download all the Egg files then open .ironpkg file and edit the index to the local repository where I put the installation files.

So anyway I hope this can help other people, I will try to put a better explanation/tutorial if it’s not clear enough.


#10

That would be very much appreciated!


#11

Hello,

I will be needing NumPy (and possibly SciPy) and I’m not very familiar with the “architecture” behind all the Python installation used by Rhino. It would be very helpful if you could put more informations (a small tutorial would be fabulous) on how you succeeded in finally using NumPy in Rhino.

Thanks


#12

Hello,

As many people said, the link to https://store.enthought.com/repo/.iron/ no longer seems to work. Has anybody found another way to install NumPy and/or SciPy and make it work with Rhino’s implemetation (IronPython 2.7)?

Thanks


#13

To get that link working you first have to create an account at

https://www.enthought.com

Once this is activated the link should work.

Im still trying to get numpy to work here so if anyone can provide a more detailed explanation it would be greatly appreciated!


#14

Thanks. It’s true that once you log into the enthought account the web page https://store.enthought.com/repo/.iron/ becomes accessible.

My problem now is that the authentication doesn’t seems to work as I get this error:

IOError: System.IO.IOException: Échec de l’authentification, car le site distant a fermé le flux de transport.

which means:

IOError: System.IO.IOException: Authentication failed because the remote site has closed the communication stream.

Any thought?


#15

At what stage are you getting this error?

Are you able to see this page?

I cant seem to get step 2 to work.

@piac @P_Thon, are you able to help with this?


#16

Hello,

Once I log into the my Enthought account, I see the page you are talking about. I have successfully installed IronPython (step 1) and made it available by adding the installation path to the my user PATH environment variable (step 2).

I also downloaded the file ironpkg-1.0.0.py in a tmp directory and run the installation command:

C:\temp>ipy ironpkg-1.0.0.py --install
Bootstrapping: c:\users\bmartin\appdata\local\temp\tmpnkqsba\ironpkg-1.0.0-1.egg

   118 KB [.................................................................]

It’s now when I try step 4 that I get the authentification error :
IOError: System.IO.IOException: Échec de l’authentification, car le site distant a fermé le flux de transport. (see below the complete error transcript)

:


Cannot run _EditPythonScript . "Failed to load language..."
#17

The solution to the authentication problem was posted on the Grasshopper Discussions forum: Scipy and Numpy. The idea is to bypass the problem by first downloading the eggs and proceed with the installation locally by running the script IronPython_numpy_scipy.py from the same directory:IronPython_numpy_scipy.py (1.3 KB)

C:\temp\eggs>ipy IronPython_numpy_scipy.py --install
Bootstrapping: numpy-2.0.0-1.egg
  6.97 MB [.................................................................]
Bootstrapping: scipy-1.0.0-2.egg
 29.32 MB [.................................................................]

#18

Ok, I seem to be making progress. Everything seems to have installed however when I test it i get the following error:

Message: Could not add reference to assembly mtrand

This is occurring in the 32 bit version and I have the files to the rhino python search path.

Does anyone know a way around this?

Edit:
Success! after reinstalling all the packages it seems to be working correctly. For anyone else:
Step 2) Open up cmd.exe in administrator mode then type "cd C:\Program Files (x86)\IronPython 2.7"
Step 2.1) Download all the .egg files on the enthought page to C:\Program Files (x86)\IronPython 2.7 (or similar)
Step 4) use the script here and install in the same way as 3. This should install all the modules in step 4.
Continue on as described in Steve’s post up top.


#19

There is no registration link on Enthought.com as of October 2015.

UPDATE: the very top line of links including registration is missing in both Firefox and Chrome in Windows 7, but the direct link works fine:

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

I’m making notes of the entire install here:


#20

Hi bmartin… I hope you could help me.
I have not been able to execute ‘C:\temp>ipy ironpkg-1.0.0.py --install’ and I have not idea why. I have followed the instruction of this discussion and also the one on here http://www.grasshopper3d.com/forum/topics/scipy-and-numpy.

I keep on getting this error message. Do you have ny idea why?


Thanks in advance.