Discrepancy in pandas version shown in python and anaconda - pandas

I am testing out Quantopian's zipline in a python 3.5.6 environment that I created with Anaconda. Per their documentation, pandas 0.22 is the recommended version, and for my own sanity, I'd like to stay with that version.
In conda, if I do
conda list | grep pandas
I get the following, as expected.
pandas 0.22.0 py35h0a44026_0
pandas-datareader 0.8.1 py_0
However, when I am in python, I get
Python 3.5.6 |Anaconda, Inc.| (default, Aug 26 2018, 16:30:03)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas as pd
>>> print (pd.__version__)
0.25.3
Why is it doing that? And how do I make sure that only pandas 0.22 is loaded into my python session?
Thank you for your help.

Related

error: Illegal instruction (core dumped) - tensorflow==2.1.0

I am importing tensorflow in my ubuntu (Lenovo 110-Ideapad laptop) python using following commands-
(tfx-test) chandni#mxnet:~/Chandni/TFX$ python
Python 3.6.9 (default, Nov 7 2019, 10:44:02)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Illegal instruction (core dumped)
And the program exits. Kindly let me know the reason.
You may need to downgrade to CPU 1.5.
#Try running
pip uninstall tensorflow
#And then
pip install tensorflow==1.5
Then import tensorflow and let me know if the error reoccur

Install PyQt5 on Python 3.7 (Linux)

I would like to install PyQt5 module on my Python3.7 version. I have read a lots of topics and forum to know how to do.
Basicly three ways exists, pip install, ap-get install or tar folder.
For me, the good way was apt-get install with this command :
sudo apt-get install python-pyqt5
python is my new version that I have updated on conf file to run on 3.7.
It say :
python-pyqt5 is already the newest version (5.7+dfsg-5)
But when I try to use it with :
python
Python 3.7.3 (default, Aug 2 2019, 09:14:49)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt5
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PyQt5'
>>>
However, when I run this command :
sudo apt-get install python3-pyqt5
python3
Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt5
>>>
It's good with Python3.5.3 but no for the newest version, I have use the same command to install on different version. And I don't know why the module doesn't import if the install command said me that I have been installed the PyQt5(5.7.1 version)

Jupyter notebook and QT Console are calling different version of pandas

QTConsole is running the latest version of pandas (i.e. 0.18). However, when I import pandas in Jupyter notebook, it can only import 0.15. How can I resolve this?
**QT Console:**
Jupyter QtConsole 4.2.0
Python 2.7.11 |Anaconda 4.0.0 (x86_64)| (default, Dec 6 2015, 18:57:58)
Type "copyright", "credits" or "license" for more information.
IPython 4.1.2 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
import pandas
print pandas.__version__
0.18.0
**Jupyter**
import pandas
print pandas.__version__
0.15.0
You probably have different versions of Python installed via different distributions. If you are using Windows, I recommend uninstalling all Python versions/distributions, rebooting and then only installing one.
If you are using Mac, ensure that you have only one version of Anaconda installed and that it is the version first in your PATH if you are using a terminal. It may be that a different version has been installed by for instance homebrew. To check your path do !echo $PATH from both of the environments. You should see your anaconda directory early in the path (before /usr/local/bin and /usr/bin). You can also do !which python from both of the environments to see which Python binary is being used.

Sklearn not compatible with numpy [duplicate]

When importing pandas I would get the following error:
Numpy.dtype has the wrong size, try recompiling
I am running Python 2.7.5, with Pandas 0.14.1, and Numpy 1.9.0. I have tried installing older versions of both using pip, with major errors every time. I am a beginner when it comes to Python so any help here would be much appreciated. :)
EDIT: running OS X 10.9.4
EDIT 2: here is a link to a video of me uninstalling and reinstalling Numpy + Pandas, and then running a .py file: https://www.dropbox.com/s/sx9l288jijokrar/numpy%20issue.mov?dl=0
I've seen this error before and it typically does have to do with pandas referencing an old version of numpy. But reinstalling may not help if your python path is still pointing to an old version of numpy.
When you install numpy via pip, pip will tell you where it was installed. Something like
pip install numpy==1.9.2
Requirement already satisfied (use --upgrade to upgrade): numpy==1.9.2 in /Library/Python/2.7/site-packages
Cleaning up...
So you have the correct version of numpy installed. But when you go into python
$ python
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.__file__
'/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/__init__.pyc'
>>> numpy.version.version
'1.8.0rc1'
Your path might be pointing at a different numpy.
Easiest solution I've found for this is simply to remove the unwanted version of numpy (moving it to a _bak folder for safety)
mv /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy_bak
And now when I start python
$ python
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.__file__
'/Library/Python/2.7/site-packages/numpy/__init__.pyc'
>>> numpy.version.version
'1.9.2'
I've got the version I want.
For more complex workflows where different applications might need different versions of various packages, virtualenvs are a great way to go http://docs.python-guide.org/en/latest/dev/virtualenvs/. But I think for your case where you just want pandas and numpy to play nice, this approach should work fine.
I got same error. I solved by deleting existing numpy and reinstall again.
pip uninstall numpy #it will remove older version of numpy on your computer
pip install numpy #it will install recent version of numpy
Actually I don't have any idea why it works. I just changed numpy version.
you should try to upgrade your numpy to latest. it worked for me.
pip install --upgrade numpy

Error importing pygtk with Anaconda

OS: Ubuntu 15.10
I had no problem importing pygtk with default Python interpreter. However I wasn't able to do so using the Anaconda interpreter.
Python 2.7.11 |Anaconda 2.5.0 (64-bit)| (default, Dec 6 2015, 18:08:32)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
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
>>> import pygtk
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pygtk
I also couldn't get it to work after installing the pygtk with conda.
/opt/anaconda2/pkgs$ conda info --env
Using Anaconda Cloud api site https://api.anaconda.org
# conda environments:
#
root * /opt/anaconda2
/opt/anaconda2/pkgs$ conda list -n root|grep pygtk
pygtk 2.16.0 1 ska
As you can see from the output that pygtk pkg is available under the root env.
Any ideas what I have missed or done incorrectly?
I've haven't had success with ska/pygtk, but mw/pygtk2 worked for me:
conda install -c https://conda.anaconda.org/mw pygtk2
Other details here