Universal way of getting a list of Python modules? - python

I know that pip install or pip freeze can give out the list of python modules installed. Is there a way by which I could change the way I get the output?
For example: pip freeze gives me:
Landscape-Client==14.12
PAM==0.4.2
Twisted-Core==13.2.0
apt-xapian-index==0.45
argparse==1.2.1
Is there a way that I could change this to display:
Landscape-Client-14.12
PAM-0.4.2
Twisted-Core-13.2.0
apt-xapian-index-0.45
argparse-1.2.1
Also, is there a way to get the list of all python components - both from pip & pip3 or do I have to run the command individually?
The way I am looking at it is to see if we can somehow control the output that pip or pip3 gives us.

pip list outputs like the following
adium-theme-ubuntu (0.3.4)
appdirs (1.4.0)
argh (0.26.2)
args (0.1.0)
Babel (2.3.4)
BeautifulSoup (3.2.1)
cffi (1.9.1)
click (6.7)
clint (0.5.1)
colorama (0.3.7)
compass-stylesheets (1.0.2)
cryptography (1.7.2)
Cython (0.23)
decorator (4.0.11)
Django (1.10.5)
django-request (1.5.1)
djangorestframework (3.5.4)
docutils (0.13.1)
enum34 (1.1.6)
future (0.16.0)
get (0.0.0)
gitdb (0.6.4)
gitdb2 (2.0.0)
GitPython (2.1.1)
gyp (0.1)
httplib2 (0.10.3)
idna (2.2)
image (1.5.5)
influxdb (4.0.0)
ipaddress (1.0.18)
jedi (0.10.0)
Kivy (1.9.1)
Kivy-Garden (0.1.4)
Markdown (2.6.8)
monkeylearn (0.3.6)
networkx (1.11)
numpy (1.12.0)
olefile (0.44)
packaging (16.8)
pandas (0.19.2)
pathlib (1.0.1)
pathtools (0.1.2)
pefile (2016.3.28)
Pillow (4.0.0)
pip (9.0.1)
pkginfo (1.4.1)
post (0.0.0)
public (0.0.0)
pyasn1 (0.2.2)
pycparser (2.17)
pycrypto (2.6.1)
pycryptodome (3.4.5)
pyglet (1.2.4)
Pygments (2.2.0)
pygobject (3.22.0)
pyOpenSSL (16.2.0)
pyparsing (2.1.10)
PyPDF2 (1.26.0)
pyScss (1.3.5)
pystache (0.5.4)
Pyste (0.9.10)
python-dateutil (2.6.0)
pytz (2016.10)
pyxdg (0.25)
PyYAML (3.12)
query-string (0.0.0)
request (0.0.0)
requests (2.13.0)
requests-toolbelt (0.7.1)
rsa (3.4.2)
setupfiles (0.0.0)
setuptools (34.2.0)
simplejson (3.10.0)
six (1.10.0)
smmap (0.9.0)
smmap2 (2.0.1)
swapper (1.0.0)
twine (1.8.1)
ubuntuone-client-data (14.4)
unity-lens-photos (1.0)
urllib3 (1.21.1)
virtualenv (15.1.0)
watchdog (0.8.3)
wheel (0.29.0)
I've never tried to supply additional commands to "list" but as it was pointed out you could write a script.
I'm not quite sure what you mean by "All python components" as that's very broad.
The "pip freeze" commands outputs installed packages in requirements format.
pip list just outputs all locally installed packages along with their version in a somewhat cleaner format. Could you perhaps give me more information as to what you meant by "all python components" in case this answer doesn't help?

Related

While instaling Buildozer for kivy i had an error saing "zipp is missing"

