简体   繁体   中英

Import Module Error for Python-Pandas in Atom (works fine in CLI???)

Im new to Python and loving it. After a while coding console in Python core to get used to the syntax, I am now focusing on key plotting and analysis libraries of Pandas, Numpy, and Matplotlib. I expect to proceed with Scipy and PySpark in the near future. So far, Ive installed on my Mac OSX 10.11.3, Python 2.7.10, iPython, Matplotlib, Numpy and Pandas. I used

pip install Pandas --upgrade

to upgrade as follows: Successfully installed numpy-1.10.4 pandas-0.17.1 pytz-2015.7 six-1.10.0

I ran a project in python with:

import pandas as pd

import numpy as np

import matplotlib as plt

The project ran fine without errors in the CLI but return an error message when i ran it in Atom editor (it runs fine with numpy, matplotlib BUT not with pandas). The message is:

import pandas as pd
ImportError: No module named pandas

As pandas as pd import works fine form the CLI, can anyone advise on why Atom editor would not be able to find it especially when it can find Numpy as np and Matplotlib as plt noting all 3 library folders are in the same site-packages folder on my Mac? Also, if is there anyway to get Atom to point to the pandas folder in site-packages on Mac?

Update 6th Feb, 2016: I uninstalled pandas with pip uninstall pandas and reinstalled it to site-packages folder where numpy & matplotlib are. The reinstall was done through sudo easy_install pandas and once again, pandas module is not found in Atom using CMD+i but is accessed by Python VM through CLI running of the program and print pd.Series(x) for example works find and return series array of x. As numpy and matplot lib are recognised in autocomplete in Atom as packages and panadas is not, I can only assume the "input from console" features of pandas I have yet to discover is why Atom does not link to Pandas. Can someone with experience on Python-pandas and Atom comment please and set me straight? Much appreciated... I would like to fix Atom as I like it and would like to use the CMD+i function instead of the CLI every 2 mins... lol.. thanks for your help..

Update #2 6th Feb, 2016: Just to confirm, I have been working with DataFrames in Panda using the CLI and it works, it returns errors from Pandas error handling library proving I have Pandas and CLI allows it to work even though when I do CMD+i, it returns the no Pandas module message in Atom. Its either bad error handling by Atom or a bug not connecting with Pandas properly. Any thoughts on it are appreciated as I intend to work extensively with Pandas.

So, I have successfully used Pandas via the CLI now even though on Atom when I try to process the exact same .py file through Atom to check it, it gives: dataframes_trainer.py", line 1, in <module> import pandas as pd ImportError: No module named pandas [Finished in 0.062s] as an error message.

My thoughts on it conclude that Atom does not recognise Pandas as a Package. When typing Numpy onscreen in Atom, the autocomplete (intellisense) menu on screen recongises numpy and matplotlib but not pandas. It completes "Pandas" but does not have the package box icon beside like it does with the other two. A bug maybe? Pandas in the same .py file works find via CLI run so I guess I will move on with a solution rather then an explanation. Maybe the Atom team could look at Pandas and provide the same on editor integration as numpy and matplotlib? Just a thought...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM