pandas doesn't work with gurobipy

373 views
Skip to first unread message

Zheng Zhu

unread,
Aug 22, 2017, 12:34:42 AM8/22/17
to Gurobi Optimization
Hi, all


it seems that pandas doesn't work with gurobipy, when I run gurobipy with python script (see attached), it says




Traceback (most recent call last):

File "portfolio.py", line 23, in <module>

import pandas as pd

ImportError: No module named pandas





I am pretty sure gurobipy works with numpy and matplotlib, also all these libraries were installed via anaconda, does anyone know how to fix this problem ?
portfolio.py

Sonja Mars

unread,
Aug 22, 2017, 2:10:39 AM8/22/17
to gur...@googlegroups.com
Hi,

Are you sure you are using anaconda python? How are you calling that script? Are you using 

python portfolio.py

If so, what does it look like if you just enter 

python

into a console window?

Best regards, 
Sonja 


----
Dr. Sonja Mars
Gurobi Optimization - Technical Support 

Zheng Zhu

unread,
Aug 25, 2017, 3:57:56 PM8/25/17
to Gurobi Optimization

Hi,   Sonja Mars

If I type python portfolio.py

Traceback (most recent call last):

  File "portfolio.py", line 25, in <module>

    import matplotlib.pyplot as plt

ImportError: No module named matplotlib.pyplot




If I try gurobi.sh portfolio.py



Traceback (most recent call last):

  File "portfolio.py", line 23, in <module>

    import pandas as pd

ImportError: No module named pandas



If I type python


Python 2.7.13 |Continuum Analytics, Inc.| (default, Dec 20 2016, 23:05:08) 

[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin

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

Anaconda is brought to you by Continuum Analytics.

Please check out: http://continuum.io/thanks and https://anaconda.org


I assume gurobi.sh portfolio.py  is the right way to call this script,   do you have any idea why it doesn't work with pandas library ? It seems to me it works with numpy , scipy , matplotlib if I call gurobi.sh portfolio.py

Sonja Mars

unread,
Aug 29, 2017, 1:46:57 AM8/29/17
to gur...@googlegroups.com
Hi,

If I type python portfolio.py
This is the correct call and it should work fine. For me it is working fine. Did you change anything in your Anaconda installation? What output do you get if you type 
conda list matplotlib
For me this looks like:
# packages in environment at /Library/anaconda:
#
matplotlib                2.0.2               np112py27_0  

You can try to install matplotlib again using:
conda install matplotlib

If I try gurobi.sh portfolio.py
This will not work, as gurobi.sh is a very basic Python installation with almost no additional modules. 


I assume gurobi.sh portfolio.py  is the right way to call this script,   do you have any idea why it doesn't work with pandas library ? It seems to me it works with numpy , scipy , matplotlib if I call gurobi.sh portfolio.py
No, it does not. They are not installed in gurobi.sh. It stops working on the first import (import pandas) the others are not executed.

Best regards, 
Sonja 


----
Dr. Sonja Mars
Gurobi Optimization - Technical Support 


Gurobi Optimizer 7.5 — State-of-the-art performance and 
best-in-class support for your most important problems. 
Learn more at www.gurobi.com.




Zheng Zhu

unread,
Aug 31, 2017, 3:30:19 PM8/31/17
to Gurobi Optimization


On Monday, August 28, 2017 at 10:46:57 PM UTC-7, Sonja Mars wrote:
Hi,

If I type python portfolio.py
This is the correct call and it should work fine. For me it is working fine. Did you change anything in your Anaconda installation? What output do you get if you type 
conda list matplotlib
For me this looks like:
# packages in environment at /Library/anaconda:
#
matplotlib                2.0.2               np112py27_0  

You can try to install matplotlib again using:
conda install matplotlib

If I try gurobi.sh portfolio.py
This will not work, as gurobi.sh is a very basic Python installation with almost no additional modules. 


I assume gurobi.sh portfolio.py  is the right way to call this script,   do you have any idea why it doesn't work with pandas library ? It seems to me it works with numpy , scipy , matplotlib if I call gurobi.sh portfolio.py
No, it does not. They are not installed in gurobi.sh. It stops working on the first import (import pandas) the others are not executed.


Thanks, I forgot to Install Gurobi into Anaconda, it works once I fix that.
Reply all
Reply to author
Forward
0 new messages