Python Integration problem - Eviews 11 Enterprise Edition

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

marend
Posts: 13
Joined: Fri Jul 19, 2013 12:20 pm

Python Integration problem - Eviews 11 Enterprise Edition

Postby marend » Tue May 07, 2019 8:05 am

Hello, I am trying to use Python in Eviews. I followed the instructions using xopen(p), which opens a python command console, but then when trying to import the pandas package ( import pandas as pd) I get the following error message:

Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Anaconda3\lib\site-packages\pandas\__init__.py", line 19, in <module>
"Missing required dependencies {0}".format(missing_dependencies))

And when I try to import the numpy package (import numpy as np) I get the following error message:

Unknown Python error

Can you please help me to solve this problem.

Thank you,

EViews Steve
EViews Developer
Posts: 552
Joined: Tue Sep 16, 2008 3:00 pm
Location: Irvine, CA

Re: Python Integration problem - Eviews 11 Enterprise Edition

Postby EViews Steve » Tue May 07, 2019 2:34 pm

The first thing to do when you encounter an error caused by running a Python command is to run it directly within Python to see if it's caused by EViews or not. If the command also generates an error within Python directly, then it's not an EViews problem.

That said, this specific error is caused by not having the Pandas & Numpy library installed in your Python environment. Without the libraries pre-installed, you can't import it.

EViews 11 will not install any Python libraries for you. You have to do this yourself. EViews does try to use both Pandas and Numpy if it detects it, but if it doesn't, then EViews will default to using base Python data types when pushing object data.

Here's a page describing how to install Numpy into your Python environment.
Here's the page describing how to install Pandas.

We also wrote a blog post that describes how to install the these libraries in your generic Python environment. It's basically just using the PIP command (run this command OUTSIDE of python):

Code: Select all

pip install numpy
pip install pandas

If you are using a conda python environment (e.g. Anaconda), you should use the CONDA command instead of PIP (run these in a Conda command prompt):

Code: Select all

conda install numpy
conda install pandas


Once you have successfully installed these libraries, then you can run the Python command:

Code: Select all

import numpy as np

both within Python directly or from EViews.

Steve

marend
Posts: 13
Joined: Fri Jul 19, 2013 12:20 pm

Re: Python Integration problem - Eviews 11 Enterprise Edition

Postby marend » Tue May 07, 2019 3:23 pm

I installed numpy and pandas in the home directory and changed in Eviews the COM ProgID for Python Home Path to the home directory (C:\Users\HP Z800 in my case), but I still have the same problem, with the following error message:

Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\HP Z800\lib\site-packages\pandas\__init__.py", line 19, in <module>
"Missing required dependencies {0}".format(missing_dependencies))

Please help.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 12158
Joined: Tue Sep 16, 2008 5:38 pm

Re: Python Integration problem - Eviews 11 Enterprise Edition

Postby EViews Gareth » Tue May 07, 2019 4:37 pm

Can you run

Code: Select all

import pandas as pd

from within Python (not inside EViews)?
Follow us on Twitter @IHSEViews

marend
Posts: 13
Joined: Fri Jul 19, 2013 12:20 pm

Re: Python Integration problem - Eviews 11 Enterprise Edition

Postby marend » Tue May 07, 2019 5:20 pm

I have never had any problem in working with Pandas and Numpy, actually tboth packages work perfectrly in Spyder Jupyternotebook.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 12158
Joined: Tue Sep 16, 2008 5:38 pm

Re: Python Integration problem - Eviews 11 Enterprise Edition

Postby EViews Gareth » Tue May 07, 2019 5:53 pm

Sure, but can you run that command from within Python?
Follow us on Twitter @IHSEViews

marend
Posts: 13
Joined: Fri Jul 19, 2013 12:20 pm

Re: Python Integration problem - Eviews 11 Enterprise Edition

Postby marend » Tue May 07, 2019 8:41 pm

I was able to do it. I had to reinstall Pyhton in my computer and create a Path in a new location (I thought it might had been an issue of whitespaces in the folder where the packages were installed). I am not certain of what it was, but know is working. Thank you


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 3 guests