I'm fairly new to programming. I'm trying to install biopython on mac os x 10.5.
This is what I did so far. 1. installed xcode 2. installed numpy 3. ran these commands in terminal python setup.py build python setup.py test
test reported back one fail.
test_Tutorial ... FAIL
ERROR: Run tutorial doctests.
Traceback (most recent call last): File "test_Tutorial.py", line 152, in test_doctests ValueError: 4 Tutorial doctests failed: test_from_line_05671, test_from_line_06030, test_from_line_06190, test_from_line_06479
Thanks for any help or advice.
That file test_Tutorial.py runs marked examples in the source for the main Biopython Tutorial and Cookbook ( http://biopython.org/DIST/docs/tutorial/Tutorial.html / http://biopython.org/DIST/docs/tutorial/Tutorial.pdf ) to check the examples work as expected. Internally this uses the same library as Python's doctest examples.
The fact that test_Tutorial.py failed is probably a harmless issue with a couple of examples.
Which version of Biopython are you using? If this was an official release that failure is unexpected. If it was a snapshot from the git repository then that is unfortunate. If you are curious, you could try this to see more information:
$ cd Tests
$ python test_Tutorial.py
This kind of issue might be more easily discussed on the Biopython mailing list http://biopython.org/wiki/Mailing_lists
I've found that the easiest way to set up a good programming environment is to use MacPorts, as it has a great way of ensuring that all dependencies are satisfied when installing things. You'll need to be familiar with Terminal and the command line, though.
Install MacPorts for OSX 10.5. Read the documentation too.
Restart.
Open Terminal.app and enter sudo port selfupdate to make sure the portfile definitions are up to date.
Run sudo port install py27-biopython to install the latest version of Python 2 (2.7.3), numpy, and biopython. This will take a while.
Run echo $PATH and make sure that /opt/local/bin and /opt/local/sbin` are at the beginning. They should be.
Run which python and ensure it returns /opt/local/bin/python. If it doesn't, run sudo port install python_select and follow its instructions to select your default python version.
Hopefully, at this point you can run python to enter the interactive interpreter, and import Bio won't give any errors.
Good luck!
Related
I am trying to install python through cygwin on a windows machine in order to make use of a statistical program that can only be implemented using python in a linux environment.
I have run setup-x86_64.exe and installed all python related cygwin packages in an attempt to install python, but when I open a terminal and type python I just get
$ python
-bash: python: command not found
which is the same for all python commands I try so clearly the installation has not occurred. However, I have found a path to Python-2.7.9 which appears to contain the files required to build python from source.
When I run ./configure it is successful, but when I then input make it fails due to:
File "build/temp.cygwin-1.7.35-x86_64-2.7/libffi/fficonfig.py", line 33, in <module>
ffi_sources += ffi_platforms['X86_WIN64']
KeyError: 'X86_WIN64'
Makefile:488: recipe for target 'sharedmods' failed
make: *** [sharedmods] Error 1
Anyone know why make won't work?
The options in ./configure --help are unfamiliar to me, could any of these options allow for successful installation?
Any ideas would be greatly appreciated, thank you.
Cygwin comes with an installer, called setup.exe or setup-x86_64.exe. Just run it and type python to the search box. Then let it install it for you.
python language interpreter is the basic package you need.
So, this question is 3 years old, but this error still happens with most recent versions of Python 2 (tested with 2.7.13 and 2.7.15)
I was able to get python to build by modifying the following file in the build directory.
--- build/temp.cygwin-2.11.1-x86_64-2.7/libffi/fficonfig.py~ 2018-11-03 14:51:53.290000000 -0400
+++ build/temp.cygwin-2.11.1-x86_64-2.7/libffi/fficonfig.py 2018-11-03 14:53:41.793000000 -0400
## -9,6 +9,7 ##
'X86': ['src/x86/ffi.c', 'src/x86/sysv.S', 'src/x86/win32.S'],
'X86_FREEBSD': ['src/x86/ffi.c', 'src/x86/freebsd.S'],
'X86_WIN32': ['src/x86/ffi.c', 'src/x86/win32.S'],
+ 'X86_WIN64': ['src/x86/ffi.c', 'src/x86/win64.S'],
'SPARC': ['src/sparc/ffi.c', 'src/sparc/v8.S', 'src/sparc/v9.S'],
'ALPHA': ['src/alpha/ffi.c', 'src/alpha/osf.S'],
'IA64': ['src/ia64/ffi.c', 'src/ia64/unix.S'],
The source files, in particular src/x86/win64.S, are present in the source tree. For some reason, ./configure does not seem to be properly adding the option to the dictionary in the fficonfig.py file, which causes the KeyError posted in the question. After making this modification, make and make install completed successfully and I was able to install an alternate version of python in addition to the normal Cygwin package.
I'm not yet sure why this happens, but I thought I would attempt to provide a solution to the question actually asked rather than just telling the asker to install a pre-compiled version using the package manager.
Since building Python from source was said to be a bad idea, I assumed my Cygwin was broken. I attempted to uninstall Cygwin following the instructions on the Cygwin website, but I was unable to remove it due to permission difficulties (I use a university-supplied Windows machine). My last resort was to run the Cygwin installation wizard setup-x86_64.exe and uninstall all packages, then run the wizard once more and select the necessary packages again as if starting from new. Miraculously, installing the required packages from scratch solved the problem and I am now running Python through my Cygwin terminal with no errors.
If you want to run Python on Cygwin, you might need to build it from source.
download the source
unpack it to the directory you could delete later, eg: build
run Cygwin, type: cd /path/to/build
run ./configure --help and read the help about the options you'll need
./configure #options
make
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'm trying to install Trac manually for the first time. I don't want to use a one-click-installer like Bitmani, I want to learn how to install Trac manually, so I'm following the instructions carefully. I'm installing it in a Windows localhost for now, before installing it in a Linux environment.
As I follow the instructions carefully, I needed to install Python+MySQLDb, and I read this:
thread-safety is important
(...) verify that it is thread-safe by calling MySQLdb.thread_safe() from a standalone Python script (i.e., not under Apache). If the stand-alone test reports that MySQLdb is indeed thread-safe (...)
I've just installed MySQLDb 1.2.4 and I'd like to verify this. I've Googled but I haven't found an example about this, and I have no idea about Python. How can I verify if I've got a thread-safe installation?
Run this command. If you get 1 in the output, your installation is threadsafe.
python -c "import MySQLdb ; print MySQLdb.thread_safe()"
I'm trying to install vim and nvim as a replacement for Notational Velocity. I recently migrated to Ubuntu (14.04) and I'm very new to how everything works. The instructions for installing nvim are kind of elliptic and not entirely clear to me as a beginner. I manage to get it running if I enter vim and then type :Nvim inside the directory where I store my .txt notes. However, the notes aren't visible in nvim and here's where I run into trouble. As a beginner I simply do not understand the instructions regarding PATH and :python that are given on the installation page. I've tried (successfully, I think) to install xapian as well (after having installed vim) but nothing changed. That is, I cannot specify a PATH for my nvim and I cannot get the nvim script to work as a command anywhere in the terminal.
More consequentially, when I type
:python nvimdb.rebuild_database()
inside vim, I get:
Traceback (most recent call last):
File "", line 1, in
NameError: name 'nvimdb' is not defined
What I would like to ask for are step by step instructions for making nvim work with an existing library of .txt notes targeted at the vim and linux novice.
The program looks great and appears to be exactly what I need for my note taking needs, and I would really appreciate your help! Thank you so much.
I believe this is probably because you haven't installed the xapian library as that is a required mentioned by nvim. You need to install the package xapian-core I believe, you can do that in ubuntu with something like this : sudo apt-get install xapian-core
I'm currently trying to learn Python and am going through How to Think Like a Computer Scientist: Learning With Python. I have installed Python 2.6.2 on Mac OSX 10.4.11 and am using the IDLE.
At the end of chapter 4 Elkner et al. refer to GASP. However their instructions don't work as when I enter:
>>> from gasp import*
I get:
Traceback (most recent call last):
File "<pyshell#17>", line 1, in <module>
from gasp import*
ImportError: No module named gasp
I've had a look around on google and can only find outdated methods of installation or pages of gobbledegook. I believe I have to install PyObjC first and haven't been able to accomplish this either.
Can anyone please help me out with some plain English instructions?
Well everybody, sorry for the incomplete sentences and overall poor English but I wanted to make this simple to read and understand for someone who is completely inexperienced in any sort of programming, as I am (very first day messing with this stuff, e.g., terminal). This is the result of hours of Googling that was all done in one day. Perhaps someone who is familiar with the commands below (in bold) wouldn’t mind explaining what exactly is taking place. Additionally, this was all done in terminal on a MacBook Pro running Mac OS Lion.
Install macport binary (comes with installer; easy)
sudo port install py-game
not sure if this is necessary, as it doesn’t appear to cause pygame to be functional for python version 2.7.1 (stock python on lion)
sudo port select --set python python 2.7
I believe this set the default python version to 2.7.2 which I also believe was
downloaded during step 2 (therefore why I think this ends up being a necessary step)
Download setuptools-0.6c11-py2.7.tar
In folder gasp-0.3.4, which appears after clicking on the .tar, place setup.py in the
gasp folder
sudo python gasp/setup.py install
make sure your directory is the folder gasp-0.3.4
sudo port –v install py27-pygtk
takes about an hour for this step to complete
sudo port uninstall py-game
this step is not necessary for gasp to work; I simply didn’t want any unnecessary
stuff on my computer that was downloaded during the second step; however, this step
put python 2.7.2 on my computer; could install 2.7.2 separately I guess but this way
worked for me; a lot of other unnecessary stuff is installed during this step too but
I think it’ll remain even after this command, oh well
This is actually somewhat of a coincidence; I'm one of the packagers of GASP. On our download page, which is linked by our main project page, there are instructions on how to install it on most major platforms. Hadn't considered OSX, however. Will write something up shortly.
Essentially, install the Official Python from the PSF. Then add MacPorts and run
sudo ports install py-game
Extract the source tarball from the download page linked above to your site-packages directory.
There are also some alternative instructions I found that might work better, as I have not tested the above.
This is an interesting problem faced by most of the readers using "How to Think Like a Computer Scientist : Learning with Python", when they reach 4th chapter.
Now to install GASP, you need to check whether you have python installed on your machine.
Assumption: I am going to assume that you are using Mac.
Type the following command on your terminal,
`$ python -V`
{If your system has python installed on it, you will get an answer like Python 2.7.1 ( if the version is 2.7.1).}
Once you have python available on your system, you should install PyObjC.
An easy way out is to type on to your terminal prompt,
`$ easy_install pyobjc==2.2`
{this will install the version 2.2}
Next step is to install pygame package , you can do this in two ways either by downloading the .dmg file or using "homebrew". I prefer the second method.
to install pygame package using "brew" you have to install mercurial first. It's a simple procedure, just type in
$ brew install mercurial
Then type in the following commands,
$ brew install sdl sdl_image sdl_mixer sdl_ttf smpeg portmidi
$ sudo pip install hg+http://bitbucket.org/pygame/pygame
Next step is to install GASP. Download gasp from https://launchpad.net/gasp-core/+download
Extract the .tar file, you will get a folder structure. Our aim is to copy the folder named "gasp" to the Systems Library folder. To check which folder or version of python is used and to know their correct path type in the following command on terminal.
$ python -c 'import sys, pprint; pprint.pprint(sys.path)'
generally it will print a path similar to '/Library/Python/2.7/site-packages' , you can notice this either as the last line or the second last line of the output that above commands generate.
Copy the gasp folder to the site-packages folder,
$ sudo cp -R ~/Desktop/python-gasp-0.1.1/gasp/ /Library/Python/2.7/site-packages/gasp
This should copy all the required files to the location specified as the second argument.
Now go to terminal and type
$ python
>>> import gasp
If everything goes fine, you will not get any error or any messages.
PS: Ensure that in your site-packages directory there are no duplicate copies of pygame/gasp. In case of duplicates, it may throw lots of tantrums. Also, if any of the steps go wrong you may get error "import cairo" some 25th or 26th line on base.py in gasp package.In that event, please clean up your site packages directory by removing pygame and gasp and re-install them, that should solve it.
Also while installing mercurial you may get some warning related to Certificates. You can solve them by typing in following commands,
$ openssl req -new -x509 -extensions v3_ca -keyout /dev/null -out dummycert.pem -days 3650
$ sudo cp dummycert.pem /etc/hg-dummy-cert.pem
$ cd ~
$ nano .hgrc
{ This will open up an empty .hgrc file }
Type in the following
[web]
cacerts = /etc/hg-dummy-cert.pem
save the above 2 lines by pressing ctrl+ o
exit nano by pressing ctrl + x
Thats it. This should solve your problems with GASP installation and enjoy the book " How to Think Like a Computer Scientist" it's a wonderful introduction to the world of computing.