How to use easy install on Canopy Enthought? - python

I have installed the latest version of Enthought, I have the free express version. and I want to install the pyodbc package.
I have gathered that I need to use easy_install to install pip to install pyodbc.
However, I have no luck in using easy_install or even enpkg.
If I open enthought editor and type in:
enpkg pip
or
easy_install pip
all I am getting in return is syntax errors.
(I am very inexperienced with using external packaged that are not already installed into Enthought.)

What exactly are the syntax errors? I am guessing you are typing this into the python shell shown by the enthought editor?
What you need to do is open up a command shell. Are you on Windows? Try running cmd.exe - Canopy might even provide a special shell to use (with paths all set up for you) so check the start menu.
Then, you should be able to use easy_install and enpkg. You should see a prompt similar to:
C:\Users\Sameer\>
Type it at that prompt.
The python prompt looks like this:
>>>
You can't run enpkg or easy_install from there. Well... technically you can by shelling out, but first, try the above.

Related

visual studios cant find package i installed through pip

Visual Studio says I'm running Python 0.0 AND 3.10
Visual Studio is unable to find a package. I am able to run it in cmd using python.
I have had this problem before, but can't remember how I fixed it. I think I'm using the wrong version of python, but if that is the problem I don't know how to fix it.
Edit: using py -3.10 -m pip install package, instead of just pip install package seems to have worked.
Check the version in cmd and then if it is something above 3.7 or so you are good to go else reinstall python and if you are on Windows then check the box at bottom of the installation window of python which says "Add pip to path" something like that
Now in the VS Code
Hit Ctrl+Shift+p to open command palette and in that search for python interpreter and change it to plain one or you may choose
Select Python Interpreter
use the vscode console
First of all to check the packages insatalled in python you have to use the pip freeze.
pip freeze
This will help you to find out if the required package which you've installed is on the list or not.
If it is not present use the same console for:-
pip install <packageName>
for eg.
pip install django
then check the list agian

Should Which Pip and Which Python Return the Same Directory? Zeppelin Configuration On Unix RHEL

This is probably a really dumb question but I am stuck and wasting too much time on this so I would SO appreciate any help.
I am using a RHEL 7 box and installed Apache Zeppelin on it. Everything works except for the life of me I can't import Python packages such as Pandas.
I realized I didn't have PIP so I installed it with these steps: https://pip.pypa.io/en/stable/installing/ (notice I had to use the "--user" argument for the command "python get-pip.py").
Finally, I did "pip install pandas --user" which worked perfectly. I then go into my Zeppelin notebook and I cannot import pandas, even after restarting the Python interpreter.
I did some research and I think the problem is that "which python" and "which pip" are installed in different directories as the former results in "/usr/bin/python" while the latter in "~/.local/bin/pip".
So I suspect the packages installed with pip are basically getting loaded into a different version of python? If it helps, when I do "whereis python" I get 5 different results such as "/usr/bin/python" and "/usr/bin/python2.7" etc.
First thing to understand is: Python packages aren't installed globally, every installed Python has its own set of packages. BTW, pip being a Python package with a script is also not global. If you have a few different pythons you need different pips for them. I don't know Apache Zeppelin so I cannot guess if it uses the system Python (/usr/bin/python) or has its own Python; in the latter case you need to install pip specifically for Zeppelin so its pip install packages available for Zeppelin.
To investigate to what Python pip installs packages you need to find out under what python it runs. Start with shebang:
head -1 `which pip`
The command will prints something like ~/.local/bin/python. If it's not the version of Python you need to install packages for you need to install a different pip using that Python.
The most complex case would be if the shebang is PATH-dependent, something like #!/usr/bin/env python. In that case pip runs Python that you can find with which python.
PS. AFAIK the simplest way to install pip at RedHat is dnf install python-pip.
phd's answer was very helpful but I found that it was just a matter of using the root account to install the python packages. Then my Zeppelin was able to see any packages.

How do you install PyCallGraph / use pip?

and thanks to anyone who gives some of their time to consider my problem.
What I need help on is for someone to give me a simple and accessible explanation on how to install that module. I have never, ever used anything from PyPi before, I have only heard of pip after looking up PyCallGraph.
I'm not a programmer first, I'm doing an accounting internship and am using python to write scripts to help me speed up some processes, at the urging of a colleague who himself uses python. I write scripts using Notepad++ and execute them through IDLE.
I'm currently working on optimizing a script I wrote and came upon PyCallGraph while checking this very site on tips on how to do so.
I tried the very minimalistic instruction of just doing "pip install pycallgraph" just about anywhere I could think of, including cmd.exe, to no avail. Runing get-pip.py directly seems to have worked for installing pip, though.
Otherwise I can always just stick with the cProfile printout and write-off using modules needing such an install, although that saddly seems to be quite a few...
Step 1: Install PIP
Open terminal (cmd.exe, PowerShell, whatever)
Download get-pip.py and place it in the working directory of your terminal
Install PIP by invoking python get-pip.py
Confirm that PIP was installed correctly by invoking command pip (should display help if success)
If pip didn't work, make sure your PATH environment variable has been set up correctly. In typical Windows installations pip is installed under c:\Python27\Scripts. Make sure this folder is included in PATH.
Step 2: Install your library with PIP
Invoke pip install pycallgraph
PIP installs the library and it can be now used from Python

