Replicating this is easy, after installing NumPy:
From TCL:
PYTHON
import numpy
quit()
PYTHON
import numpy
Will crash every time. Same results from running the code from a python file.
Having the ability to use NumPy would really enable some great functionality in UV and I would really like to get this working. Is anyone else having a similar issue?
------------------------------
Nic Davidson
Combined Transport
------------------------------
Replicating this is easy, after installing NumPy:
From TCL:
PYTHON
import numpy
quit()
PYTHON
import numpy
Will crash every time. Same results from running the code from a python file.
Having the ability to use NumPy would really enable some great functionality in UV and I would really like to get this working. Is anyone else having a similar issue?
------------------------------
Nic Davidson
Combined Transport
------------------------------
When UniVerse exits the Python shell, it re-initializes the Python environment. Some packages (numpy being one of them ) make changes that are not affected by the initialization and cause problems when imported again.
Set the REINIT.PYTHON to OFF, and it should stop it from aborting.
i.e.
>REINIT.PYTHON OFF
>PYTHON
python> import numpy
python> quit()
>PYTHON
python> import numpy
python>
Note that I plan to look a bit deeper into the abort, since it is a bit drastic.
------------------------------
Michael Rajkowski
Rocket Software
------------------------------
When UniVerse exits the Python shell, it re-initializes the Python environment. Some packages (numpy being one of them ) make changes that are not affected by the initialization and cause problems when imported again.
Set the REINIT.PYTHON to OFF, and it should stop it from aborting.
i.e.
>REINIT.PYTHON OFF
>PYTHON
python> import numpy
python> quit()
>PYTHON
python> import numpy
python>
Note that I plan to look a bit deeper into the abort, since it is a bit drastic.
------------------------------
Michael Rajkowski
Rocket Software
------------------------------
Michael,
After adding the command to VOC this worked perfectly! Thanks!
For anyone else having the issue this is what I ended up doing to make life easier:
Made a new (really tiny) module:
u2_numpy
-- __init__.py
-- u2_numpy.py
File contents:
__init__.py:
from .u2_numpy import *
u2_numpy.py:
# I made some changes to u2py and have my own version. This line could be just import u2py
import u2py_new as u2py
command = u2py.Command("REINIT.PYTHON OFF")
command.run()
import numpy
In any module/file where I need to use numpy just do:
import u2_numpy as numpy
And you should be good to go! No issues for me as of yet.
You would have to do this again if you wanted s different numpy type module (EX: Pandas). Potential way around this would be adding the u2py command to Numpy...but then you would have to "fix" it again on each package update.
------------------------------
Nic Davidson
Combined Transport
------------------------------
Michael,
After adding the command to VOC this worked perfectly! Thanks!
For anyone else having the issue this is what I ended up doing to make life easier:
Made a new (really tiny) module:
u2_numpy
-- __init__.py
-- u2_numpy.py
File contents:
__init__.py:
from .u2_numpy import *
u2_numpy.py:
# I made some changes to u2py and have my own version. This line could be just import u2py
import u2py_new as u2py
command = u2py.Command("REINIT.PYTHON OFF")
command.run()
import numpy
In any module/file where I need to use numpy just do:
import u2_numpy as numpy
And you should be good to go! No issues for me as of yet.
You would have to do this again if you wanted s different numpy type module (EX: Pandas). Potential way around this would be adding the u2py command to Numpy...but then you would have to "fix" it again on each package update.
------------------------------
Nic Davidson
Combined Transport
------------------------------
I like the setting of REINIT.PYTHON from Python. I tend to decide if I want it on or off for an account and/or user and add the REINIT.PYTHON OFF to the LOGIN paragraph of the account in question, yet since there may be times you need to use a package that requires it off, you method looks promising.
------------------------------
Michael Rajkowski
Rocket Software
------------------------------
I like the setting of REINIT.PYTHON from Python. I tend to decide if I want it on or off for an account and/or user and add the REINIT.PYTHON OFF to the LOGIN paragraph of the account in question, yet since there may be times you need to use a package that requires it off, you method looks promising.
------------------------------
Michael Rajkowski
Rocket Software
------------------------------
Verb "REINIT.PYTHON" is not in your VOC.
How do I get this very helpful feature?
Joe Miele
------------------------------
Joseph Miele
Self Registered
Clinton IA United States
------------------------------
Verb "REINIT.PYTHON" is not in your VOC.
How do I get this very helpful feature?
Joe Miele
------------------------------
Joseph Miele
Self Registered
Clinton IA United States
------------------------------

I will warn you that I have had some minor issues with the REINIT.PYTHON when running some code. For example, when logging, I would get an additional log entry for every time I reran the program without logging back in.
First time: Logs once
Second time: Logs twice
Third time: Logs three times
...and so on
HOWEVER! We recently updated to UV 12.X.X and on a couple of the modules I have tried (Numpy, XLRD) have both had the issues fixed without having to use REINIT.PYTHON There may be modules that will still need it...but thus far no issues.
------------------------------
Nic Davidson
Developer
Combined Transport Inc
Medford OR United States
------------------------------

I will warn you that I have had some minor issues with the REINIT.PYTHON when running some code. For example, when logging, I would get an additional log entry for every time I reran the program without logging back in.
First time: Logs once
Second time: Logs twice
Third time: Logs three times
...and so on
HOWEVER! We recently updated to UV 12.X.X and on a couple of the modules I have tried (Numpy, XLRD) have both had the issues fixed without having to use REINIT.PYTHON There may be modules that will still need it...but thus far no issues.
------------------------------
Nic Davidson
Developer
Combined Transport Inc
Medford OR United States
------------------------------
It worked! Fantastic!
Thank you for the VOC entry and for the additional information.
Joe Miele
------------------------------
Joseph Miele
Self Registered
Clinton IA United States
------------------------------
Sign up
Already have an account? Login
Welcome to the Rocket Forum!
Please log in or register:
Employee Login | Registration Member Login | RegistrationEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.