I've read the posts, I've seen the ticket about the dopy version and I've tried to do my due diligence, but...
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: NameError: name 'DoError' is not defined
This is still kicking my arse. I'm running OS X El Capitan. I've installed python + pip via Homebrew and I've tried installing Ansible via both Homebrew and pip. I'm still getting the error. What am I missing?
$ which python
/usr/local/bin/python
$ which pip
/usr/local/bin/pip
$ which ansible
/usr/local/bin/ansible
$ python --version
Python 2.7.11
$ pip --version
pip 8.1.1 from /usr/local/lib/python2.7/site-packages (python 2.7)
$ ansible --version
ansible 2.0.1.0
config file = /Users/robwilkerson/Development/uw/ansible-servers/ansible.cfg
configured module search path = Default w/o overrides
$ pip list
...
dopy (0.3.5)
...
I've tried everything I can think of. If I use the system python and try to install pip without ansible I get an OpenSSL error that's a known issue.
I could really use a shove in the right direction.
I recommend to:
use Python 3.x
use virtual environment for ansible and python modules, eg. python3 -m venv ~/.venv && . ~/.venv/bin/activate
pip install -IU pip && pip install ansible dopy
Related
I am using CentOS 8 and want to download a library for Python2.
CentOS 8 has Python3 and its libraries installed by default.
I want to download python-chardet library for Python2. So I tried to install it as below -
$ sudo yum install python-chardet
I got this error -
No match for argument: python-chardet
Error: Unable to find a match: python-chardet
I searched for solution and as per this document you have to download its RPM binary and install it. https://centos.pkgs.org/7/centos-x86_64/python-chardet-2.2.1-3.el7.noarch.rpm.html
Downloading the binary file -
$ wget http://mirror.centos.org/centos/7/os/x86_64/Packages/python-chardet-2.2.1-3.el7.noarch.rpm
Using this rpm library I tried to install python-chardet as below -
$ sudo yum install ./python-chardet-2.2.1-3.el7.noarch.rpm
Here I got an error like this -
Error:
Problem: conflicting requests
- nothing provides /usr/bin/python needed by python-chardet-2.2.1-3.el7.noarch
Python version is
$ python -V
$ Python 2.7.16
/usr/bin/python returned this
Python 2.7.16 (default, Nov 17 2019, 00:07:27)
GCC 8.3.1 (RedHat) on linux2
Any help regarding this is much appreciated.
CentOS/RHEL 8 doesn't have any user-facing Python installed by default.
It has Python 3 installed for system apps like dnf, but to use it as a user, you need sudo dnf install python3.
Similarly, Python 2 and everything for it can be installed by using the appropriate package name suffix. To install Python 2 and the module you need:
sudo dnf install python2 python2-chardet
The recommendation/default is that the unversioned python command should not work and you should invoke the desired Python version on the shell by typing python2 instead of python.
If, for whatever reason you need unversioned python command to invoke Python 2, use the alternatives system:
sudo alternatives --set python /usr/bin/python2
So I tried to install pip using the get-pip.py file, and when I ran the file, terminal told me I already had pip installed on 2.7. However, when I try to find the version of my pip, terminal tells me pip doesn't exist and points to a version of 3.5 I have installed. Clearly my issue is that I have pip installed on v2.7 but the pip command is linked to v3.5. Any clues on how to fix?
Here's a picture of my terminal output:
To install a package in a particular version of python, use the following commands always:
For python 2.x:
sudo python -m pip install [package]
For python 3.x:
sudo python3 -m pip install [package]
This should resolve the doubt of which python version is the given package getting installed for.
Note: This is assuming you have not created aliases for the python command
I just set up a new Ubuntu 14.04 and installed django using apt-get. Now django is installed in version 1.6.1 which is an insecure and unsupported version. The end of the extended support was April 2015 (https://www.djangoproject.com/download/) so I don't see why there is such an old version in the official apt-get.
Is there a good reason for this behaviour?
I think apt-get repository is not updated for django
Instead of using apt-get use pip to install Django(sudo pip install django). You shoud use virtualenv to run more than one python apps. Suppose you want to run more one applications,(hosting more than one django websites of different version or requirements.), run you applications in different virtualenv. Different applications may have different reuirements or version.
It's easy to install:
Install Virtualenv
$ pip install virtualenv
$ pip install virtualenvwrapper
$ source virtualenvwrapper.sh
$ mkvirtualenv virtualenv_name // create virtualenv
$ workon virtualenv_name
To restart virtalenv later
Run:
$ source virtualenvwrapper.sh
$ lsvirtualenv // list all virtual env
$ workon virtualenv_name // start working on virtual env
Now install you requirements on virtualenv.
$ pip install django==1.8
Try to learn here
http://www.tangowithdjango.com/book17/chapters/requirements.html#virtual-environments
I am working on small python scripts. Basically i am not a python programmer and very new to it. Recently i have been working on IOT protocol MQTT. I have installed a open source MQTT clinet based on python3 in my raspberypi board. And now i am facing a problem. I have python 2.7 and 3.2 installed.
My MQTT client work with Python3.x and i want to use pyserial library also which i am not able to , i am getting a error
Serial module not found
I goggled a bit and end up here.. Now it say that you need to install pip3 in order to install pyserial for python3.x.
I tried to install pip3 using this link , but end up installing pip2 using
pip install -U pip
I feel totally being messed up now. I just want to use pyserial while working with python3.x version.Can any one suggest me how?
Edit 1:
On Linux, Mac OS X and other POSIX systems, use the versioned Python commands in combination with the -m switch to run the appropriate copy of pip:
python2 -m pip install SomePackage # default Python 2
python2.7 -m pip install SomePackage # specifically Python 2.7
python3 -m pip install SomePackage # default Python 3
python3.4 -m pip install SomePackage # specifically Python 3.4
I recently came through this documentation given here . But it even give a error to me /usr/bin/python3 : NO module named pip. main : 'pip' is a package and cannot be installed directly.
Assuming you're using raspbian on your pi, you could install pip3 from the normal repositories:
apt-get install python3-pip
You can get the serial module the same way:
apt-get install python3-serial
I succeeded installing pyserial2.7 on a Mac running Yosemite and Python3.4
I entered the pyserial-x.y directory and run:
python3 setup.py install
I got lot of errors that I corrected one by one by editing the files containing the syntax errors. Only 2 types of errors are encountered:
- print needs ()
- except needs as instead of ,
So by correcting the dozen of errors with some patience, installation finish correctly.
I wonder why a syntactically correct version for Python3 is not ready!
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.