Unable to install CherryPy - python

I know this is a very dumb question, but I can't install CherryPy. In the documentation is written:
To install, change to the directory where setup.py is located and type (python-2.3 or later needed):
python setup.py install
Which is what I do, I type this in Python Shell and it gives me error Invalid syntax, but I don't think I have any syntax errors.

You won't install programs in the Python shell. Navigate to where you downloaded the source and run python setup.py install.
Alternatively, you can use pip:
pip install cherrypy

The best installation for Cherrypy, Mako, Python with terminal in Ubuntu is:
sudo apt-get install subversion python-mako python-simplejson python-cherrypy3 graphviz
And after sudo apt-get update and after sudo apt-get upgrade

"I type this in Python Shell"...
Don't type that in the Python shell.
>>> python setup.py install
File "<stdin>", line 1
python setup.py install
^
SyntaxError: invalid syntax
Type it at the commandline.
$ python setup.py install
Or if you're on Windows:
C:\>python setup.py install

I have found out the steps to install via command prompt, please fer to the attachment below. For me "python setup.py install" does not work but it works find for "setup.py install" after I pointed it properly to the directory>
Hope my experiment helps:
Step1
Step2

If you are installing on Mac and say you are using python 3, you would want to use:
sudo python3.3 setup.py build
Then after build is finished.
sudo python3.3 setup.py install

Related

Install Package in Python

I'm trying to install bayespy on enthought canopy and have read through all the documentation and cannot figure it out. I import pip and then run the following code (I have tried many variations on this too) :
pip install <bayespy>
It keeps coming back with an error message. Do I need to specify the file path to bayespy possibly?
Thanks in advance,
Max
Edit :
pip install <bayespy>
File "<ipython-input-2-bb1febf67aaf>", line 1
pip install <bayespy>
^
SyntaxError: invalid syntax
The most basic usage of "pip" is as a command-line tool. Try this from the command prompt (NOT within a Python shell):
pip install bayespy
or perhaps
sudo pip install bayespy
First: BayesPy requires Python 3.
Try This:
yourMachine> sudo pip3 install bayespy
Not this at python prompt: >>> sudo pip3 install bayespy

Biopython not able to work in UNIX Ubuntu or Mac OS

