How can I install autopep8 tool in Spyder in Anaconda? - python-2.7

I have Anaconda2, which come with Spyder.
I want to install an autopep8 for Spyder but I don't know which and how

Normally you can install it using:
pip install spyder.autopep8
So in anaconda (apparently there is no conda build for sypder.autopep8 ) so you just need to make sure you have pip installed in your conda environment and then use pip to install it:
conda install pip
pip install spyder.autopep8
or if you want to install it directly from the github repo:
pip install git+ssh://git#github.com/spyder-ide/spyder-autopep8
If you install directly from git, there is not way for it to give you a distribution not found error.
After that do shift+F8 in spyder to autopep8.
Otherwise, if you are using a .yml file for your conda environment, you just need to add
- pip
- pip:
- git+ssh://git#github.com/spyder-ide/spyder-autopep8
to your environment file and then run
conda env update -f environment.yml
from the command line.

Related

CentOS 6.8 - Installing Python 2.7 leads to a circular dependency error impossible to fix

I have a fresh new minimal installation of CentOS 6.8 where I'm trying to have Python 2.7 with its tools.
First, I started with:
yum -y update
yum groupinstall -y development
yum install -y zlib-dev openssl-devel sqlite-devel bzip2-devel
Then I downloaded the Python 2.7.13 package and installed it normally with:
./configure
make
make altinstall
But then, when trying to install setuptools with:
wget http://url.to.setup.tools.package
tar xf file
cd folder
python2.7 setup.py install
it says that the six package is missing.
If I want to install the six package, it says that the packaging package is missing. If I want to install the packaging package, it says that the pyparsing package is missing. If I want to install the pyparsing package, it says that the setuptools package is missing.
How can this happen? Is now Python 2.7.13 installing itself without anything?
Is there any other way to install Python 2.7 separately from the original Python 2.6 that CentOS 6.8 has?
Thank you very much.
You could manually install EPEL repo and then IUS repo:
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -Uhv epel-release-latest-6.noarch.rpm
wget https://centos6.iuscommunity.org/ius-release.rpm
rpm -Uhv ius-release.rpm
Then you can install Python-2.7 like this:
yum -y install python27 python27-devel python27-pip python27-setuptools python27-virtualenv --enablerepo=ius
Then whatever python script you might have that you want to use Python 2.7.x instead of 2.6 (which is default installed on CentOS 6.x) you have to edit that script and do a simple replace (replace python with python2.7) and you're good to go!

pip command by default using python 3...how to change it to python 2?

I am using macOS Sierra 10.12 and after I upgraded my OS I can no longer install packages for python 3 using pip. Before I used to use pip for python2 and pip3 for python 3 as I have both versions of Python. But now I can no longer use pip to install libraries for python2.
Can anyone help me how can I change my default pip installer to python2? So that I can just use pip install in order to install for python 2.
For your information - when I only type python on terminal it says my default is python 2.7.
on running
which pip
I got /usr/local/bin/pip
Which meant it was pointing to pip2
To change default pip to pip3, run
sudo ln -s /usr/local/bin/pip3 /usr/local/bin/pip
install pip for Python2.7 with easy_install:
sudo easy_install-2.7 pip
now you can use pip for the same specific version of Python:
sudo pip2.7 install BeautifulSoup

I have installed virtualenvwrapper but getting error- workon: command not found

I have just installed virtualenvwrapper by it documentation site and from link http://www.openbookproject.net
but on running command-
workon <vir.Env.Name>
i am getting the following error-
workon: command not found The list of commands i used to install are-
sudo aptitude install python-virtualenv
sudo aptitude install python-dev
mkdir mydjangoapp
cd mydjangoapp/
virtualenv --no-site-packages mydjangoappvenv
virtualenv --no-site-packages jango
source jango/bin/activate
pip install virtualenv
pip install virtualenvwrapper
pip install --install-option="--user" virtualenvwrapper
cat >> ~/.bash_profile
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/directory-you-do-development-in
source /usr/local/bin/virtualenvwrapper.sh
I guess my virtualenvwrapper is not installed. Plz anybody can tell whats the problem.Also tell me what is .bash file and where it is found in our file directory.
I think you may have installed virtualenvwrapper inside any virtual enviroment like this-
rahul#rahulpc:~/mydjangoapp$ source jango/bin/activate
(jango)rahul#rahulpc:~/mydjangoapp$ pip install virtualenvwrapper
So before installing virtualenvwrapper you have to deactivate virtual enviroment.
(jango)rahul#rahulpc:~/mydjangoapp$ deactivate
rahul#rahulpc:~/mydjangoapp$ pip install virtualenvwrapper
now follow all further steps.

pyvenv & pip not installing into local site-packages

