PIP not working in Pythonxy? - python-2.7

I am using Pythonxy (have uninstalled all old instances of Python) and it has pip as a standard plugin as per the document page https://code.google.com/p/pythonxy/wiki/StandardPlugins
But when i use pip commands it fails. Can anybody kindly please figure out the mistake I am making?
P.S. Pip used to work well under Python before I moved to Pythonxy
Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Imported NumPy 1.8.0, SciPy 0.13.3, Matplotlib 1.3.1
+ guidata 1.6.1, guiqwt 2.3.1
Type "scientific" for more details.
>>> pip freeze
File "<stdin>", line 1
pip freeze
^
SyntaxError: invalid syntax
>>> pip install numpy
File "<stdin>", line 1
pip install numpy
^
SyntaxError: invalid syntax
>>>

PIP has never worked that way.
Use a command line i.e. BASH and not Python Interpreter.
Sure that
pip install numpy
is invalid Python statement. You can use mentioned command from your shell.

Related

Import error -- Python looking in wrong $PATH order

I'm trying to switch from Homebrew Python to Anaconda Python.
My $PATH is:
234:~ user$ echo $PATH
/Users/user/anaconda/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin
Also, when I check which python, which pip, and which conda I get the anaconda directory for all three. But I still get the following when I try to import some standard package (which is installed in the anaconda directory):
234:~ user$ python
Python 2.7.13 |Anaconda custom (x86_64)| (default, Dec 20 2016, 23:05:08)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
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 numpy
Traceback (most recent call last):
File "<'stdin>", line 1, in
File "/usr/local/lib/python2.7/site-packages/numpy/init.py", line 142, in <'module> ...
ImportError:
Importing the multiarray numpy extension module failed. Most likely you are trying to import a failed build of numpy. If you're working with a numpy git repo, try git clean -xdf (removes all files not under version control). Otherwise reinstall numpy.
I have tried a reboot and completely uninstalling anaconda and reinstalling, all to no avail. Why is python still using my usr/local/lib directory to hunt for packages? How do I redirect it to the anaconda directory?

How to visualize dask graphs?

I am following the official docs, however, getting the error during import.
F:\>python
Python 2.7.11 |Anaconda custom (64-bit)| (default, Feb 16 2016, 09:58:36)[MSC v.1500 64 bit (AMD64)] on win32
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
>>> from dask.dot import dot_graph
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Anaconda\lib\site-packages\dask\dot.py", line 11, in <module>
graphviz = import_required("graphviz", "Drawing dask graphs requires the "
File "C:\Anaconda\lib\site-packages\dask\utils.py", line 70, in import_required
raise RuntimeError(error_msg)
RuntimeError: Drawing dask graphs requires the `graphviz` python library and the `graphviz` system library to be installed.
>>>
I am running Anaconda and have installed graphviz.
C:\>conda install graphviz
Using Anaconda API: https://api.anaconda.org
Fetching package metadata .........
Solving package specifications: ..........
# All requested packages already installed.
# packages in environment at C:\Anaconda:
#
graphviz 2.38.0 2
I've got a directory C:\Anaconda\Library\bin\graphviz with the bunch of .exe, .dll and other files inside. There is also something in PATH variable:
F:\>where dot
C:\Anaconda\Library\bin\dot.bat
Here is the content of that file (C:\Anaconda\Library\bin\dot.bat):
#echo off
%~dp0.\graphviz\dot.exe %*
I have dask 0.11.0 installed:
F:\>conda list dask
# packages in environment at C:\Anaconda:
#
Using Anaconda API: https://api.anaconda.org
dask 0.11.0 py27_0
These errors appear both in Windows and in Linux (Ubuntu 16.04 with all recent updates).
What else does it require?
I'm not using Anaconda, but generaly if you wish to use graphviz you should:
Install the graphviz python module (probably with pip install graphviz).
Download and install the graphviz software.
To use the visualizing part of dask in anaconda, install both the graphviz and python-graphviz packages. Dask depends on a python interface to graphviz to do visualizations.
$ conda install graphviz python-graphviz

TensorFlow no attribute 'make_template'

I am trying to get familiar with tensorflow and NNs. I recently crashed into this problem when I tried to use tensorflow.make_template(). I first noticed that there were no auto-complete option in the IDE I use, and then I just tried to call the function from the python cmd:
$ python
Python 2.7.10 (default, Oct 14 2015, 16:09:02)
[GCC 5.2.1 20151010] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> tf.make_template()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'make_template'
>>>
I installed tensorflow from sources, and the protobuf version installed is:
$ git submodule status
55ad57a235c009d0414aed1781072adda0c89137 google/protobuf (v3.0.0-alpha-4-179-g55ad57a)
I haven't faced any similar behaviour with other tensorflow functions so far.
Any ideas about what's the issue causing this one?
As noted in the comments, this issue was due to a mismatch between the installed version of TensorFlow (0.5.0) and the downloaded source (0.6.0).
To upgrade to the latest development version of TensorFlow, follow the instructions to install from source, then build and install the PIP package based on that source.

Error in pyautogui

I use Python 2.7 on a windows 7. I use pycharm and IDLE. I was trying out pyautogui for some automatic mouse movements, but the program returned that puautogui as not defined. I have read online that pyautogui doesnot require any additional packages in windows.
I typed import pyautogui in IDLE and it turned up an error. Can u help ?
Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import pyautogui
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pyautogui
ImportError: No module named pyautogui
>>>
To install PyAutoGUI, install the pyautogui package from PyPI and dependencies.
On Windows for Python 2.7, this is:
C:\Python27\python.exe -m pip install pyautogui
it is saing that pyautogui couldn't be found b y the interpreter... are you sure you installed it....
if no.....
first type
pip uninstall PyautoGUI and then
please type pip install PyautoGUI in CMD or Powershell
for more information go to :
https://pypi.org/project/PyAutoGUI/

Error with 'import xlwt' and 'import xlrd' in Python 2.7 after installation with anaconda

I want to create xls and for that I installed xlwt and xlrd modules with easy_install xlwt.
But every installation, is related to C:\Anaconda and not to C:\python27. Maybe thats why:
Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import xlwt
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import xlwt
ImportError: No module named xlwt
>>>
How can I install in C:python27? Or isn't it the problem?
Anaconda is first on your PATH, so when you run easy_install it uses the one in the Anaconda directory. If you use the one in the C:\Python27 directory it will install it there.