I am currently struggling to be able to import the Bio module in a python script which is in a different directory.
The error I keep receiving is as follow:
from Bio import SeqIO
ImportError: No module named 'Bio'
I have tried reinstalling Biopython, rebuilding it and also changing the paths (as all recommended on Stackoverflow, but still I get this error message.
I built Biopython according to the pypi.python.org site instructions:
python setup.py build
python setup.py test
sudo python setup.py install
I am still quite new to how Python and BioPython works. Is there a possible solution to this?
What worked for me was:
First uninstall all trace of biopython
In the terminal:
pip uninstall biopython
pip3 uninstall biopython
pip3.X uninstall biopython
Note: If you have python3.7 is pip3.7, python3.7.6 will still be pip3.7
Then see which python do you use, in the terminal:
which python
which python3
Then, the main process is:
dowload manually biopython-1.74.tar.gz 16Mb – Source Tarball from https://biopython.org/wiki/Download
decompress/unzip/tar biopython-1.74.tar.gz
in the terminal change directory to biopython-1.74 and:
python setup.py build
python setup.py test
sudo python setup.py install
or
python3 setup.py build
python3 setup.py test
sudo ython3 setup.py install
or
python3.X setup.py build
python3.X setup.py test
sudo python3.X setup.py install
DONE! https://pypi.org/project/biopython/

Having trouble installing PyAudio for Python3 on Mint

I was following the instructions here and I'm having trouble getting the installation to work. Basically, the first part works fine. I downloaded portaudio, followed the instructions, and it all seemed to work.
However, when I triedpython3 setup.py install, I got an error. The error came from the /src/_portaudiomodule.c file, and it said that "The file Python.h could not be found". I don't really understand what's going on because there was no Python.h file when I extracted the PyAudio archive. I don't know where the Python.h file was supposed to come from.
I'm kind of a noob to unix systems so I could have easily made a mistake somewhere. I've been trying to solve this for hours and I've had no luck so far. Thanks in advance for your help!
To install the latest version of pyaudio using conda:
source activate -your environment name-
pip install pyaudio
You may run into the following error when installing from pip:
src/_portaudiomodule.c:29:23: fatal error: portaudio.h: No such file or directory
#include "portaudio.h"
compilation terminated.
error: command 'gcc' failed with exit status 1
That is because you don't have the PortAudio development package installed. Install it with:
sudo apt-get install portaudio19-dev
You don't need to compile pyaudio. To install PyAudio, run:
$ sudo add-apt-repository universe
$ sudo apt-get install python-pyaudio python3-pyaudio
The first command enables Universe Ubuntu repository.
If you want to compile it e.g., to use the latest version from git; install build dependencies:
$ sudo apt-get build-dep python-pyaudio python3-pyaudio
After that, you could install it from sources using pip:
$ python3 -mpip install pyaudio
Or to install the current version from git:
$ pip install -e git+http://people.csail.mit.edu/hubert/git/pyaudio.git#egg=pyaudio
Run pip commands inside a virtualenv or add --user command-line option, to avoid modifying the global python3 installation (leave it to the package manager).
I've tested it on Ubuntu. Let me know if it fails on Mint.
I have found the work arround for mac.
please refer the below steps to install pyaudio on python 3.5
Follow these steps :
export HOMEBREW_NO_ENV_FILTERING=1
xcode-select --install
brew update
brew upgrade
brew install portaudio
pip install pyaudio
I was able to get it install with anaconda, using this package.
Follow install instructions for linux here, then do:
conda install -c bokeh pyaudio=0.2.7
try to install using the the below command
pip install pyaudio
after that install the required Microsoft Visual C++ 14.0
refer the below image for the same.
and restart the system and run the same command again
pip install pyaudio
Python.h is nothing but a header file. It is used by gcc to build applications. You need to install a package called python-dev. This package includes header files, a static library and development tools for building Python modules, extending the Python interpreter or embedding Python in applications. To install this package, enter:
sudo apt-get install python3-dev

Installing netaddr on Python27

I'm following the installation instructions to install netaddr (https://pythonhosted.org/netaddr/installation.html) and unsure as to how to complete the installation.
I have downloaded Python 27, and the netaddr-0.7.10.zip file from https://github.com/drkjam/netaddr/downloads and extracted the file to C:\temp\netaddr-0.7.10.
I am then instructed to:
Run the setup file in the root directory like this:
python setup.py install
Can someone please help explain this in a bit more detail for me i.e do I use cmd or python to run the command and do I need to navigate to a particular directory, again how would I navigate to "root" directory?
Sorry I am not used to installing software like this!
Thanks.
You should consider using 'pip'
https://pypi.python.org/pypi/pip
Then the install becomes as simple as running pip install netaddr from the command line.
or from a debian distro like ubuntu:
apt install python-netaddr
On windows machine/Cygwin:
python -m pip install netaddr
upgrading pip:
python -m pip install --upgrade pip

Ubuntu Python "No module named paramiko"

So I'm trying to use Paramiko on Ubuntu with Python 2.7, but import paramiko causes this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named paramiko
The other questions on this site don't help me since I'm new to Ubuntu.
Here are some important commands that I ran to check stuff:
sudo pip install paramiko
pip install paramiko
sudo apt-get install python-paramiko
Paramiko did "install". These are the only commands I used to "install" paramiko. I'm new to Ubuntu, so if I need to run more commands, lay them on me.
which python
/usr/local/bin/python
python -c "from pprint import pprint; import sys; pprint(sys.path);"
['',
'/usr/local/lib/python27.zip',
'/usr/local/lib/python2.7',
'/usr/local/lib/python2.7/plat-linux2',
'/usr/local/lib/python2.7/lib-tk',
'/usr/local/lib/python2.7/lib-old',
'/usr/local/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/site-packages']
In the python interpreter, I ran help("modules") and Paramiko is not in the list.
two paramiko folders are located in usr/local/lib/python2.7/dist-packages.
Short version: You're mixing Ubuntu's packaged version of Python (/usr/bin/python) and a locally built and installed version (/usr/local/bin/python).
Long version:
You used apt-get install python-paramiko to install Ubuntu's official Paramiko package to /usr/lib/python2.7/dist-packages.
You used (I assume) Ubuntu's version of pip, which installs to /usr/local/lib/python2.7/dist-packages. (See here.)
You used a locally built version of Python, and because it's locally built, it uses /usr/local/lib/python2.7 instead of /usr/lib/python2.7, and because it doesn't have Debian/Ubuntu customizations, it doesn't check use dist-packages.
Solution: You should be able to add /usr/local/lib/python2.7/dist-packages to your /usr/local/bin/python's sys.path, but since you're using Ubuntu, it's easiest to let Ubuntu do the work for you:
Use /usr/bin/python instead of a local version.
Use Ubuntu's packages wherever possible (i.e., use apt-get instead of pip).
Use virtualenv for the rest (to keep a clean separation between Ubuntu-packaged and personally installed modules).
I'd go so far as to uninstall the local version of Python and delete /usr/local/lib/python2.7, to ensure that no further mismatches occur. If you don't want to be that drastic, then you can edit your $PATH to put /usr/bin before /usr/local/bin to run the system version of Python by default.
Try downloading the zip file from https://github.com/paramiko/paramiko and running this command in the unzipped directory :
python setup.py install
There are two others methodes for add modules in python :
The first :
Download the package.
Create directory and paste the package in it.
Tap in the terminal :
export PYTHONPATH=$PYTHONPATH:path_of_package
The second :
open python interpreter:
import sys
sys.path.insert(0, "path_of_package")
Try installing only through commands.
Download paramiko package from git using this command: git clone https://github.com/paramiko/paramiko.git
Go to unzipped directory and run export PYTHONPATH=$PYTHONPATH:<path_to_paramiko>
If you find libffi package not found then run this command: sudo apt-get install libffi6 libffi-dev and If you haven't properly installed the header files and static libraries for python dev then run this command: sudo apt-get install python-dev
Enjoy :)
Also, mind the version of python, if the error was reported by python3, then install python3's paramiko.
If you're using Python 3, type the below command
$ sudo -H pip3 install paramiko --ignore-installed
try type pi then tap, this give you this
:$ pi
pic piconv pidstat pinentry-curses ping6
pip3 pivot_root
pic2graph pidof pinentry ping pinky
pip3.6
then you type in whereis pip3
$ whereis pip3
pip3: /usr/local/bin/pip3.6 /usr/local/bin/pip3
xg#xx-ppmaster:/xg/scripts/pyth
$ sudo /usr/local/bin/pip3 install paramiko
This should let you install paramiko
more on python installation
https://danieleriksson.net/2017/02/08/how-to-install-latest-python-on-centos/

Categories

Resources