Im trying to run a code for portfolio optimization and i get the following error right on import of pandas.
Traceback (most recent call last):
File "/Users/***/Desktop/Markowitz-master/MarkowitzOpt.py", line 2, in <module>
from pandas import Series, DataFrame
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas/__init__.py", line 18, in <module>
raise ImportError("Missing required dependencies {0}".format(missing_dependencies))
ImportError: Missing required dependencies ['pytz', 'dateutil']
I used pip freeze to check all installed packages, and both puts and dateutil are installed.
Any insights would be appreciated!!!
dateutil can get confused with python-dateutil, try the following:
pip install python-dateutil pytz --force-reinstall --upgrade
If you are also using conda you may have to also update the packages in conda.
conda update python-dateutil pytz
This worked for me.
Note: I was getting the error when I attempted to load pandas in IPython for Python 2.7.15. I was not in a conda virtual env but the ipython install that was being loaded came from conda. Updating the packages in conda solved the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With