It's been several times that I try to install Buildozer to convert my kivy application to APK.
I use a version of Linux from the Window Store.
After downloading all the dependencies,
I launch the install of Buildozer with the command: sudo python
setup.py install
And I get an error.
I follow this method: https://kivy.org/doc/stable/guide/packaging-android.html
Installed /usr/local/lib/python2.7/dist-packages/buildozer-1.0.1.dev0-py2.7.egg
Processing dependencies for buildozer==1.0.1.dev0
Searching for zipp>=0.4
Reading https://pypi.python.org/simple/zipp/
Downloading https://files.pythonhosted.org/packages/ce/8c/2c5f7dc1b418f659d36c04dec9446612fc7b45c8095cc7369dd772513055/zipp-3.1.0.tar.gz#sha256=c599e4d75c98f6798c509911d08a22e6c021d074469042177c8c86fb92eefd96
Best match: zipp 3.1.0
Processing zipp-3.1.0.tar.gz
Writing /tmp/easy_install-7EAeC9/zipp-3.1.0/setup.cfg
Running zipp-3.1.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-7EAeC9/zipp-3.1.0/egg-dist-tmp-EWghGG
File "build/bdist.linux-x86_64/egg/zipp.py", line 217
def open(self, mode='r', *args, pwd=None, **kwargs):
^
SyntaxError: invalid syntax
zip_safe flag not set; analyzing archive contents...
Removing /usr/local/lib/python2.7/dist-packages/zipp-0.0.0-py2.7.egg
Moving zipp-0.0.0-py2.7.egg to /usr/local/lib/python2.7/dist-packages
zipp 0.0.0 is already the active version in easy-install.pth
Installed /usr/local/lib/python2.7/dist-packages/zipp-0.0.0-py2.7.egg
error: The 'zipp>=0.4' distribution was not found and is required by importlib-resourcese
I managed to install zipp independently but the error is still there
If i do : pip3 list
i get :
appdirs (1.4.3)
asn1crypto (0.24.0)
attrs (17.4.0)
Automat (0.6.0)
blinker (1.4)
certifi (2018.1.18)
chardet (3.0.4)
click (6.7)
cloud-init (19.4)
colorama (0.3.7)
command-not-found (0.3)
configobj (5.0.6)
constantly (15.1.0)
cryptography (2.1.4)
Cython (0.29.16)
distlib (0.3.0)
distro-info (0.18ubuntu0.18.04.1)
docutils (0.16)
filelock (3.0.12)
httplib2 (0.9.2)
hyperlink (17.3.1)
idna (2.6)
importlib-metadata (1.6.0)
importlib-resources (1.4.0)
incremental (16.10.1)
Jinja2 (2.10)
jsonpatch (1.16)
jsonpointer (1.10)
jsonschema (2.6.0)
keyring (10.6.0)
keyrings.alt (3.0)
Kivy (1.11.1)
Kivy-Garden (0.1.4)
language-selector (0.1)
MarkupSafe (1.0)
netifaces (0.10.4)
oauthlib (2.0.6)
PAM (0.4.2)
pexpect (4.8.0)
pip (9.0.1)
ptyprocess (0.6.0)
pyasn1 (0.4.2)
pyasn1-modules (0.2.1)
pycrypto (2.6.1)
Pygments (2.6.1)
pygobject (3.26.1)
PyJWT (1.5.3)
pyOpenSSL (17.5.0)
pyserial (3.4)
python-apt (1.6.5+ubuntu0.2)
python-debian (0.1.32)
pyxdg (0.25)
PyYAML (3.12)
requests (2.18.4)
requests-unixsocket (0.1.5)
SecretStorage (2.3.1)
service-identity (16.0.0)
setuptools (39.0.1)
sh (1.12.14)
six (1.14.0)
ssh-import-id (5.7)
systemd-python (234)
Twisted (17.9.0)
ufw (0.36)
unattended-upgrades (0.1)
urllib3 (1.22)
virtualenv (20.0.17)
wheel (0.30.0)
zipp (3.1.0)
zope.interface (4.3.2)
Installed /usr/local/lib/python2.7/dist-packages/buildozer-1.0.1.dev0-py2.7.egg
It looks like you've installed buildozer for python2, whereas you only checked for the zipp module in your python3 environment.
If find the solution,
if i install buildozer with pyhton 3
sudo python3 setup.py install