Installing a package to Canopy

I'm really new to coding, programming, Python, and just computers in general, so I need some help with Canopy. I've been having pretty consistent troubles installing any packages to Canopy; some stuff is in the internal package manager,but whenever it isn't, it's really confusing. I guess I'll list a specific installation.
I'm trying to install "pywcs" (link provided below) to my Win7 64-bit machine. I have Cygwin if that helps at all. I do not know how to go about this; the stuff I found online is pretty confusing, and Cygwin easy_install (filename) never seems to work. Any step-by-step solutions?
The way I installed astropy is as follows.
Open Windows Terminal
Change Directory to C:\Users\<USER NAME>\AppData\Local\Enthought\Canopy32\User\Scripts
Type easy_install.exe astropy
Wait until the download completes, and restart Enthought.
sometimes installing packages can be hard for enthought canopy . You could install all python packages using pip install mrjob command on the its own canopy command prompt
Go to tools tab on the canopy editor ,
Left click on the canopy command prompt ,
Finally pip install <package name> and hit Enter key
The key point is that in order to install a package into any Python distribution (including Canopy Python), you should use that Python to perform the installation. You refer to Cygwin's "easy_install", but you should instead use Canopy's easy_install.
As described in this article, the easiest way to be sure that you are running Canopy's Python (and Canopy's easy_install) is to have Canopy Python on your PATH. This is done by default during Canopy installation, but if you uncheck this option then, or if your Cygwin installation doesn't use your Windows PATH, then you will need to adjust your Cygwin PATH accordingly.
Doing as Sukrit suggests, and running the installation from the Canopy Python Scripts directory, is also a reasonable approach.
Alternatively, depending on its compiler dependencies, you may be able to install astropy from a Windows Command Prompt rather than from Cygwin (of course Canopy must be on the PATH here too, as it would be by default.)
In Linux you can do it as follows.
1) Make sure you are using the Canopy version of Python - check out https://support.enthought.com/entries/23389761-Installing-packages-into-Canopy-User-Python-from-the-command-line
2) At the command prompt use easy_install, for example:
$ easy_install pp==1.5.7
to install version 1.5.7 of pp
Just for information, Astropy is now included by default in Enthought Canopy:
https://www.enthought.com/products/canopy/package-index/

Difficulty running regetron in cmd

I want to follow the regex tutorial on http://regex.learncodethehardway.org/book/learn-regex-the-hard-waych1.html, but I am unsure how to execute regetron in cmd. I have followed the instructions to install it and the python interpreter does not give me an error when I type import regetron, so I know for certain it is installed.
Scripts usually get installed into the Scripts folder of your Python installation under Windows. Assuming you have Python 2.7 installed in the typical location, you should find a regetron executable in C:\Python27\Scripts.
FWIW, I typically put both C:\Python27 and C:\Python27\Scripts on my path under Windows for the above reason. Then commands introduced by packages are immediately available on the command line.
UPDATE: Regetron doesn't currently work for Windows. I've proposed a couple of patches to make it work. In the meantime, you can grab a new .zip from here and use pip to install it:
pip install .\regetron-1.4-windows.zip
UPDATE: My fixes have been incorporated into regetron. It should now work fine under Windows in a future version of regetron.
I used Cygwin to run regetron, and I did the following:
Install Cygwin, or update it if you already have it installed
Install Python when you pick your packages to install. Install wget,
too, because it'll make one of the steps below easier
wget http://python-distribute.org/distribute_setup.py
python distribute_setup.py
Use easy_install to install PIP. PIP is actively maintained, and supports package removal (unlike easy_install): easy_install pip
pip install regetron
Run regetron: regetron
Another word of caution: cmd.exe handles single-quoted (')and double-quoted strings (") differently than *nix shells. I've been burned when I've run Python scripts that take regex arguments (e.g. pywikipediabot) in cmd.exe. You can follow examples exactly, and the Wrong Thing will happen.
Cygwin doesn't have problems with ' and ".

Categories

Resources