Install module using pip within Anaconda environment - python

I've recently transitioned to an Anaconda environment on RHEL6, but I need a module not in the conda repository. So I install it with pip:
(gt_keys)[user#server gtkey]$ which pip
/srv/home/shared/anaconda/envs/gt_keys/bin/pip
(gt_keys)[user#server gtkey]$ pip install owslib
Downloading/unpacking owslib
Downloading OWSLib-0.8.3.tar.gz (97kB): 97kB downloaded
Running setup.py egg_info for package owslib
Requirement already satisfied (use --upgrade to upgrade): python-dateutil>=1.5 in /srv/home/shared/anaconda/lib/python2.7/site-packages (from owslib)
Requirement already satisfied (use --upgrade to upgrade): pytz in /srv/home/shared/anaconda/lib/python2.7/site-packages (from owslib)
Requirement already satisfied (use --upgrade to upgrade): pytest in /srv/home/shared/anaconda/lib/python2.7/site-packages (from owslib)
Requirement already satisfied (use --upgrade to upgrade): pytest-cov in /srv/home/shared/anaconda/lib/python2.7/site-packages (from owslib)
Requirement already satisfied (use --upgrade to upgrade): PIL in /srv/home/shared/anaconda/lib/python2.7/site-packages/PIL (from owslib)
Requirement already satisfied (use --upgrade to upgrade): cov-core>=1.6 in /srv/home/shared/anaconda/lib/python2.7/site-packages (from pytest-cov->owslib)
Requirement already satisfied (use --upgrade to upgrade): coverage>=3.4 in /srv/home/shared/anaconda/lib/python2.7/site-packages (from cov-core>=1.6->pytest-cov->owslib)
Installing collected packages: owslib
Running setup.py install for owslib
Successfully installed owslib
Cleaning up...
But it doesn't work in my environment:
(gt_keys)[user#server gtkey]$ which python
/srv/home/shared/anaconda/envs/gt_keys/bin/python
(gt_keys)[user#server gtkey]$ python -c 'import owslib'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named owslib
owslib only made it to the base Ananaconda install:
sh-4.1$ which python
/srv/home/shared/anaconda/bin/python
sh-4.1$ python -c 'import owslib'
What am I doing wrong?

I don't know why, but this time it worked:
pip install owslib --allow-external PIL --allow-unverified PIL
I would be interested, still, in any comments on my process. Something strange was happening that was resolved when I reconnected to the server this morning after failing last night. Must be something with the path.

Related

Pubnub installation on Onion omega 2 plus freezes

I am unable to install the python pubnub SDK on my Onion Omega 2 plus board. The installation always freezes at the following stage:
root#Omega-E5A5:/# pip3 install pubnub
Collecting pubnub
Using cached https://files.pythonhosted.org/packages/94/a4/321d50db8786e19e41be43da22fe38a03d5fc0560d9b815a8b5e11ea068e/pubnub-4.0.13.tar.gz
Collecting pycryptodomex>=3.3 (from pubnub)
Using cached https://files.pythonhosted.org/packages/6a/c4/21d55c2bf30995847406cb1a737d4ae5e19615eca39c9258f0548b5656f1/pycryptodomex-3.6.1.tar.gz
Requirement already satisfied (use --upgrade to upgrade): requests>=2.4 in /usr/lib/python3.6/site-packages (from pubnub)
Requirement already satisfied (use --upgrade to upgrade): six>=1.10 in /usr/lib/python3.6/site-packages (from pubnub)
Requirement already satisfied (use --upgrade to upgrade): idna<2.7,>=2.5 in /usr/lib/python3.6/site-packages (from requests>=2.4->pubnub)
Requirement already satisfied (use --upgrade to upgrade): urllib3<1.23,>=1.21.1 in /usr/lib/python3.6/site-packages (from requests>=2.4->pubnub)
Requirement already satisfied (use --upgrade to upgrade): certifi>=2017.4.17 in /usr/lib/python3.6/site-packages (from requests>=2.4->pubnub)
Requirement already satisfied (use --upgrade to upgrade): chardet<3.1.0,>=3.0.2 in /usr/lib/python3.6/site-packages (from requests>=2.4->pubnub)
Installing collected packages: pycryptodomex, pubnub
Running setup.py install for pycryptodomex ... /
I tried installing the pycryptodomex library manually with no success, still had the same problem. It freezes after a certain point during setup.py run.
I was able to install PubNub on my Mac.
'pip install pubnub'
ENV
what's your Python version?
python v3 got 'venv' by default,
have you tried installing 'pubnub' under a 'venv'?
Feel free to contact PubNub's support team, they are very helpful :)

zshell pip can't find package autobahn[serialization]

I was trying to install serialization variant of autobahn. However, when I do that in zsh, I get an error.
zsh: no matches found: autobahn[serialization]
However, as soon as I use bash, it works. Below is my command line log:
kapil#kapil-linux ~
[23:59:19]
> $ pip install autobahn[serialization]
zsh: no matches found: autobahn[serialization]
kapil#kapil-linux ~ [23:59:25]
> $ bash
[kapil#kapil-linux ~]$ pip install autobahn[serialization]
Collecting autobahn[serialization]
Using cached autobahn-0.16.0-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): six>=1.10.0 in ./anaconda2/lib/python2.7/site-packages (from autobahn[serialization])
Requirement already satisfied (use --upgrade to upgrade): txaio>=2.5.1 in ./anaconda2/lib/python2.7/site-packages (from autobahn[serialization])
Requirement already satisfied (use --upgrade to upgrade): u-msgpack-python>=2.1; extra == "serialization" in ./anaconda2/lib/python2.7/site-packages (from autobahn[serialization])
Requirement already satisfied (use --upgrade to upgrade): py-ubjson>=0.8.4; extra == "serialization" in ./anaconda2/lib/python2.7/site-packages (from autobahn[serialization])
Requirement already satisfied (use --upgrade to upgrade): cbor>=1.0.0; extra == "serialization" in ./anaconda2/lib/python2.7/site-packages (from autobahn[serialization])
Installing collected packages: autobahn
Successfully installed autobahn-0.16.0
[kapil#kapil-linux ~]$ pip install --upgrade --force-reinstall autobahn[serialization]
Collecting autobahn[serialization]
Using cached autobahn-0.16.0-py2.py3-none-any.whl
Collecting six>=1.10.0 (from autobahn[serialization])
Using cached six-1.10.0-py2.py3-none-any.whl
Collecting txaio>=2.5.1 (from autobahn[serialization])
Using cached txaio-2.5.1-py2.py3-none-any.whl
Collecting u-msgpack-python>=2.1; extra == "serialization" (from autobahn[serialization])
Collecting py-ubjson>=0.8.4; extra == "serialization" (from autobahn[serialization])
Collecting cbor>=1.0.0; extra == "serialization" (from autobahn[serialization])
Installing collected packages: six, txaio, u-msgpack-python, py-ubjson, cbor, autobahn
Found existing installation: six 1.10.0
Uninstalling six-1.10.0:
Successfully uninstalled six-1.10.0
Found existing installation: txaio 2.5.1
Uninstalling txaio-2.5.1:
Successfully uninstalled txaio-2.5.1
Found existing installation: u-msgpack-python 2.1
Uninstalling u-msgpack-python-2.1:
Successfully uninstalled u-msgpack-python-2.1
Found existing installation: py-ubjson 0.8.5
Uninstalling py-ubjson-0.8.5:
Successfully uninstalled py-ubjson-0.8.5
Found existing installation: cbor 1.0.0
Uninstalling cbor-1.0.0:
Successfully uninstalled cbor-1.0.0
Found existing installation: autobahn 0.16.0
Uninstalling autobahn-0.16.0:
Successfully uninstalled autobahn-0.16.0
Successfully installed autobahn-0.16.0 cbor-1.0.0 py-ubjson-0.8.5 six-1.10.0 txaio-2.5.1 u-msgpack-python-2.1
[kapil#kapil-linux ~]$ exit
exit
kapil#kapil-linux ~ [0:00:27]
> $ pip install autobahn[serialization]
zsh: no matches found: autobahn[serialization]
I don't understand what might be going on with zsh.
Also, here is the output of my which pip:
> $ which pip
~/anaconda2/bin/pip
kapil#kapil-linux ~ [0:18:24]
> $ bash
[kapil#kapil-linux ~]$ which pip
~/anaconda2/bin/pip
[kapil#kapil-linux ~]$
Square brackets are special characters in zsh, you can escape them with backslash:
pip install autobahn\[serialization\]
Or escape square brackets by default in zsh.

Modified dependencies in python package do not show up

In a Python package I have, in setup.py I modified the dependencies by removing the condition on the version number:
setup(
name='MyTool',
version='0.1.5',
author='myname',
author_email='myname#myname.com',
packages=['mytool'],
scripts=['bin/my_tool.py'],
url='https://pypi.python.org/pypi/mytool',
license='LICENSE.txt',
description='This is my tool.',
long_description=open('README.txt').read(),
install_requires=[
"scipy",
"numpy",
"prettytable"
],
)
I ran:
$ python setup.py sdist
$ python setup.py sdist upload
But when I run pip, it refers to the previous requirements:
$ sudo pip install MyTool
Requirement already satisfied (use --upgrade to upgrade): MyTool in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied (use --upgrade to upgrade): scipy>=0.7.0 in /usr/local/lib/python2.7/dist-packages (from MyTool)
Requirement already satisfied (use --upgrade to upgrade): numpy in /usr/local/lib/python2.7/dist-packages (from MyTool)
Requirement already satisfied (use --upgrade to upgrade): prettytable>=0.7.2 in /usr/local/lib/python2.7/dist-packages (from MyTool)
Cleaning up...
What did I do wrong?
That means you have already installed package MyTool.
If you want to install the latest version (the uploaded version just now), try:
sudo pip install -U MyTool

simpleldap import missing module error

The following are output of trace when I have tried to install ldap with pip.
[root#reports-hammer-local tests]# pip install simpleldap
Requirement already satisfied (use --upgrade to upgrade): simpleldap in /usr/local/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): python-ldap in /usr/local/lib/python2.7/site-packages (from simpleldap)
Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/local/lib/python2.7/site-packages/setuptools-1.4.2-py2.7.egg (from python-ldap->simpleldap)
Cleaning up...
[root#reports-hammer-local tests]# python tests.py
Traceback (most recent call last):
File "tests.py", line 7, in `
import simpleldap`
ImportError: No module named simpleldap
I can't run the test because of missing module issues. can you please hep me to fix this.

Running fab sanity gives an error: no module named quilt

I an now setting up a work environment on some open source project I just cloned from GitHub,
after running
pip install -U -r requirements.txt
in a virtualenv of course, I was trying to run fab sanity as this projects uses fabric, and I am getting the following error:
(openmuni)oleg#oleg-Lenovo-G580:~/dev/openmuni-budgets$ fab sanity
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/fabric/main.py", line 637, in main
docstring, callables, default = load_fabfile(fabfile)
File "/usr/lib/python2.7/dist-packages/fabric/main.py", line 164, in load_fabfile
imported = importer(os.path.splitext(fabfile)[0])
File "/home/oleg/dev/openmuni-budgets/fabfile/__init__.py", line 1, in <module>
from quilt import *
ImportError: No module named quilt
The most trivial 2 solutions didn't work unfortunately:
(openmuni)oleg#oleg-Lenovo-G580:~/dev/openmuni-budgets$ pip install quilt
Requirement already satisfied (use --upgrade to upgrade): quilt in /home/oleg/.virtualenvs/openmuni/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): Fabric>=1.8.0 in /home/oleg/.virtualenvs/openmuni/lib/python2.7/site-packages (from quilt)
Requirement already satisfied (use --upgrade to upgrade): cuisine>=0.6.5 in /home/oleg/.virtualenvs/openmuni/lib/python2.7/site-packages (from quilt)
Requirement already satisfied (use --upgrade to upgrade): paramiko>=1.10.0 in /home/oleg/.virtualenvs/openmuni/lib/python2.7/site-packages (from Fabric>=1.8.0->quilt)
Requirement already satisfied (use --upgrade to upgrade): pycrypto>=2.1,!=2.4 in /home/oleg/.virtualenvs/openmuni/lib/python2.7/site-packages (from paramiko>=1.10.0->Fabric>=1.8.0->quilt)
Requirement already satisfied (use --upgrade to upgrade): ecdsa in /home/oleg/.virtualenvs/openmuni/lib/python2.7/site-packages (from paramiko>=1.10.0->Fabric>=1.8.0->quilt)
Cleaning up...
(openmuni)oleg#oleg-Lenovo-G580:~/dev/openmuni-budgets$ pip install python-quilt
Requirement already satisfied (use --upgrade to upgrade): python-quilt in /home/oleg/.virtualenvs/openmuni/lib/python2.7/site-packages
Cleaning up...
Running:
deavtivate
and then
pip install python-quilt solved it, but that means that quilt is now global and installed outside of the virtualenv, a bit of a hack.

Categories

Resources