Can I still use virtualenv after installing Anaconda?

I used to use virtualenv to create different project environments, same library (different versions). Recently, I installed Anaconda to do some Machine Learning. When I try to create a new environment using virtualenv I get this error:
(venv) usr#KC-SCE:~/Desktop/bTree$ pip install nltk
Requirement already satisfied: nltk in /home/usr/anaconda3/lib/python3.6/site-packages (3.3)
Requirement already satisfied: six in /home/usr/anaconda3/lib/python3.6/site-packages (from nltk) (1.11.0)
tensorflow-tensorboard 1.5.1 has requirement bleach==1.5.0, but you'll have bleach 2.1.3 which is incompatible.
tensorflow-tensorboard 1.5.1 has requirement html5lib==0.9999999, but you'll have html5lib 1.0.1 which is incompatible.
tensorboard 1.8.0 has requirement bleach==1.5.0, but you'll have bleach 2.1.3 which is incompatible.
tensorboard 1.8.0 has requirement html5lib==0.9999999, but you'll have html5lib 1.0.1 which is incompatible.
jupyterlab 0.32.1 has requirement jupyterlab_launcher<0.11.0,>=0.10.0, but you'll have jupyterlab-launcher 0.11.0 which is incompatible.
What I do not understand is that why I am not able to download a library that already exists! I may need it in another version or else.

the confusion of installing locustio

I use pip install locustio and being notified that success, but locust --help get message command not found locust.
and I use pip list and get result as below:
beautifulsoup4 (4.6.0)
click (6.7)
decorator (4.0.11)
Flask (0.12.2)
gevent (1.2.2)
greenlet (0.4.12)
html5lib (0.999999999)
itsdangerous (0.24)
Jinja2 (2.9.6)
locustio (0.8)
MarkupSafe (1.0)
msgpack-python (0.4.8)
oauthlib (2.0.2)
pip (9.0.1)
Pygments (2.2.0)
pyzmq (16.0.2)
requests (2.14.2)
requests-oauthlib (0.8.0)
robotframework (3.0.2)
robotframework-extendedrequestslibrary (0.5.5)
robotframework-requests (0.4.7)
robotframework-ride (1.5.2.1)
robotframework-selenium2library (1.8.0)
selenium (3.4.1)
setuptools (28.8.0)
six (1.10.0)
webencodings (0.5.1)
Werkzeug (0.12.2)
wxPython (2.8.12.1)
wxPython-common (2.8.12.1)
You can see that locustio has been installed. But why I can not use it properly ?
Anyone can give some advice?

mkvirtualenv --no-site-packages still finds and installs global packages in new environment

I am using virtualenvwrapper to create/manage my virtual environments. Upon running pip freeze on my environments, I was surprised to find that several tens of Python modules and packages (installed before I knew about virtualenv/wrapper), are being installed in my new environment.
This is NOT the expected behaviour; I want to have a clean environment, where only the packages I have installed in that environment, are available.
The command I'm using is:
mkvirtualenv --no-site-packages mynewenv
When I run pip freeze in that new environment, I get the following long list (I was expecting nothing to be installed in the new environment):
apturl (0.5.2)
beautifulsoup4 (4.4.1)
bleach (1.5.0)
blinker (1.3)
Brlapi (0.6.4)
chardet (2.3.0)
checkbox-support (0.22)
command-not-found (0.3)
coverage (3.7.1)
cryptography (1.2.3)
Cython (0.25.2)
decorator (4.0.10)
defer (1.0.6)
Django (1.10.5)
djangorestframework (3.5.3)
entrypoints (0.2.2)
enum34 (1.1.6)
feedparser (5.1.3)
guacamole (0.9.2)
html5lib (0.999)
httplib2 (0.9.1)
idna (2.0)
ipykernel (4.5.2)
ipython (5.1.0)
ipython-genutils (0.1.0)
ipywidgets (5.2.2)
Jinja2 (2.8)
jsonschema (2.5.1)
jupyter (1.0.0)
jupyter-client (4.4.0)
jupyter-console (5.0.0)
jupyter-core (4.2.1)
language-selector (0.1)
louis (2.6.4)
lxml (3.5.0)
lz4 (0.8.2)
Mako (1.0.3)
MarkupSafe (0.23)
mistune (0.7.3)
mockextras (1.0.2)
nbconvert (5.0.0)
nbformat (4.2.0)
notebook (4.3.1)
numpy (1.11.3)
oauthlib (1.0.3)
onboard (1.2.0)
padme (1.1.1)
pandas (0.19.2)
pandocfilters (1.4.1)
pbr (1.10.0)
pexpect (4.0.1)
pickleshare (0.7.4)
Pillow (3.1.2)
pip (9.0.1)
plainbox (0.25)
prompt-toolkit (1.0.9)
ptyprocess (0.5)
pyasn1 (0.1.9)
pycups (1.9.73)
pycurl (7.43.0)
Pygments (2.1)
pygobject (3.20.0)
PyJWT (1.3.0)
pymongo (3.4.0)
pyparsing (2.0.3)
pysmbc (1.0.15.5)
python-apt (1.1.0b1)
python-dateutil (2.6.0)
python-debian (0.1.27)
python-systemd (231)
pytz (2016.10)
pyxdg (0.25)
pyzmq (16.0.2)
qtconsole (4.2.1)
reportlab (3.3.0)
requests (2.9.1)
sessioninstaller (0.0.0)
setuptools (23.0.0)
simplegeneric (0.8.1)
six (1.10.0)
stevedore (1.15.0)
system-service (0.3)
terminado (0.6)
testpath (0.3)
tornado (4.4.2)
traitlets (4.3.1)
tzlocal (1.3)
ubuntu-drivers-common (0.0.0)
ufw (0.35)
unattended-upgrades (0.1)
unity-scope-calculator (0.1)
unity-scope-chromiumbookmarks (0.1)
unity-scope-colourlovers (0.1)
unity-scope-devhelp (0.1)
unity-scope-firefoxbookmarks (0.1)
unity-scope-gdrive (0.7)
unity-scope-manpages (0.1)
unity-scope-openclipart (0.1)
unity-scope-texdoc (0.1)
unity-scope-tomboy (0.1)
unity-scope-virtualbox (0.1)
unity-scope-yelp (0.1)
unity-scope-zotero (0.1)
urllib3 (1.13.1)
usb-creator (0.3.0)
virtualenv (15.1.0)
virtualenv-clone (0.2.6)
wcwidth (0.1.7)
wheel (0.29.0)
widgetsnbextension (1.2.6)
xdiagnose (3.8.4)
xkit (0.0.0)
XlsxWriter (0.7.3)
[[Miscellaneous Information]]
virtualenv --version 15.1.0
virtualenvwrapper==4.7.2
OS: Ubuntu 16.0.4
Python: 2.7 & 3.5
which pip : /usr/local/bin/pip
which pip3: /usr/local/bin/pip3
What am I doing wrong?
Did you activate the virtualenv? It's done by "sourcing" the active script:
source <env>/bin/activate
Other problems could be long path names or spaces in the path. What does pwd give in the you virtualenv directory?

pip error code 1 when installing pyopenssl

Hi I am trying to install pyopenssl so i can use scrapy. When i run the installation i get this error with pip. I also get the same error when trying to install scrapy...
Command python setup.py egg_info failed with error code 1 in /private/var/folders/hy/76g5m82s4nx4b8f4m1tzdd9h0000gn/T/pip_build_joegavin/cryptography
Storing debug log for failure in /Users/joegavin/.pip/pip.log
here is my pip list incase i'm missing something
apptools (4.2.1)
argcomplete (0.6.7)
astropy (0.3)
atom (0.3.7)
backports.ssl-match-hostname (3.4.0.2)
beautifulsoup4 (4.3.1)
binstar (0.4.4)
biopython (1.63)
bitarray (0.8.1)
blaze (0.4.2)
blz (0.6.1)
bokeh (0.4.1)
boto (2.25.0)
casuarius (1.1)
cdecimal (2.3)
chaco (4.4.1)
colorama (0.2.7)
conda (3.4.2)
conda-build (1.3.1)
configobj (4.7.2)
cubes (0.10.2)
Cython (0.20.1)
DataShape (0.1.1)
distribute (0.7.3)
docutils (0.11)
enable (4.3.0)
enaml (0.9.1)
envisage (4.4.0)
Flask (0.10.1)
future (0.11.2)
gevent (1.0)
gevent-websocket (0.9.2)
gevent-zeromq (0.2.2)
greenlet (0.4.2)
grin (1.2.1)
h5py (2.2.1)
ipython (2.0.0)
itsdangerous (0.23)
jdcal (1.0)
Jinja2 (2.7.2)
keyring (3.3)
kiwisolver (0.1.2)
llvmpy (0.12.3)
lxml (3.3.5)
MarkupSafe (0.18)
matplotlib (1.3.1)
mayavi (4.3.1)
MDP (3.3)
mock (1.0.1)
netCDF4 (1.0.8)
networkx (1.8.1)
nltk (2.0.4)
nose (1.3.0)
numba (0.12.1)
numexpr (2.3.1)
numpy (1.8.0)
openpyxl (2.0.2)
pandas (0.13.1)
patsy (0.2.1)
pep8 (1.4.6)
PIL (1.1.7)
pip (1.5.6)
ply (3.4)
psutil (1.2.1)
py (1.4.20)
PyAudio (0.2.7)
pycosat (0.6.0)
pycparser (2.10)
pycrypto (2.6.1)
pycurl (7.19.0)
PyExcelerate (0.6.1)
pyface (4.4.0)
pyflakes (0.7.3)
Pygments (1.6)
pyinstall (0.1.4)
PyInstaller (2.1)
pykit (0.2.0)
pyparsing (2.0.1)
PySAL (1.6.0)
pysam (0.6)
pytest (2.5.2)
python-dateutil (1.5)
pytz (2013b)
PyYAML (3.11)
pyzmq (2.2.0.1)
redis (2.9.1)
requests (2.2.1)
rope (0.9.4)
scikit-image (0.9.3)
scikit-learn (0.14.1)
scipy (0.13.3)
setuptools (5.1)
six (1.5.2)
Sphinx (1.2.1)
spyder (2.2.5)
SQLAlchemy (0.9.2)
statsmodels (0.5.0)
sympy (0.7.4.1)
tables (3.1.0)
tornado (3.2)
traits (4.4.0)
traitsui (4.4.0)
ujson (1.33)
virtualenv (1.11.5)
VTK (5.10.1)
Werkzeug (0.9.4)
wsgiref (0.1.2)
xlrd (0.9.2)
XlsxWriter (0.5.2)
xlwt (0.7.5)
I've tried updating setup tools, reinstalling pip. I'm on OSX can anybody help? Thanks
UPDATE : Pastebin for pip.log : http://pastebin.com/MTNrR0n5
Error code 1 sometimes occurs due to lack of permissions. If you have an admin account, try prefacing your command with sudo.
Perhaps your Python lacks openssl support?
You can find out:
python
>>> import socket
>>> hasattr(socket, 'ssl')
True
If socket doesn't have the ssl attribute, you don't have the needed capabilities.
AFAIK, openssl support must be selected for compilation of the Python interpreter and cannot be installed afterwards.

Categories