0

I'm having issues with installing the panda library. I'm currently using snakemake with Python version 2.7 and 3.4 under LMDE. I've tried the following:

pip install pandas

which doesn't work, as I get the following error:

No module named 'pandas'

I figured it is because snakemake is based on python 3, and I tried solutions from this post. This one not working (I don't quite get the concept of virtualenv anyway):

apt-get install python-virtualenv virtualenvwrapper
mkvirtualenv -p python3 pandas_env
pip install pandas

Then I tried:

sudo apt-get install python3-pandas

It worked fine but then I got this error:

parser_f() got an unexpected keyword argument 'skip_blank_lines'

From this post it looks like a version problem, which should be > 0.15. Last command said it installed pandas 0.14, but when I checked here's what I got:

>>> import pandas as pd
>>> pd.__version__
'0.16.2'

I'm getting stuck here, between python versions and pandas versions I don't know what to do. Any help would be greatly appreciated.

Community
  • 1
  • 1
rioualen
  • 1
  • 4
  • `import os,pandas` and `print os.path.dirname(pandas.__file__)` @rioualen and delete question for duplicate ! – dsgdfg Aug 24 '15 at 11:04

2 Answers2

0

The point of virtualenv is to allow the same Python system to maintain multiple project environments independently of each other. Having created your virtual environment the pip install pandas command (which apparently worked) was all you needed - have you tried starting up Python and importing the module?

The sudo apt-get install python3-pandas command would attempt to install the Python 3 pandas module. It's rarely a good idea to mess with the system-installed Python (which is precisely why virtualenv is such a great idea).

If you pip uninstall pandas in your virtual environment you should be able to run pip install "pandas<16.0" to get an older version.

holdenweb
  • 33,305
  • 7
  • 57
  • 77
  • Thanks, it seemingly solved my previous problems, but now I get yet another error: `'module' object has no attribute 'DataFrame'` The error is rising in the following function: `def read_table(file:str, verbosity:int=0, header:int=0, skip_blank_lines=True, comment=';') -> pd.DataFrame: if verbosity >= 4: print ("read_table()\t" + file) df = pd.read_csv(file, sep="\t", header=header, skip_blank_lines=skip_blank_lines, comment=comment) return(df)` This code was written by a colleague and it should work... – rioualen Aug 25 '15 at 09:25
  • As you can see, it isn't easy to read large blocks of code in comments! The error message implies that you have imported a module with the name `pd`, but that module isn't `pandas`, which definitely DOES have a `DataFrame` attribute. – holdenweb Aug 25 '15 at 11:22
  • Hm, I'm starting to think the latter problem might be related to my input file, gonna investigate that... Thank you again. – rioualen Aug 25 '15 at 12:42
0

OK so it seems it makes a difference to install a python lib with pip whether I use sudo as myself or as root?...

I had done

$ sudo pip install pandas

Now I did

$ sudo pip uninstall pandas
$ su -
# pip install pandas

And now it seems to work perfectly fine! Is this normal though?

rioualen
  • 1
  • 4