I'm test driving the Django 1.6b, Python 3.3.2 (compiled from source) and pyvenv with Ubuntu 12.04.
Every time I try and install perform a pip install [package] the package attempts to install itself globally rather than into my local environment. A simple workflow is as follows:
$ pyvenv environments/roebk
$ source environments/roebk/bin/activate
$ (roebk) pip install south
error: could not create '/usr/local/lib/python3.3/site-packages/south': Permission denied
I've double checked that I'm using the correct version of pip.
$ pip -V
pip 1.4 from /usr/local/lib/python3.3/site-packages/pip-1.4-py3.3.egg (python 3.3)
Am I missing anything obvious?
Did you install setuptools and pip into the environment? virtualenv installs setuptools and pip automatically into a new environment.
$ virtualenv qwerty
New python executable in qwerty/bin/python
Installing setuptools............done.
Installing pip...............done.
$
According to the pyvenv docs you need to install them into the new environment manually.
Common installation tools such as Distribute and pip work as expected
with venvs - i.e. when a venv is active, they install Python packages
into the venv without needing to be told to do so explicitly. Of
course, you need to install them into the venv first: this could be
done by running distribute_setup.py with the venv activated, followed
by running easy_install pip. Alternatively, you could download the
source tarballs and run python setup.py install after unpacking, with
the venv activated.
Upon the official docs I thought Python 3.4 would install pip automatically, but it seems, it doesn't:
Changed in version 3.4: Installs pip by default, added the --without-pip and --copies options
EDIT: Somehow I managed to use a Python3.3.2 version also installed on that machine. With Python3.4, it works as expected.

Installing MySQL-python for Django

I've just learned how to use virtualenv and I installed Django 1.4.5. I'm assuming that the virtualenv created a clean slate for me to work on so with the Django 1.4.5 installed, I copied all my previous files into the virtualenv environment.
I tried to run the server but I get an error saying "no module named MySQLdb". I think this means that I forgot to install MySQL-python. I tried to install it via
pip install MySQL-python
But I get this error
Downloading/unpacking MySQL-python
Running setup.py egg_info for package MySQL-python
The required version of distribute (>=0.6.28) is not available,
and can't be installed while this script is running. Please
install a more recent version first, using
'easy_install -U distribute'.
(Currently using distribute 0.6.24 (/home/bradford/Development/Django/django_1.4.5/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg))
Complete output from command python setup.py egg_info:
The required version of distribute (>=0.6.28) is not available,
and can't be installed while this script is running. Please
install a more recent version first, using
'easy_install -U distribute'.
(Currently using distribute 0.6.24 (/home/bradford/Development/Django/django_1.4.5/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg))
----------------------------------------
Command python setup.py egg_info failed with error code 2 in /home/bradford/Development/Django/django_1.4.5/build/MySQL-python
Not quite sure how to go about fixing this problem =/ any help much appreciated!
I recently had exactly this issue (just not in relation to Django). In my case I am developing on Ubuntu 12.04 using the default pip and distribute versions, which are basically a little out of date for MySQL-python.
Because you are working in an isolated virtualenv, you can safely follow the suggested instruction without affecting your Python installation.
So you can...
workon your_virtualenv #activate your virtualenv, you do use virtualenvwrapper, right?
easy_install -U distribute #update distribute on your virtualenv
pip install MySQL-python #install your package
If for some reason upgrading distribute is not an option, you could try installing an older version of MySQL-python as follows (you'd have to check this version is compatible with your version of Django):
pip install MySQL-python==x.y.z #where x.y.z is the version you want
Spent an hour looking through stackoverflow. Evntually found answer in the other question. This is what saved me:
sudo apt-get install libmysqlclient-dev
mysql_config goes with the package.
When doing in a virtualenv :
pip install MySQL-python
I got
EnvironmentError: mysql_config not found
To install mysql_config, as Artem Fedosov said, first install
sudo apt-get install libmysqlclient-dev
then everything works fine in virtualenv
MySQL driver for Python (mysql-python) needs libmysqlclient-dev. You can get it with:
sudo apt-get update
sudo apt-get install libmysqlclient-dev
If python-dev is not installed, you may have to install it too:
sudo apt-get install python-dev
Now you can install MySQL driver:
pip install mysql-python
Here is a more detailed documentation for MySQL in Django:
http://codex.themedelta.com/how-to-install-django-with-mysql-in-a-virtualenv-on-linux/
I had to do this:
pip install mysql-python
inside the virtualenv
The commands are always run in ubuntu:
easy_install -U distribute
later
sudo apt-get install libmysqlclient-dev
and finally
pip install MySQL-python
The suggested solutions didn't work out for me, because I still got compilation errors after running
`$ sudo apt-get install libmysqlclient-dev`
so I had to run
apt-get install python-dev
Then everything worked fine for me with
apt-get install python-dev
Try this:
Version Python 2.7
MySQL-python package, you should use either MySQL_python‑1.2.5‑cp27‑none‑win32.whl or
MySQL_python‑1.2.5‑cp27‑none‑win_amd64.whl depending on whether you have installed 32-bit or 64-bit Python.
pip install MySQL_python‑1.2.5‑cp27‑none‑win32.whl
if you are using mysqlclient package, then use
mysqlclient‑1.4.6‑cp27‑cp27m‑win32.whl or
mysqlclient‑1.4.6‑cp27‑cp27m‑win_amd64.whl
pip install mysqlclient‑1.4.6‑cp27‑cp27m‑win32.whl
https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysqlclient