Issue
I created a virtual environment named quora for python. I installed wheel and then pandas as instructed. I cant get pandas to work for some reason. Can someone help me. I have tried all the other solutions available to similar questions on this website. Still no use.
(quora) (jessie)griffith@localhost:~/environments$ sudo pip install wheel
Requirement already satisfied: wheel in /usr/lib/python2.7/dist-packages
(quora) (jessie)griffith@localhost:~/environments$ sudo pip install pandas
Requirement already satisfied: pandas in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied: pytz>=2011k in /usr/local/lib/python2.7/dist-packages (from pandas)
Requirement already satisfied: numpy>=1.7.0 in /usr/local/lib/python2.7/dist-packages (from pandas)
Requirement already satisfied: python-dateutil in /usr/local/lib/python2.7/dist-packages (from pandas)
Requirement already satisfied: six>=1.5 in /usr/lib/python2.7/dist-packages (from python-dateutil->pandas)
(quora) (jessie)griffith@localhost:~/environments$ python getdata.py
Traceback (most recent call last):
File "getdata.py", line 2, in <module>
import pandas as pd
ImportError: No module named 'pandas'
Solution
Don't use sudo in a virtualenv — sudo pip install
installs packages into global site-packages
, not in virtualenv.
Either install pandas in the virtual environment (pip install
after activating venv) or enable access to the global packages (recreate venv with option --system-site-packages
or use command toggleglobalsitepackages
from virtualenvwrapper).
Answered By - phd Answer Checked By - Cary Denson (WPSolving Admin)