I'm trying to install the pyMySQL module for python so that I can setup Django (see this previous question).
I can't get easy_install.exe PyMySQL-0.3-py2.6.egg to run for the life of me. Every time I get the error easy_install.exe not recognized as an internal or external command... I've tried adding various directories to my system path including:
C:\Python27\Lib\site-packages\;
C:\Python27\Scripts\;
C:\Python27\Scripts\easy_install.exe
C:\Python27\Scripts\easy_install.exe PyMySQL-0.3-py2.6.egg
What am I missing that is keeping this from executing?(note I'm on windows 7)
You have to install setuptools first
[edit]
Uh,
C:\Users\Robus>easy_install
Yada yada, not found
C:\Python26\Scripts>easy_install
error: No urls, filenames, or requirements specified (see --help)
C:\Python26>
The next best thing I can think of is - do you, by any chance, have more than one version of python installed? In that case setuptools might have been installed somewhere else
Related
Okay, so, I'm actually a beginner in programming Python, and I only found out yesterday how you were supposed to encode pip install ModuleName in the Python command line and not in the interactive shell. I'm trying to download a lot of modules, such as the Send2Trash module, Pyperclip, Requests, Beautiful Soup, and Selenium.
Before I checked the forums about installing modules, I found out how we needed to have the pip tool. I'm a Windows user, but for some reason, I didn't have the 'Scripts' folder installed when I downloaded Python. I didn't know we needed it, so I used raw scripts from GitHub, setup.py, and copy pasted the script into the File Editor in Python, ran it in the interactive shell, and tried to import the module I needed. It worked for the Pyperclip and the Requests module; no errors popped up after I imported them using import pyperclip or import requests, but when I tried the same procedure for the rest of the modules I needed, there were some errors.
Also, when I tried to download the modules on pypi.python.org, I tried to open it using the interactive shell, but then something pops up, 'The file's encoding is invalid for Python3.x...', and when I click 'OK', it's going to say 'Failed to Decode', and close everything.
So, after reading forum after forum, I found out how to download pip, and was also able to download setuptools and wheel. I'm not sure if it's really already downloaded, but I was able to get the 'Scripts' folder that wasn't there before, so I guess so. I also already went into my PATH using the edit environment for your account thing, and I edited the Path variable so its value would lead to my 'Scripts' folder. Please do tell me if I did the right thing here.
So, following the advice of the forums, I tried to install the modules I needed by typing pip install ModuleName in the Python command line instead of the interactive shell, but it still gave me a Syntax Error. I also tried it in Command Prompt, typing the same code pip install ModuleName, but when I clicked Enter, nothing happens; no errors or anything. It seemed like my install was accepted, but when I tried importing the module in the interactive shell, it still gave an Import Error.
Please tell me what I did wrong throughout my process, and how to properly install the modules I need. I would include pictures into this, but it seems I can only add two before my reputation becomes 10, and I'm pretty new here, so... If there's anything I need to elaborate on about my problem, don't hesitate to ask, and I'll try my best.
You say you use windows so you need to understand pip.
pip is a program that installs python modules. You can even use easy_install instead of pip.
some pip commands
pip list -- lists out already installed modules.
pip search <module name> -- searches new modules.
pip -h -- more pip commands you want.
pip installs modules from CMD prompt not from python shell.
Even after installing modules some modules doesn't run as import module
they need to be imported as from module import function.
refer the pip help command and install modules.
DO NOT SAVE SCRIPT FILES IN PYTHON ROOT FOLDER YOU MAY FACE SOME PROBLEMS
Happy Programming!!!
After a whole lot of searching and trying out, I found the solution to my problem. For future Python users who encounter the same thing: always install your modules in the root folder.
In my case, my Command Prompt was automatically inside the C:\Users folder, which caused some problems because I couldn't download my module in there. Once I typed in cd C:\Python34, which was my root folder, I could successfully download the modules I needed using pip install ModuleName.
I am trying to install Jedi for emacs using marmalade package manager by following instructions here -- http://tkf.github.io/emacs-jedi/latest/. The package manger installs Jedi along with its dependencies. But I cannot install python server using:
M-x jedi:install-server
because that command is not available even after restarting emacs after jedi installation. The only available commands are:
Possible completions are:
jedi:ac-setup jedi:complete
jedi:dot-complete jedi:get-in-function-call
jedi:goto-definition jedi:goto-definition-next
jedi:goto-definition-pop-marker jedi:setup
jedi:show-doc jedi:show-jedi-version
jedi:start-dedicated-server jedi:stop-server
jedi:toggle-debug-server
My .emacs has the following:
(autoload 'jedi:setup "jedi" nil t)
(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:complete-on-dot t)
I am using emacs on Mac OS X.
At this current state when I open any python file (I use python 2.7), I see the following appear automatically in the minibuffer:
deferred error : (error Server may raise an error : Traceback (most recent call last):
File "/Users/t_nithyanandan/.emacs.d/elpa/jedi-0.1.2/jediepcserver.py", line 302, in <module>
main()
File "/Users/t_nithyanandan/.emacs.d/elpa/jedi-0.1.2/jediepcserver.py", line 298, in main
jedi_epc_server(**vars(ns))
File "/Users/t_nithyanandan/.emacs.d/elpa/jedi-0.1.2/jediepcserver.py", line 210, in jedi_epc_server
import_jedi()
File "/Users/t_nithyanandan/.emacs.d/elpa/jedi-0.1.2/jediepcserver.py", line 249, in import_jedi
import jedi
ImportError: No module named jedi
)
I tried installing jedi using other methods such as el-get and also manually but those seem to not even go this far. I see that the jedi commands available are even lesser than listed above.
Could someone help point out what I am missing?
Thanks.
Edit: The primary purpose I would like to use Jedi is to use auto-completion features for python programming although I believe Jedi has many powerful features. For such a purpose, is the python server essential or could one work around it? Eventually, of course, I'd like to take advantage of many more features in Jedi.
I managed to fix the problem thanks to help from Chris and syohex from emacs-jedi github. Credit goes to them in tracing this to Jedi version.
I am just linking the discussion on emacs-jedi issue #177 and pasting the workaround I found including other problems I encountered along the way.
I was using the Marmalade version which installs a much older version. So I uninstalled jedi and associated dependencies. I set my repository to MELPA and installed a much more recent version of jedi. This made the command
M-x jedi:install-server
available which wasn't the case earlier.
However, issuing that command gave an error
python-environment--make-with-runner: Program named "virtualenv" does not exist.
I made sure I added the location of virtualenv to PATH in my .bashrc.
So I looked up emacs-jedi issue #158 which suggests installing exec-path-from-shell. I installed it from MELPA and added the lines
(when (memq window-system '(mac ns))
(exec-path-from-shell-initialize))
following instructions.
Restarting Emacs with the above lines gave an error:
Symbol's function definition is void: exec-path-from-shell-initialize
So I looked up Autoload issue #3 under exec-path-from-shell development (the link to this can be found in the link for emacs-jedi issue #177). Following one of the solutions, I restarted my computer, uninstalled and reinstalled exec-path-from-shell which magically did solve the problem that existed before the reboot.
Now I checked in emacs if virtualenv could be found using
M-! which virtualenv
It gave the right location.
Then I ran:
M-x jedi:install-server
which now seemed to run without trouble. The first time, there were messages about setting up a
default virtual environment under
/Users/XXX/.emacs.d/.python-environments
besides
Running: pip install --upgrade /Users/XXX/.emacs.d/elpa/jedi-20140321.1323/...Done
but in subsequent trials only the pip upgrade message was displayed.
Having seen that the server installed without trouble, I closed and restarted Emacs and opened a python script file. When I started editing, I got these messages in the minibuffers:
Error (jedi): Failed to start Jedi EPC server.
*** You may need to run "M-x jedi:install-server". ***
This could solve the problem especially if you haven't run the command yet
since Jedi.el installation or update and if the server complains about
Python module imports.
and
auto-complete error: (error Server may raise an error. Use "M-x epc:pop-to-last-server-process-buffer RET" to see full traceback:
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file '/Users/XXX/.emacs.d/elpa/jedi-0.1.2/jediepcserver.py': [Errno 2] No such file or directory`
)
Thus, I realized that I have to issue the command:
M-x jedi:install-server
every time I start Emacs before opening any python file. Then I was finally able to see the auto-completion features being available during editing.
Though I can run the above command every time manually, I wanted to automate it from my .emacs whenever Emacs is launched. It turned out that I had the following line in my .emacs
(setq jedi:server-command (list "python" "/Users/XXX/.emacs.d/elpa/jedi-0.1.2/jediepcserver.py"))
Upon removing this line in my .emacs, the problem went away and jedi is functional now.
Marmalade currently contains jedi version 0.1.2, but you're looking at documentation for version 0.2.0alpha2.
The documentation for 0.1.2 has different instructions:
package.el (Marmalade or MELPA)
You can install Jedi.el using package.el interface from Marmalade or MELPA. As package.el does not support installing non-elisp packages, you need to install Python part manually (see the next section).
And then in that next section, the imporant bit:
Install Jedi and python-epc by
make requirements (no need for root privileges) or
pip install -r requirements.txt if you want to determine where to install Python modules. You need root privileges (i.e., sudo) to install it in system directory.
You should be able to do make requirements from the ~/.emacs.d/elpa/jedi-0.1.2/ directory, but something like pip install epc jedi should work too.
I am trying to install wck. But I ran into the following error when running setup.py :
fatal error : tk.h : no such file or directory
But I already have all the -dev packages installed! I went on and installed tk-dev, tk8.5-dev and tk8.4-dev and the problem persists. I did a 'locate tk.h' and there was no tk.h anywhere in my system. Wherever this problem was reported, people were trying to get tcl.h too. So I did a sudo apt-get install tcl-dev and did a 'locate tcl.h'. Nothing! Where did all the header files go?
Your problem is, that WCKs setup.py and setuplib.py don't have a clue where to look with the layout on your system, so you will have to fix those to get it working.
I assume your using some variant of Debian Linux there, so maybe have a look at their guidelines for packaging Tcl/Tk.
Basically they recommend adding configure switches like:
--with-tcl=/usr/lib/tclX.Y
--with-tk=/usr/lib/tkX.Y
--with-tclincludes=/usr/include/tclX.Y
http://pkg-tcltk.alioth.debian.org/tcltk-policy.html/ap-debian_oddities.html
http://pkg-tcltk.alioth.debian.org/tcltk-policy.html/ch-tcltk.html
With that info, you might be able to get it to work by editing setup.py and simply adding a version of find_tk() that works for your system.
I would like to use scheduler in my python program however I haven't been able to install it.
I tried with Easy_Install and PIP (neither of which I've used before) and I can't find a link for another method. I'm using Python 2.7 on Windows Vista
Since I've never used PIP before I had to install that first. After installing pip I went to command prompt, changed to the directory with pip and typed:
C:\Python27\Scripts>pip install apscheduler
It didn't come up with an error so I assumed it installed, however when I run my python program, which includes the line: from apscheduler.scheduler import Scheduler
it states:
ImportError: No module named apscheduler.scheduler
and when I look at the list of installed modules in Idle it's not there.
It's probably something obvious since I don't have a lot of experience in programming yet.
Help would be much appreciated!
sm
Hi again,
I got it working finally, in the end I didn't use PIP, in case other people need help this is what I did:
Downloaded the apscheduler tar.gz file
Downloaded 7-zip, since this can extract tar.gz files on Windows.
Extracted the tar.gz file using 7-zip, I had to do this twice since the first time I clicked extract it extracted to a .tar file (APScheduler-2.1.2.tar), it was necessary to extract this file as well.
Added C:python27\ to the windows path (this is in control panel->system & maintenance->system->advanced system settings->environment variables)
(I also added C:python27\scripts\ to the path, but not sure whether this makes a difference.
Opened command prompt and moved to the folder containing the extracted APScheduler files including the file named setup.py
In my case this was- C:\Python27\APScheduler\APScheduler-2.1.2\APScheduler-2.1.2\
In command prompt typed> python setup.py install
Hopefully this was everything, perhaps one day I'll delete everything and try again to check, but it took quite sometime to get it going so right now I think I'll leave it as is.
Upon trying to start a Pinax app, I receive the following error:
Error: No module named notification
Below are the steps I took
svn co http://svn.pinaxproject.com/pinax/trunk/ pinax
cd pinax/pinax/projects/basic_project
./manage.py syncdb
Any suggestions?
UPDATE:
Turns out there are some bugs in the SVN version. Downloading the latest release solved my problem. If any one has any other suggestions on getting the trunk working, they would still be appreciated.
I'd avoid the svn version all together. It's unmaintained and out of date. Instead, use the git version at http://github.com/pinax/pinax or (even better) the recently release 0.7b3 downloadable from http://pinaxproject.com
Two thoughts:
1. Check all of your imports to make sure that notification is getting into the namespace.
2. You may be missing quotes around an import path (eg. in your urls.py: (r'^test', 'mysite.notification') -- sometimes I forget the quotes around the view)
Try following the latest install instructions here:
http://github.com/pinax/pinax/blob/600d6c5ca0b45814bdc73b1264d28bb66c661ac8/INSTALL
Don't think this will work on Windows (maybe if you are using cygwin) as they are using virtualenv and pip.
Note the version has recently been upgraded to 0.7rc1
IIRC I had to add a directory or two to the Python path last time I did a fresh install of Pinax. I'm doing a fresh checkout now into a new virtualenv, I'll edit this answer if I hit any snags.